app
components
data
functions
api
admin-apps
appeals
auth
data-transfers
events-team
game-appeals
game-bans
[user]
history.ts
revoke.ts
_middleware.ts
gme
inactivity
infractions
mod-queue
reports
uploads
_middleware.ts
common.ts
email.ts
gcloud.ts
permissions.ts
roblox-open-cloud.ts
public
.gitignore
.node-version
.prettierignore
OFL.txt
emotion-server.js
index.css
index.d.ts
package-lock.json
package.json
remix.config.js
server.ts
theme.ts
tsconfig.json
35 lines
938 B
TypeScript
35 lines
938 B
TypeScript
import { getBanList, setBanList } from "../../../roblox-open-cloud.js";
|
|
import { insertLogs } from "../../../gcloud.js";
|
|
import { jsonError } from "../../../common.js";
|
|
|
|
export async function onRequestPost(context: RequestContext) {
|
|
if (!(context.data.current_user.permissions & (1 << 5)))
|
|
return jsonError("Forbidden", 403);
|
|
|
|
const { ticket_link } = context.data.body;
|
|
|
|
if (
|
|
!ticket_link?.match(
|
|
/^https?:\/\/carcrushers\.modmail\.dev\/logs\/[a-z\d]{12}$/,
|
|
)
|
|
)
|
|
return jsonError("Invalid ticket link provided", 400);
|
|
|
|
const user = context.params.user as string;
|
|
|
|
if (isNaN(parseInt(user))) return jsonError("Invalid user ID", 400);
|
|
|
|
await insertLogs({ [user]: 3 }, ticket_link, context);
|
|
|
|
const banList = (await getBanList(context)) as {
|
|
[k: string]: { BanType: number };
|
|
};
|
|
|
|
delete banList[user];
|
|
await setBanList(context, banList);
|
|
|
|
return new Response(null, {
|
|
status: 204,
|
|
});
|
|
}
|