diff --git a/packages/website/src/pages/api/gallery/[avatar].webp.ts b/packages/website/src/pages/api/gallery/[avatar].webp.ts deleted file mode 100644 index ced97f132..000000000 --- a/packages/website/src/pages/api/gallery/[avatar].webp.ts +++ /dev/null @@ -1,31 +0,0 @@ -import { imgur } from '@blitzkit/core'; -import { DEFAULT_LOCALE } from '@blitzkit/i18n'; -import type { APIRoute, GetStaticPaths } from 'astro'; -import { fetchGlossary } from '../../../core/blitz/fetchGlossary'; -import { blobMirror } from '../../../core/blitzkit/blobMirror'; - -export const getStaticPaths = (async () => { - const glossary = await fetchGlossary(DEFAULT_LOCALE); - const avatarKeys = Object.keys(glossary) - .filter((key) => key.startsWith('avatar_')) - .map((key) => key.replace('avatar_', '')); - - return avatarKeys.map((avatar) => ({ params: { avatar } })); -}) satisfies GetStaticPaths; - -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 lousy Wargaming CDN. - * @param avatar The avatar id. - * @returns WEBP. - */ -export const GET: APIRoute<{}, { avatar: string }> = async ({ params }) => { - return await blobMirror( - glossary[`avatar_${params.avatar}`].image_url ?? - imgur('uXBiK05', { format: 'jpeg' }), - ); -}; diff --git a/packages/website/src/pages/api/gallery/list.json.ts b/packages/website/src/pages/api/gallery/list.json.ts deleted file mode 100644 index e69de29bb..000000000 diff --git a/packages/website/src/pages/api/locales.json.ts b/packages/website/src/pages/api/locales.json.ts new file mode 100644 index 000000000..71b5ee99e --- /dev/null +++ b/packages/website/src/pages/api/locales.json.ts @@ -0,0 +1,13 @@ +import locales from '@blitzkit/i18n/locales.json'; +import type { APIRoute } from 'astro'; + +/** + * Returns a list of all locales (languages) supported by BlitzKit along with + * the default language (English) and the locale codes for Blitz if they differ + * from what BlitzKit uses internally. + * + * @returns JSON. + */ +export const GET: APIRoute = async () => { + return Response.json(locales); +};