Fix middleware routing issue

This commit is contained in:
2023-10-19 16:49:21 -04:00
parent 95bda996bb
commit 7b73d646a5

View File

@ -1,4 +1,10 @@
export async function onRequestPost(context: RequestContext) {
const { pathname } = new URL(context.request.url);
// Fix weirdo routing issue
if (pathname.endsWith("/submit") || pathname.endsWith("/toggle"))
return await context.next();
const { permissions } = context.data.current_user;
if (!(permissions & (1 << 0)) && !(permissions & (1 << 11)))
@ -14,7 +20,7 @@ export async function onRequestPost(context: RequestContext) {
context.data.targetId = id;
if (!new URL(context.request.url).pathname.endsWith("/ban")) {
if (!pathname.endsWith("/ban")) {
const key = await context.env.DATA.get(`appeal_${id}`);
if (!key)