From 46255f6615ebc70f5a2eb0b00e8cf487b04b206b Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:49:40 -0400 Subject: [PATCH] Create GME framework --- functions/api/gme/_middleware.ts | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 functions/api/gme/_middleware.ts 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(); +}