Skip to content
Permalink
056c6b84f3
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
55 lines (45 sloc) 1.34 KB
import { insertLogs } from "../../../gcloud.js";
import { getBanList, setBanList } from "../../../roblox-open-cloud.js";
export async function onRequestPost(context: RequestContext) {
const { statsReduction } = context.data.body;
if (statsReduction && typeof statsReduction !== "number")
return new Response('{"error":"Invalid stat reduction"}', {
headers: {
"content-type": "application/json",
},
status: 400,
});
const appeal = await context.env.DATA.get(
`gameappeal_${context.params.id as string}`,
);
if (!appeal)
return new Response('{"error":"Appeal not found"}', {
headers: {
"content-type": "application/json",
},
status: 404,
});
const data = JSON.parse(appeal);
const banList = (await getBanList(context)) as {
[k: string]: { BanType: number; Unbanned?: boolean; UnbanReduct?: number };
};
await context.env.DATA.delete(`gameappeal_${context.params.id as string}`);
if (!banList[data.roblox_id])
return new Response(null, {
status: 204,
});
banList[data.roblox_id] = {
BanType: 0,
Unbanned: true,
UnbanReduct: statsReduction,
};
await insertLogs(
{ [data.roblox_id]: 4 },
context.params.id as string,
context,
);
await setBanList(context, banList);
return new Response(null, {
status: 204,
});
}