diff --git a/functions/api/data-transfers/verify.ts b/functions/api/data-transfers/verify.ts index 509651c..0a5e8af 100644 --- a/functions/api/data-transfers/verify.ts +++ b/functions/api/data-transfers/verify.ts @@ -49,9 +49,7 @@ export async function onRequestGet(context: RequestContext) { let banList; try { - banList = (await getBanList(context)) as { - [k: string]: { BanType: number }; - }; + banList = (await getBanList(context)).value; } catch { return jsonError("Failed to create data transfer request", 500); } diff --git a/functions/api/game-appeals/[id]/accept.ts b/functions/api/game-appeals/[id]/accept.ts index ef4c795..fa40a24 100644 --- a/functions/api/game-appeals/[id]/accept.ts +++ b/functions/api/game-appeals/[id]/accept.ts @@ -15,15 +15,7 @@ export async function onRequestPost(context: RequestContext) { if (!appeal) return jsonError("Appeal not found", 400); - const banList = (await getBanList(context)) as { - [k: string]: { - BanType: number; - hidden_from_leaderboards?: boolean; - serverconfigurator_blacklist?: boolean; - Unbanned?: boolean; - UnbanReduct?: number; - }; - }; + const { etag, path, value: banList } = await getBanList(context); await context.env.D1.prepare("DELETE FROM game_appeals WHERE id = ?;") .bind(context.params.id) @@ -67,7 +59,7 @@ export async function onRequestPost(context: RequestContext) { ) .run(); - await setBanList(context, banList); + await setBanList(context, banList, etag); return new Response(null, { status: 204, diff --git a/functions/api/game-appeals/precheck.ts b/functions/api/game-appeals/precheck.ts index 661cd05..4d01d62 100644 --- a/functions/api/game-appeals/precheck.ts +++ b/functions/api/game-appeals/precheck.ts @@ -24,13 +24,7 @@ export default async function ( let banList; try { - banList = (await getBanList(context)) as { - [k: number]: { - BanType: number; - hidden_from_leaderboards?: boolean; - serverconfigurator_blacklist?: boolean; - }; - }; + banList = (await getBanList(context)).value; } catch { return { error: "Failed to check your ban status", diff --git a/functions/api/game-bans/[user]/history.ts b/functions/api/game-bans/[user]/history.ts index 64553dd..0cf1b90 100644 --- a/functions/api/game-bans/[user]/history.ts +++ b/functions/api/game-bans/[user]/history.ts @@ -33,13 +33,7 @@ export async function onRequestGet(context: RequestContext) { let banList; try { - banList = (await getBanList(context)) as { - [k: number]: { - BanType: number; - hidden_from_leaderboards?: boolean; - serverconfigurator_blacklist?: boolean; - }; - }; + banList = (await getBanList(context)).value; } catch (e) { console.log(e); diff --git a/functions/api/game-bans/[user]/revoke.ts b/functions/api/game-bans/[user]/revoke.ts index b0e9f5e..d13cece 100644 --- a/functions/api/game-bans/[user]/revoke.ts +++ b/functions/api/game-bans/[user]/revoke.ts @@ -31,12 +31,10 @@ export async function onRequestPost(context: RequestContext) { ) .run(); - const banList = (await getBanList(context)) as { - [k: string]: { BanType: number }; - }; + const { etag, path, value: banList } = await getBanList(context); delete banList[user]; - await setBanList(context, banList); + await setBanList(context, banList, etag); return new Response(null, { status: 204, diff --git a/functions/api/reports/[id]/action.ts b/functions/api/reports/[id]/action.ts index e40a776..9c7173e 100644 --- a/functions/api/reports/[id]/action.ts +++ b/functions/api/reports/[id]/action.ts @@ -78,15 +78,9 @@ export async function onRequestPost(context: RequestContext) { await context.env.D1.batch(batchedQueries); - const banList = (await getBanList(context)) as { - [k: string]: { - BanType: number; - hidden_from_leaderboards?: boolean; - serverconfigurator_blacklist?: boolean; - }; - }; + const { etag, path, value: banList } = await getBanList(context); - await setBanList(context, Object.assign(banList, newActions)); + await setBanList(context, Object.assign(banList, newActions), etag); } const pushNotificationData: Record | null = diff --git a/functions/roblox-open-cloud.ts b/functions/roblox-open-cloud.ts index 51104a3..fa7be6c 100644 --- a/functions/roblox-open-cloud.ts +++ b/functions/roblox-open-cloud.ts @@ -1,8 +1,8 @@ const DATASTORE_URL = - "https://apis.roblox.com/datastores/v1/universes/274816972/standard-datastores/datastore/entries/entry?datastoreName=BanData&entryKey=CloudBanList"; + "https://apis.roblox.com/cloud/v2/universes/274816972/data-stores/BanData/entries/CloudBanList"; const SAVE_DATA_URL = - "https://apis.roblox.com/datastores/v1/universes/274816972/standard-datastores/datastore/entries/entry?datastoreName=RealData&entryKey="; + "https://apis.roblox.com/cloud/v2/universes/274816972/data-stores/RealData/entries"; export async function getBanList(context: RequestContext) { const data = await fetch(DATASTORE_URL, { @@ -16,14 +16,26 @@ export async function getBanList(context: RequestContext) { throw new Error("Failed to retrieve ban list"); } - return await data.json(); + return (await data.json()) as { + etag: string; + path: string; + value: { + [k: string]: { + BanType: number; + hidden_from_leaderboards?: boolean; + serverconfigurator_blacklist?: boolean; + Unbanned?: boolean; + UnbanReduct?: number; + }; + }; + }; } export async function getSaveData( context: RequestContext, user: number, ): Promise { - const data = await fetch(`${SAVE_DATA_URL}${user}`, { + const data = await fetch(`${SAVE_DATA_URL}/${user}`, { headers: { "x-api-key": context.env.ROBLOX_OPENCLOUD_KEY, }, @@ -34,20 +46,21 @@ export async function getSaveData( throw new Error(`Failed to retrieve save data for ${user}`); } - return await data.json(); + return ((await data.json()) as { value: string }).value; } export async function setBanList( context: RequestContext, - data: { [k: string]: { [k: string]: any } }, + value: any, + etag?: string, ) { const setRequest = await fetch(DATASTORE_URL, { - body: JSON.stringify(data), + body: JSON.stringify(etag, value), headers: { "content-type": "application/json", "x-api-key": context.env.ROBLOX_OPENCLOUD_KEY, }, - method: "POST", + method: "PATCH", }); if (!setRequest.ok) { diff --git a/package.json b/package.json index 3a131f9..a680f9f 100644 --- a/package.json +++ b/package.json @@ -17,11 +17,11 @@ "@remix-run/cloudflare": "^2.17.4", "@remix-run/cloudflare-pages": "^2.17.4", "@remix-run/react": "^2.17.4", - "@sentry/cloudflare": "^10.43.0", - "@sentry/remix": "^10.43.0", + "@sentry/cloudflare": "^10.46.0", + "@sentry/remix": "^10.46.0", "aws4fetch": "^1.0.20", - "dayjs": "^1.11.19", - "framer-motion": "^12.35.2", + "dayjs": "^1.11.20", + "framer-motion": "^12.38.0", "react": "^18.3.1", "react-big-calendar": "^1.19.4", "react-dom": "^18.3.1" @@ -34,10 +34,10 @@ "@types/react-dom": "^18.3.7", "dotenv": "^17.3.1", "prettier": "^3.8.1", - "typescript": "^5.9.3" + "typescript": "^6.0.2" }, "overrides": { - "@cloudflare/workers-types": "^4.20260310.1" + "@cloudflare/workers-types": "^4.20260329.1" }, "prettier": { "endOfLine": "auto"