app
components
data
functions
api
admin-apps
appeals
[id]
_middleware.ts
submit.ts
toggle.ts
auth
game-appeals
game-bans
gme
inactivity
infractions
mod-queue
reports
uploads
_middleware.ts
gcloud.ts
permissions.ts
roblox-open-cloud.ts
public
.gitignore
.node-version
OFL.txt
emotion-server.js
index.css
index.d.ts
package-lock.json
package.json
remix.config.js
server.ts
theme.ts
tsconfig.json
31 lines
774 B
TypeScript
31 lines
774 B
TypeScript
export async function onRequestPost(context: RequestContext) {
|
|
const { active } = context.data.body;
|
|
const { permissions } = context.data.current_user;
|
|
|
|
if (!(permissions & (1 << 0)) && !(permissions & (1 << 11)))
|
|
return new Response('{"error":"Forbidden"}', {
|
|
headers: {
|
|
"content-type": "application/json",
|
|
},
|
|
status: 403,
|
|
});
|
|
|
|
if (typeof active !== "boolean")
|
|
return new Response('{"error":"Active property must be a boolean"}', {
|
|
headers: {
|
|
"content-type": "application/json",
|
|
},
|
|
status: 400,
|
|
});
|
|
|
|
if (active) {
|
|
await context.env.DATA.delete("appeal_disabled");
|
|
} else {
|
|
await context.env.DATA.put("appeal_disabled", "1");
|
|
}
|
|
|
|
return new Response(null, {
|
|
status: 204,
|
|
});
|
|
}
|