app
components
data
functions
api
admin-apps
appeals
auth
data-transfers
events-team
game-appeals
game-bans
gme
inactivity
infractions
mod-queue
reports
[id]
action.ts
complete.ts
recall.ts
submit.ts
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
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import { insertLogs } from "../../../gcloud.js";
|
|
import { getBanList, setBanList } from "../../../roblox-open-cloud.js";
|
|
|
|
export async function onRequestPost(context: RequestContext) {
|
|
const actionMap = context.data.body;
|
|
const newActions: { [k: string]: { BanType: number } } = {};
|
|
const logMap: { [k: string]: number } = {};
|
|
|
|
for (const [user, action] of Object.entries(actionMap)) {
|
|
if (
|
|
isNaN(parseInt(user)) ||
|
|
typeof action !== "number" ||
|
|
action < 0 ||
|
|
action > 2
|
|
)
|
|
return new Response('{"error":"Invalid action map"}', {
|
|
headers: {
|
|
"content-type": "application/json",
|
|
},
|
|
});
|
|
|
|
if (action === 0) continue;
|
|
|
|
Object.defineProperty(newActions, user, {
|
|
value: {
|
|
BanType: action,
|
|
},
|
|
});
|
|
|
|
Object.defineProperty(logMap, user, {
|
|
value: action,
|
|
});
|
|
}
|
|
|
|
await insertLogs(logMap, context.params.id as string, context);
|
|
|
|
const banList = (await getBanList(context)) as {
|
|
[k: string]: { BanType: number };
|
|
};
|
|
|
|
Object.assign(banList, newActions);
|
|
await setBanList(context, banList);
|
|
|
|
return new Response(null, {
|
|
status: 204,
|
|
});
|
|
}
|