From 14b6522af8d3594a7d5c8fb910914129fa65c838 Mon Sep 17 00:00:00 2001 From: Lncvrt Date: Mon, 2 Feb 2026 18:50:17 -0700 Subject: [PATCH] Make it so you can use ?raw=true on `/api/berrydash/icon-marketplace/icon` for it to act as a .png file --- src/index.ts | 6 ++++++ src/routes/berrydash/icon-marketplace/icon/get.ts | 7 +++++++ 2 files changed, 13 insertions(+) diff --git a/src/index.ts b/src/index.ts index 4e9ec65..add7cee 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1151,6 +1151,12 @@ app.get( 'If set to false, this will not include icon data, otherwise it will. Setting it to true would have the same result as not having it at all.', examples: ['true', 'false'] }) + ), + raw: t.Optional( + t.String({ + description: + 'If you want to get a single icon (only works with `id`, not `ids`) then use this. It will act as if you went to a actual .png file. If provided, any value will mean it will act as a .png file' + }) ) }), headers: t.Object({ diff --git a/src/routes/berrydash/icon-marketplace/icon/get.ts b/src/routes/berrydash/icon-marketplace/icon/get.ts index 2a4c2b5..da529e4 100644 --- a/src/routes/berrydash/icon-marketplace/icon/get.ts +++ b/src/routes/berrydash/icon-marketplace/icon/get.ts @@ -74,6 +74,13 @@ export async function handler (context: Context) { ) } + if (context.query.raw) { + const buffer = Buffer.from(icon[0].data, 'base64') + return new Response(buffer, { + headers: { 'Content-Type': 'image/png' } + }) + } + const userData = await db0 .select({ username: users.username }) .from(users)