app
components
data
functions
api
admin-apps
appeals
auth
data-transfers
events-team
game-appeals
[id]
_middleware.ts
accept.ts
deny.ts
metadata.ts
precheck.ts
submit.ts
game-bans
gme
inactivity
infractions
me
mod-queue
reports
uploads
[[path]].ts
events.ts
webview-captcha.ts
_middleware.ts
common.ts
email.ts
gcloud.ts
permissions.ts
roblox-open-cloud.ts
public
.gitignore
.node-version
.prettierignore
OFL.txt
README.md
emotion-server.js
index.css
index.d.ts
package-lock.json
package.json
remix.config.js
server.ts
theme.ts
tsconfig.json
49 lines
1.3 KiB
TypeScript
49 lines
1.3 KiB
TypeScript
import { insertLogs } from "../../../gcloud.js";
|
|
import { getBanList, setBanList } from "../../../roblox-open-cloud.js";
|
|
import { jsonError } from "../../../common.js";
|
|
|
|
export async function onRequestPost(context: RequestContext) {
|
|
const { statsReduction } = context.data.body;
|
|
|
|
if (statsReduction && typeof statsReduction !== "number")
|
|
return jsonError("Invalid stat reduction", 400);
|
|
|
|
const appeal = await context.env.DATA.get(
|
|
`gameappeal_${context.params.id as string}`,
|
|
);
|
|
|
|
if (!appeal) return jsonError("Appeal not found", 400);
|
|
|
|
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}`);
|
|
await context.env.D1.prepare("DELETE FROM game_appeals WHERE id = ?;")
|
|
.bind(context.params.id)
|
|
.run();
|
|
|
|
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,
|
|
});
|
|
}
|