diff --git a/src/index.ts b/src/index.ts index 436cf13..91bed05 100644 --- a/src/index.ts +++ b/src/index.ts @@ -465,6 +465,13 @@ app.get( t.String( 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'] + }) ) }) } diff --git a/src/routes/berrydash/icon-marketplace/icon/get.ts b/src/routes/berrydash/icon-marketplace/icon/get.ts index e565a3f..40b8249 100644 --- a/src/routes/berrydash/icon-marketplace/icon/get.ts +++ b/src/routes/berrydash/icon-marketplace/icon/get.ts @@ -16,6 +16,7 @@ export async function handler (context: Context) { const { connection: connection0, db: db0 } = dbInfo0 const { connection: connection1, db: db1 } = dbInfo1 + let dataQuery = context.query.data let uuidQuery = context.query.uuid let idQuery = context.query.id ? parseInt(context.query.id, 10) : 0 let uuidsQuery = context.query.uuids @@ -103,7 +104,8 @@ export async function handler (context: Context) { const result = { username: userData[0].username, userId: icon[0].userId, - data: icon[0].data, + data: + dataQuery && dataQuery.toLowerCase() == 'false' ? null : icon[0].data, hash: icon[0].hash, id: icon[0].id, price: icon[0].price, @@ -144,7 +146,7 @@ export async function handler (context: Context) { const result = icons.map(i => ({ username: usersMap[i.userId] ?? 'Unknown', userId: i.userId, - data: i.data, + data: dataQuery && dataQuery.toLowerCase() == 'false' ? null : i.data, id: i.id, price: i.price, buyable: i.state == 1,