diff --git a/packages/website/astro.config.mjs b/packages/website/astro.config.mjs index 3b002a848..12a87cc82 100644 --- a/packages/website/astro.config.mjs +++ b/packages/website/astro.config.mjs @@ -20,6 +20,10 @@ export default defineConfig({ outDir: '../../dist/website', prefetch: true, + build: { + concurrency: 4, + }, + integrations: [react(), sitemap()], vite: { resolve: { diff --git a/packages/website/src/pages/[...locale]/api/_index.tsx b/packages/website/src/pages/[...locale]/api/_index.tsx index bbaa887e4..5bbaeb6f2 100644 --- a/packages/website/src/pages/[...locale]/api/_index.tsx +++ b/packages/website/src/pages/[...locale]/api/_index.tsx @@ -9,7 +9,7 @@ interface SlugsTableProps { path: string; } -const MAX_UNEXPANDED = 5; +const MAX_UNEXPANDED = 3; export function SlugsTable({ slugs, path }: SlugsTableProps) { if (slugs === undefined) return null; diff --git a/packages/website/src/pages/api/gallery/[avatar].webp.ts b/packages/website/src/pages/api/gallery/[avatar].webp.ts index 88e78151a..fe6378b8d 100644 --- a/packages/website/src/pages/api/gallery/[avatar].webp.ts +++ b/packages/website/src/pages/api/gallery/[avatar].webp.ts @@ -18,9 +18,9 @@ const glossary = await fetchGlossary(DEFAULT_LOCALE); * Returns an in-game avatar image. Use gallery/list.json to get all valid ids. * Some images may be animated. Not all images share the same dimensions. * - * @warning Not all ids have images due to poor Wargaming CDN. + * @warning Not all ids have images due to lousy Wargaming CDN. * @param avatar The avatar id. - * @returns A webp image. + * @returns WEBP. */ export const GET: APIRoute<{}, { avatar: string }> = async ({ params }) => { const image = diff --git a/packages/website/src/pages/api/gallery/list.json.ts b/packages/website/src/pages/api/gallery/list.json.ts new file mode 100644 index 000000000..e69de29bb diff --git a/packages/website/src/pages/api/tanks/[id]/icons/big.png.ts b/packages/website/src/pages/api/tanks/[id]/icons/big.png.ts new file mode 100644 index 000000000..fdd428521 --- /dev/null +++ b/packages/website/src/pages/api/tanks/[id]/icons/big.png.ts @@ -0,0 +1,16 @@ +import { asset } from '@blitzkit/core'; +import type { APIRoute } from 'astro'; + +export { getStaticPaths } from '../meta.json'; + +/** + * Returns the big icon for a tank, the image that appears in the tank carousal in the garage. Use tanks/list.json for all valid ids. + * + * @param id The tank id. + * @returns PNG. + */ +export const GET: APIRoute<{}, { id: string }> = async ({ params }) => { + const response = await fetch(asset(`tanks/${params.id}/icons/big.png`)); + const blob = await response.blob(); + return new Response(blob, { headers: response.headers }); +}; diff --git a/packages/website/src/pages/api/tanks/[id]/icons/small.png.ts b/packages/website/src/pages/api/tanks/[id]/icons/small.png.ts new file mode 100644 index 000000000..999e62fe3 --- /dev/null +++ b/packages/website/src/pages/api/tanks/[id]/icons/small.png.ts @@ -0,0 +1,16 @@ +import { asset } from '@blitzkit/core'; +import type { APIRoute } from 'astro'; + +export { getStaticPaths } from '../meta.json'; + +/** + * Returns the small icon for a tank, the image that appears in the team list in a battle or the loading screen. Use tanks/list.json for all valid ids. + * + * @param id The tank id. + * @returns PNG. + */ +export const GET: APIRoute<{}, { id: string }> = async ({ params }) => { + const response = await fetch(asset(`tanks/${params.id}/icons/small.png`)); + const blob = await response.blob(); + return new Response(blob, { headers: response.headers }); +}; diff --git a/packages/website/src/pages/api/tanks/[id].json.ts b/packages/website/src/pages/api/tanks/[id]/meta.json.ts similarity index 100% rename from packages/website/src/pages/api/tanks/[id].json.ts rename to packages/website/src/pages/api/tanks/[id]/meta.json.ts diff --git a/packages/website/src/pages/api/tanks/full.json.ts b/packages/website/src/pages/api/tanks/full.json.ts index 988602357..9d3552e2d 100644 --- a/packages/website/src/pages/api/tanks/full.json.ts +++ b/packages/website/src/pages/api/tanks/full.json.ts @@ -4,7 +4,7 @@ import type { APIRoute } from 'astro'; /** * Returns meta data similar to tanks/[id].json but for all tanks as an array. There is no guarantee of order. * - * @warning This is a large response. Consider using tanks/[id].json for individual tanks. + * @warning This is a large response. Consider using tanks/[id]/meta.json for individual tanks. * @returns JSON. */ export const GET: APIRoute = async () => {