Inconsistency fixes

This commit is contained in:
2026-01-24 14:05:18 -07:00
parent a759758bad
commit e8826f5cf2
2 changed files with 50 additions and 4 deletions

View File

@@ -98,8 +98,24 @@ export async function handler (context: Context) {
username: userData[0].username, username: userData[0].username,
userId: icon[0].userId, userId: icon[0].userId,
data: data:
dataQuery && dataQuery.toLowerCase() == 'false' ? null : icon[0].data, dataQuery && dataQuery.toLowerCase() == 'false'
hash: icon[0].hash, ? null
: dataQuery && dataQuery.toLowerCase() == 'false'
? null
: (() => {
const q = Math.floor(icon[0].data.length / 4)
const hq = Math.floor(icon[0].hash.length / 4)
return (
icon[0].data.slice(0, q) +
icon[0].hash.slice(0, hq) +
icon[0].data.slice(q, q * 2) +
icon[0].hash.slice(hq, hq * 2) +
icon[0].data.slice(q * 2, q * 3) +
icon[0].hash.slice(hq * 2, hq * 3) +
icon[0].data.slice(q * 3) +
icon[0].hash.slice(hq * 3)
)
})(),
id: icon[0].id, id: icon[0].id,
price: icon[0].price, price: icon[0].price,
buyable: icon[0].state == 1, buyable: icon[0].state == 1,
@@ -129,7 +145,23 @@ 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: dataQuery && dataQuery.toLowerCase() == 'false' ? null : i.data, data:
dataQuery && dataQuery.toLowerCase() == 'false'
? null
: (() => {
const q = Math.floor(i.data.length / 4)
const hq = Math.floor(i.hash.length / 4)
return (
i.data.slice(0, q) +
i.hash.slice(0, hq) +
i.data.slice(q, q * 2) +
i.hash.slice(hq, hq * 2) +
i.data.slice(q * 2, q * 3) +
i.hash.slice(hq * 2, hq * 3) +
i.data.slice(q * 3) +
i.hash.slice(hq * 3)
)
})(),
id: i.id, id: i.id,
price: i.price, price: i.price,
buyable: i.state == 1, buyable: i.state == 1,

View File

@@ -137,6 +137,7 @@ export async function handler (context: Context) {
.select({ .select({
id: berryDashMarketplaceIcons.id, id: berryDashMarketplaceIcons.id,
userId: berryDashMarketplaceIcons.userId, userId: berryDashMarketplaceIcons.userId,
data: berryDashMarketplaceIcons.data,
hash: berryDashMarketplaceIcons.hash, hash: berryDashMarketplaceIcons.hash,
timestamp: berryDashMarketplaceIcons.timestamp, timestamp: berryDashMarketplaceIcons.timestamp,
state: berryDashMarketplaceIcons.state, state: berryDashMarketplaceIcons.state,
@@ -160,7 +161,20 @@ 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,
hash: i.hash, data: (() => {
const q = Math.floor(i.data.length / 4)
const hq = Math.floor(i.hash.length / 4)
return (
i.data.slice(0, q) +
i.hash.slice(0, hq) +
i.data.slice(q, q * 2) +
i.hash.slice(hq, hq * 2) +
i.data.slice(q * 2, q * 3) +
i.hash.slice(hq * 2, hq * 3) +
i.data.slice(q * 3) +
i.hash.slice(hq * 3)
)
})(),
id: i.id, id: i.id,
price: i.price, price: i.price,
buyable: i.state == 1, buyable: i.state == 1,