mirror of
https://github.com/blitzkit/blitzkit.git
synced 2026-10-25 11:39:51 +01:00
fix: i just realized the gallery is going bye bye
This commit is contained in:
1 parent
c9467d68ae
commit
222fda0c91
3 files changed
+13
-31
No files matched your search
@@ -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' }),
|
|
||||||
);
|
|
||||||
};
|
|
||||||
Whitespace-only changes.
@@ -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);
|
||||||
|
};
|
||||||
Reference in new issue
Block a user