diff --git a/functions/api/gme/_middleware.ts b/functions/api/gme/_middleware.ts new file mode 100644 index 0000000..f7400bb --- /dev/null +++ b/functions/api/gme/_middleware.ts @@ -0,0 +1,13 @@ +export async function onRequest(context: RequestContext) { + const { current_user: currentUser } = context.data; + + if (!currentUser || !(currentUser & (1 << 5))) + return new Response('{"error":"Forbidden"}', { + headers: { + "content-type": "application/json", + }, + status: 403, + }); + + return await context.next(); +}