Move to V2 datastore apis

This commit is contained in:
2026-03-31 03:24:13 -04:00
parent b69b5cb4eb
commit e3af1e4f37
8 changed files with 36 additions and 53 deletions

View File

@@ -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);
}

View File

@@ -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,

View File

@@ -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",

View File

@@ -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);

View File

@@ -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,

View File

@@ -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<string, string> | null =