Create direct game bans middleware

This commit is contained in:
regalijan 2023-10-19 16:49:42 -04:00
parent 32387f9c2a
commit 4687540269
Signed by: regalijan
GPG Key ID: 5D4196DA269EF520

View File

@ -0,0 +1,21 @@
export async function onRequest(context: RequestContext) {
const { current_user: currentUser } = context.data;
if (!currentUser)
return new Response('{"error":Not logged in"}', {
headers: {
"content-type": "application/json",
},
status: 401,
});
if (!(currentUser.permissions & (1 << 5)))
return new Response('{"error":"Forbidden"}', {
headers: {
"content-type": "application/json",
},
status: 403,
});
return await context.next();
}