faded flags

This commit is contained in:
tresabhi committed 2026-08-04 20:23:50 -05:00
1 parent 9e4d9c7968
commit 85883cd2c5
2 files changed
+36 -5

No files matched your search

@@ -0,0 +1,35 @@
import type { APIContext, GetStaticPathsItem } from "astro";
import { mixStaticPaths } from "../../../../core/blitzkit/mixStaticPaths";
import { vfs } from "../../../../core/blitzkit/vfs";
import { getStaticPaths as _getStaticPaths } from "../../_index";
export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
const paths: GetStaticPathsItem[] = [];
const fadedFiles = await vfs
.dir(`Data/Gfx/Lobby/flags`)
.then((files) =>
files.filter(
(flag) =>
flag.startsWith("flag_filter_") && flag.endsWith("@2x.packed.webp"),
),
);
for (const flag of fadedFiles) {
const path = `Data/Gfx/Lobby/flags/${flag}`;
const id = flag.match(/flag_filter_(.+)@2x\.packed\.webp/)![1];
paths.push({
params: { id },
props: { path },
});
}
return paths;
});
export async function GET({ props }: APIContext<{ path: string }>) {
const bytes = new Uint8Array(await vfs.file(props.path));
return new Response(bytes);
}
@@ -32,9 +32,5 @@ export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => {
export async function GET({ props }: APIContext<{ path: string }>) {
const bytes = new Uint8Array(await vfs.file(props.path));
return new Response(bytes, {
headers: {
"Content-Type": "image/webp",
},
});
return new Response(bytes);
}