app
components
data
functions
api
admin-apps
appeals
auth
data-transfers
events-team
game-appeals
game-bans
gme
_middleware.ts
add.ts
list.ts
remove.ts
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
33 lines
826 B
TypeScript
33 lines
826 B
TypeScript
import { jsonError } from "../../common.js";
|
|
|
|
export async function onRequestPost(context: RequestContext) {
|
|
const { user } = context.data.body;
|
|
|
|
if (!user) return jsonError("No user provided", 400);
|
|
|
|
const existingUser = await context.env.DATA.get(`gamemod_${user}`);
|
|
|
|
if (existingUser) return jsonError("Cannot add an existing user", 400);
|
|
|
|
if (
|
|
["165594923586945025", "289372404541554689", "396347223736057866"].includes(
|
|
user,
|
|
)
|
|
)
|
|
return new Response(null, {
|
|
status: 204,
|
|
});
|
|
|
|
if (!user.match(/^\d{17,19}$/)) return jsonError("Invalid User ID", 400);
|
|
|
|
const data = { time: Date.now(), user: context.data.current_user.id };
|
|
|
|
await context.env.DATA.put(`gamemod_${user}`, JSON.stringify(data), {
|
|
metadata: data,
|
|
});
|
|
|
|
return new Response(null, {
|
|
status: 204,
|
|
});
|
|
}
|