Save on bandwidth if the user wants to hide icon data
This commit is contained in:
@@ -465,6 +465,13 @@ app.get(
|
|||||||
t.String(
|
t.String(
|
||||||
t.String({ description: 'The IDs for the icons you want to get' })
|
t.String({ description: 'The IDs for the icons you want to get' })
|
||||||
)
|
)
|
||||||
|
),
|
||||||
|
data: t.Optional(
|
||||||
|
t.String({
|
||||||
|
description:
|
||||||
|
'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']
|
||||||
|
})
|
||||||
)
|
)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ export async function handler (context: Context) {
|
|||||||
const { connection: connection0, db: db0 } = dbInfo0
|
const { connection: connection0, db: db0 } = dbInfo0
|
||||||
const { connection: connection1, db: db1 } = dbInfo1
|
const { connection: connection1, db: db1 } = dbInfo1
|
||||||
|
|
||||||
|
let dataQuery = context.query.data
|
||||||
let uuidQuery = context.query.uuid
|
let uuidQuery = context.query.uuid
|
||||||
let idQuery = context.query.id ? parseInt(context.query.id, 10) : 0
|
let idQuery = context.query.id ? parseInt(context.query.id, 10) : 0
|
||||||
let uuidsQuery = context.query.uuids
|
let uuidsQuery = context.query.uuids
|
||||||
@@ -103,7 +104,8 @@ export async function handler (context: Context) {
|
|||||||
const result = {
|
const result = {
|
||||||
username: userData[0].username,
|
username: userData[0].username,
|
||||||
userId: icon[0].userId,
|
userId: icon[0].userId,
|
||||||
data: icon[0].data,
|
data:
|
||||||
|
dataQuery && dataQuery.toLowerCase() == 'false' ? null : icon[0].data,
|
||||||
hash: icon[0].hash,
|
hash: icon[0].hash,
|
||||||
id: icon[0].id,
|
id: icon[0].id,
|
||||||
price: icon[0].price,
|
price: icon[0].price,
|
||||||
@@ -144,7 +146,7 @@ export async function handler (context: Context) {
|
|||||||
const result = icons.map(i => ({
|
const result = icons.map(i => ({
|
||||||
username: usersMap[i.userId] ?? 'Unknown',
|
username: usersMap[i.userId] ?? 'Unknown',
|
||||||
userId: i.userId,
|
userId: i.userId,
|
||||||
data: i.data,
|
data: dataQuery && dataQuery.toLowerCase() == 'false' ? null : i.data,
|
||||||
id: i.id,
|
id: i.id,
|
||||||
price: i.price,
|
price: i.price,
|
||||||
buyable: i.state == 1,
|
buyable: i.state == 1,
|
||||||
|
|||||||
Reference in New Issue
Block a user