This commit is contained in:
1 parent
8efd032cc6
commit
df38dccbf1
735 files changed
+128321
-120870
No files matched your search
@@ -3,16 +3,19 @@ import { PERMS } from "@/lib/permissions";
|
||||
import { getPetIconPng } from "@/lib/services/pet-icon";
|
||||
|
||||
// Serves a cropped pet preview PNG extracted from the pet's .nitro spritesheet.
|
||||
export const GET = withAdmin({ permission: PERMS.ASSETS_IMPORT }, async (request) => {
|
||||
const lib = request.nextUrl.searchParams.get("lib") || "";
|
||||
const png = getPetIconPng(lib);
|
||||
if (!png) return new Response(null, { status: 404 });
|
||||
return new Response(new Uint8Array(png), {
|
||||
headers: {
|
||||
"Content-Type": "image/png",
|
||||
// short cache so generator tweaks show up quickly; the in-process icon
|
||||
// cache keeps regeneration cheap. Client bumps a ?v= when output changes.
|
||||
"Cache-Control": "public, max-age=300",
|
||||
},
|
||||
});
|
||||
});
|
||||
export const GET = withAdmin(
|
||||
{ permission: PERMS.ASSETS_IMPORT },
|
||||
async (request) => {
|
||||
const lib = request.nextUrl.searchParams.get("lib") || "";
|
||||
const png = getPetIconPng(lib);
|
||||
if (!png) return new Response(null, { status: 404 });
|
||||
return new Response(new Uint8Array(png), {
|
||||
headers: {
|
||||
"Content-Type": "image/png",
|
||||
// short cache so generator tweaks show up quickly; the in-process icon
|
||||
// cache keeps regeneration cheap. Client bumps a ?v= when output changes.
|
||||
"Cache-Control": "public, max-age=300",
|
||||
},
|
||||
});
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user