Make it so you can use ?raw=true on /api/berrydash/icon-marketplace/icon for it to act as a .png file
This commit is contained in:
@@ -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({
|
||||
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user