Fix middleware routing issue
This commit is contained in:
@ -1,4 +1,10 @@
|
|||||||
export async function onRequestPost(context: RequestContext) {
|
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;
|
const { permissions } = context.data.current_user;
|
||||||
|
|
||||||
if (!(permissions & (1 << 0)) && !(permissions & (1 << 11)))
|
if (!(permissions & (1 << 0)) && !(permissions & (1 << 11)))
|
||||||
@ -14,7 +20,7 @@ export async function onRequestPost(context: RequestContext) {
|
|||||||
|
|
||||||
context.data.targetId = id;
|
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}`);
|
const key = await context.env.DATA.get(`appeal_${id}`);
|
||||||
|
|
||||||
if (!key)
|
if (!key)
|
||||||
|
Reference in New Issue
Block a user