feat: meta section

This commit is contained in:
TrèsAbhi committed 2025-12-26 14:14:29 -06:00
1 parent 1d3cb95b89
commit 40a1eb861d
14 files changed
+141 -18

No files matched your search

@@ -0,0 +1,27 @@
import { Nation } from "@protos/blitz_static_tank_component";
import type { APIContext, GetStaticPaths } from "astro";
const enums = {
nation: Nation,
};
export const getStaticPaths = (() => {
return Object.keys(enums).map((name) => ({ params: { enum: name } }));
}) satisfies GetStaticPaths;
/**
* The one who wipes, swipes.
*/
export function GET({
params,
}: APIContext<never, { enum: keyof typeof enums }>) {
const map: Record<number, string> = {};
for (const key in enums[params.enum]) {
const value = enums[params.enum][key];
if (typeof value !== "string") continue;
map[key] = value;
}
return Response.json(map);
}
@@ -1,6 +1,6 @@
import { TankCatalogComponent } from "@protos/blitz_static_tank_component";
import type { APIContext, GetStaticPaths } from "astro";
import { api } from "../../../core/api/dynamic";
import { Tank } from "../../../protos/tank";
export const getStaticPaths = (async () => {
const { tanks } = await api.tanks();
@@ -13,5 +13,5 @@ export const getStaticPaths = (async () => {
*/
export async function GET({ params }: APIContext<never, { id: string }>) {
const tank = await api.tank(params.id);
return new Response(TankCatalogComponent.encode(tank).finish());
return new Response(Tank.encode(tank).finish());
}