New auth header since authorization is now used for jwts
This commit is contained in:
parent
9212e3e454
commit
45febd0585
@ -3,8 +3,8 @@ import precheck from "./precheck.js";
|
||||
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
if (
|
||||
context.request.headers.get("authorization") !==
|
||||
`Bearer ${context.env.ROBLOX_APPEALS_TOKEN}`
|
||||
context.request.headers.get("rbx-auth") !==
|
||||
context.env.ROBLOX_APPEALS_TOKEN
|
||||
)
|
||||
return jsonError("Unauthorized", 401);
|
||||
|
||||
|
@ -2,9 +2,9 @@ import { jsonError } from "../../common.js";
|
||||
import precheck from "./precheck.js";
|
||||
|
||||
export async function onRequestPost(context: RequestContext) {
|
||||
const authHeader = context.request.headers.get("authorization");
|
||||
const authHeader = context.request.headers.get("rbx-auth");
|
||||
|
||||
if (authHeader !== `Bearer ${context.env.ROBLOX_APPEALS_TOKEN}`)
|
||||
if (authHeader !== context.env.ROBLOX_APPEALS_TOKEN)
|
||||
return jsonError("Unauthorized", 401);
|
||||
|
||||
const { id, reasonForUnban, username, whatHappened } = context.data.body;
|
||||
@ -23,13 +23,13 @@ export async function onRequestPost(context: RequestContext) {
|
||||
if (reasonForUnban.length > 5000 || whatHappened.length > 5000)
|
||||
return jsonError(
|
||||
"The maximum length of each text field is 5000 characters",
|
||||
400,
|
||||
400
|
||||
);
|
||||
|
||||
if (reasonForUnban.length < 100)
|
||||
return jsonError(
|
||||
"Your explanation of why you should be unbanned must be longer",
|
||||
400,
|
||||
400
|
||||
);
|
||||
|
||||
if (whatHappened.length < 50)
|
||||
@ -54,12 +54,12 @@ export async function onRequestPost(context: RequestContext) {
|
||||
reasonForUnban,
|
||||
roblox_id: id,
|
||||
roblox_username: username,
|
||||
whatHappened,
|
||||
}),
|
||||
whatHappened
|
||||
})
|
||||
);
|
||||
|
||||
await context.env.D1.prepare(
|
||||
"INSERT INTO game_appeals (created_at, id, open, user) VALUES (?, ?, ?, ?);",
|
||||
"INSERT INTO game_appeals (created_at, id, open, user) VALUES (?, ?, ?, ?);"
|
||||
).bind(Date.now(), appealId, 1, id);
|
||||
|
||||
await fetch(context.env.REPORTS_WEBHOOK, {
|
||||
@ -68,17 +68,17 @@ export async function onRequestPost(context: RequestContext) {
|
||||
{
|
||||
color: 3756250,
|
||||
description: `${username} has pleaded for forgiveness! Head to https://carcrushers.cc/mod-queue?id=${appealId}&type=gma`,
|
||||
title: "Appeal Submitted",
|
||||
},
|
||||
],
|
||||
title: "Appeal Submitted"
|
||||
}
|
||||
]
|
||||
}),
|
||||
headers: {
|
||||
"content-type": "application/json",
|
||||
"content-type": "application/json"
|
||||
},
|
||||
method: "POST",
|
||||
method: "POST"
|
||||
});
|
||||
|
||||
return new Response(null, {
|
||||
status: 204,
|
||||
status: 204
|
||||
});
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user