From c1341311274486e7d42e0f3babfa75e27f5c07f9 Mon Sep 17 00:00:00 2001 From: tresabhi <43380238+tresabhi@users.noreply.github.com> Date: Fri, 5 Jun 2026 11:36:47 -0500 Subject: [PATCH] use relative paths for api backgrounds --- packages/website-ue/src/api/server.ts | 5 ++--- .../website-ue/src/pages/[api]/backgrounds/[id].json.ts | 5 +---- .../website-ue/src/pages/[media]/backgrounds/[id].webp.ts | 7 ++++++- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/website-ue/src/api/server.ts b/packages/website-ue/src/api/server.ts index 5ad295b40..8c74032aa 100644 --- a/packages/website-ue/src/api/server.ts +++ b/packages/website-ue/src/api/server.ts @@ -406,7 +406,7 @@ export class ServerAPI extends AbstractAPI { @Cache() async avatarList() { const avatars = await this.avatars(); - const list = avatars.avatars.map((avatar) => avatar.name); + const list = avatars.avatars.map((avatar) => avatar.id); return { list }; } @@ -414,14 +414,13 @@ export class ServerAPI extends AbstractAPI { @Cache() async background(id: string) { const background = this.metadata.item(id); - const name = background.name; const stuff_ui = background.StuffUI("UIComponent"); const profile_background = background.ProfileBackground(); const sellable = background.components.sellableComponent ? background.Sellable() : undefined; - return { name, stuff_ui, profile_background, sellable }; + return { id, stuff_ui, profile_background, sellable }; } @Cache() diff --git a/packages/website-ue/src/pages/[api]/backgrounds/[id].json.ts b/packages/website-ue/src/pages/[api]/backgrounds/[id].json.ts index 44a5cdc11..6f1f9f339 100644 --- a/packages/website-ue/src/pages/[api]/backgrounds/[id].json.ts +++ b/packages/website-ue/src/pages/[api]/backgrounds/[id].json.ts @@ -5,10 +5,7 @@ import { getStaticPaths as _getStaticPaths } from "../_index"; export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => { const { backgrounds } = await api.backgrounds(); - - return backgrounds.map((background) => ({ - params: { id: background.name }, - })); + return backgrounds.map(({ id }) => ({ params: { id } })); }); export async function GET({ params }: APIContext) { diff --git a/packages/website-ue/src/pages/[media]/backgrounds/[id].webp.ts b/packages/website-ue/src/pages/[media]/backgrounds/[id].webp.ts index de2690fb4..ed0ba30b4 100644 --- a/packages/website-ue/src/pages/[media]/backgrounds/[id].webp.ts +++ b/packages/website-ue/src/pages/[media]/backgrounds/[id].webp.ts @@ -1,8 +1,13 @@ import type { APIContext } from "astro"; import { api } from "../../../api/dynamic"; import { imageProxy } from "../../../api/imageProxy"; +import { getStaticPaths as _getStaticPaths } from "../_index"; +import { mixStaticPaths } from "../../../astro/mixStaticPaths"; -export { getStaticPaths } from "../../[api]/backgrounds/[id].json"; +export const getStaticPaths = mixStaticPaths(_getStaticPaths, async () => { + const { backgrounds } = await api.backgrounds(); + return backgrounds.map(({ id }) => ({ params: { id } })); +}); export async function GET({ params }: APIContext) { const background = await api.background(params.id);