From 85d4fe02dd62c831243dc0dadf7fc53eaeb0f8b9 Mon Sep 17 00:00:00 2001 From: regalijan Date: Thu, 19 Oct 2023 16:51:02 -0400 Subject: [PATCH] Actually make game mod role work --- functions/api/auth/session.ts | 8 ++++++-- functions/permissions.ts | 4 ++-- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/functions/api/auth/session.ts b/functions/api/auth/session.ts index 071af9c..a2a64f6 100644 --- a/functions/api/auth/session.ts +++ b/functions/api/auth/session.ts @@ -112,10 +112,14 @@ export async function onRequestGet(context: RequestContext) { const memberData: { [k: string]: any } = await serverMemberReq.json(); if (serverMemberReq.ok) { - userData.permissions = await GetPermissions(userData.id, memberData.roles); + userData.permissions = await GetPermissions( + userData.id, + context, + memberData.roles, + ); userData.roles = memberData.roles; } else { - userData.permissions = await GetPermissions(userData.id); + userData.permissions = await GetPermissions(userData.id, context); } const selectedTokenStart = diff --git a/functions/permissions.ts b/functions/permissions.ts index 914f165..b4d1035 100644 --- a/functions/permissions.ts +++ b/functions/permissions.ts @@ -1,7 +1,7 @@ export default async function ( userid: string, + context: RequestContext, roles?: string[], - context?: RequestContext, ): Promise { let permissions = 0; @@ -14,7 +14,7 @@ export default async function ( ["165594923586945025", "289372404541554689", "396347223736057866"].includes( userid, ) || - Boolean(await context?.env.DATA.get(`gamemod_${userid}`)) + Boolean(await context.env.DATA.get(`gamemod_${userid}`)) ) permissions |= 1 << 5; if (