Make it so you can use the icon marketplace while not logged in

This commit is contained in:
2026-01-22 23:30:45 -07:00
parent 7af99579c0
commit 7ca31676ba

View File

@@ -53,15 +53,10 @@ export async function handler (context: Context) {
db0, db0,
ip ip
) )
if (!authResult.valid) { let userId: number | null = null
connection0.end() if (authResult.valid) {
connection1.end() userId = authResult.id
return jsonResponse(
{ success: false, message: 'Unauthorized', data: null },
401
)
} }
const userId = authResult.id
const body: { [key: string]: any } = context.body as any const body: { [key: string]: any } = context.body as any
@@ -109,9 +104,9 @@ export async function handler (context: Context) {
} }
if (body3.onlyShowEnabled) { if (body3.onlyShowEnabled) {
if (body3.onlyShowValue === 0) { if (body3.onlyShowValue === 0 && userId) {
filters.push(eq(berryDashMarketplaceIcons.userId, userId)) filters.push(eq(berryDashMarketplaceIcons.userId, userId))
} else if (body3.onlyShowValue === 1) { } else if (body3.onlyShowValue === 1 && userId) {
filters.push(sql`${berryDashMarketplaceIcons.userId} != ${userId}`) filters.push(sql`${berryDashMarketplaceIcons.userId} != ${userId}`)
} else if (body3.onlyShowValue === 2) { } else if (body3.onlyShowValue === 2) {
filters.push(inArray(berryDashMarketplaceIcons.uuid, body3.currentIcons)) filters.push(inArray(berryDashMarketplaceIcons.uuid, body3.currentIcons))