diff --git a/cspell.json b/cspell.json index 4ec147b19..a67dd4960 100644 --- a/cspell.json +++ b/cspell.json @@ -1,5 +1,6 @@ { "words": [ + "gamemodes", "Tankopedia" ] -} \ No newline at end of file +} diff --git a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equalizer.tsx b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equalizer.tsx index 6940f664b..9b9714ac8 100644 --- a/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equalizer.tsx +++ b/packages/website/src/components/Tankopedia/CharacteristicsSection/components/Equalizer.tsx @@ -33,7 +33,7 @@ export function Equalizer() { style={{ cursor: "pointer", borderRadius: "var(--radius-3)", - backgroundImage: "url(/api/icons/game_mode_banners/45.webp)", + backgroundImage: "url(/api/gamemodes/45/banner.webp)", backgroundSize: "cover", backgroundPosition: "center", overflow: "hidden", diff --git a/packages/website/src/components/Tankopedia/GameModeSection.tsx b/packages/website/src/components/Tankopedia/GameModeSection.tsx index 3aadfb03e..86ae4629c 100644 --- a/packages/website/src/components/Tankopedia/GameModeSection.tsx +++ b/packages/website/src/components/Tankopedia/GameModeSection.tsx @@ -37,7 +37,7 @@ export function GameModeSection() { direction="column" style={{ borderRadius: "var(--radius-3)", - background: `url(/api/icons/game_mode_banners/${id}.webp)`, + background: `url(/api/gamemodes/${id}/banner.webp)`, backgroundSize: "cover", backgroundPosition: "center", }} @@ -45,7 +45,7 @@ export function GameModeSection() { { + const paths: GetStaticPathsItem[] = []; - using uploader = new AssetUploader("game mode banners"); const gameTypeSelectorStyles = await vfs.yaml( `Data/UI/Screens/Lobby/Hangar/GameTypeSelector.yaml`, ); @@ -34,15 +35,20 @@ export async function gameModeBanners() { path = `/Gfx/UI/Hangar/GameTypes/battle-type_${name.toLowerCase()}`; } - const content = await sharp(await vfs.file(`Data${path}.packed.webp`)) - .trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } }) - .toBuffer(); - - await uploader.add({ - path: `icons/game_mode_banners/${id}.webp`, - content, + paths.push({ + params: { id }, + props: { path: `Data${path}.packed.webp` }, }); } - await uploader.flush(); + return paths; +}); + +export async function GET({ props }: APIContext<{ path: string }>) { + const buffer = await sharp(await vfs.file(props.path)) + .trim({ background: { r: 0, g: 0, b: 0, alpha: 0 } }) + .toBuffer(); + const bytes = new Uint8Array(buffer); + + return new Response(bytes); }