mirror of
https://github.com/openfrontio/OpenFrontIO.git
synced 2026-07-06 00:38:49 +00:00
check if user in list
This commit is contained in:
+3
-2
@@ -1,7 +1,7 @@
|
||||
import { decodeJwt } from "jose";
|
||||
import { z } from "zod/v4";
|
||||
import {
|
||||
allowedDiscordIds,
|
||||
discordIdHashes,
|
||||
RefreshResponseSchema,
|
||||
TokenPayload,
|
||||
TokenPayloadSchema,
|
||||
@@ -9,6 +9,7 @@ import {
|
||||
UserMeResponseSchema,
|
||||
} from "../core/ApiSchemas";
|
||||
import { getServerConfigFromClient } from "../core/configuration/ConfigLoader";
|
||||
import { simpleHash } from "../core/Util";
|
||||
|
||||
function getAudience() {
|
||||
const { hostname } = new URL(window.location.href);
|
||||
@@ -234,7 +235,7 @@ export async function getUserMe(): Promise<UserMeResponse | false> {
|
||||
console.error("Invalid response", error);
|
||||
return false;
|
||||
}
|
||||
if (!allowedDiscordIds.includes(result.data.user.id)) {
|
||||
if (!discordIdHashes.includes(simpleHash(result.data.user.id))) {
|
||||
console.error("Unauthorized: User not in allowed list");
|
||||
clearToken();
|
||||
window.location.href = "https://www.youtube.com/watch?v=dQw4w9WgXcQ";
|
||||
|
||||
+15
-86
@@ -48,90 +48,19 @@ export const UserMeResponseSchema = z.object({
|
||||
});
|
||||
export type UserMeResponse = z.infer<typeof UserMeResponseSchema>;
|
||||
|
||||
export const allowedDiscordIds: string[] = [
|
||||
"801201988980834374",
|
||||
"383908937407135744",
|
||||
"991040538142715914",
|
||||
"109208187495796736",
|
||||
"524916260480221184",
|
||||
"923944328945098792",
|
||||
"1248130385230037125",
|
||||
"1042867662692302878",
|
||||
"1231353285798002711",
|
||||
"1380825798956548217",
|
||||
"321330861305757696",
|
||||
"1231132235793694762",
|
||||
"518092307765919755",
|
||||
"818164543477645324",
|
||||
"1056637784556843009",
|
||||
"748290919886749828",
|
||||
"1207048759616217101",
|
||||
"1332571420701757441",
|
||||
"402217202113052682",
|
||||
"207467536432889857",
|
||||
"1068599025932193904",
|
||||
"1068599025932193904",
|
||||
"717364086874046584",
|
||||
"470638985870442516",
|
||||
"257866880402849792",
|
||||
"863823197035823125",
|
||||
"662278693179097088",
|
||||
"1371692527702380616",
|
||||
"296454138877968385",
|
||||
"337118939421212673",
|
||||
"719142768693346315",
|
||||
"537013169546067974",
|
||||
"1237133105215574056",
|
||||
"1149773842877796423",
|
||||
"229985855077351424",
|
||||
"536446199012655104",
|
||||
"302797599952470016",
|
||||
"269534621719330816",
|
||||
"1125081721507958904",
|
||||
"735445052461023302",
|
||||
"515926547786629142",
|
||||
"1388899072034738176",
|
||||
"1260964720824025088",
|
||||
"1042598121429028944",
|
||||
"1086680982712758312",
|
||||
"439390916676026378",
|
||||
"1233539002171392052",
|
||||
"748439392489701396",
|
||||
"1134460734923882506",
|
||||
"1120408570668789941",
|
||||
"969552442704412672",
|
||||
"928360146583842896",
|
||||
"376153617306091533",
|
||||
"420169470942904320",
|
||||
"642727461171232794",
|
||||
"1136031095515783229",
|
||||
"207082417217994754",
|
||||
"377107679975309313",
|
||||
"250918787178561537",
|
||||
"792380506939457536",
|
||||
"239571828325089280",
|
||||
"307514132846870546",
|
||||
"162984858811891715",
|
||||
"928735342469726298",
|
||||
"516828441065160714",
|
||||
"1334886860538904679",
|
||||
"1060632477489713212",
|
||||
"658879672851103755",
|
||||
"1035677402606600252",
|
||||
"874951032319397918",
|
||||
"384767022560575496",
|
||||
"814085898932715560",
|
||||
"327950020831870987",
|
||||
"292684898324709377",
|
||||
"905159200462753874",
|
||||
"1165558245096706129",
|
||||
"1088886751810027600",
|
||||
"943482851628826635",
|
||||
"640771103425429525",
|
||||
"1313943792948350976",
|
||||
"1054834071789908019",
|
||||
"277841234133778432",
|
||||
"260802472421883906",
|
||||
"230415855614296075",
|
||||
"251738465643921409",
|
||||
export const discordIdHashes = [
|
||||
1661393335, 1851863381, 1003936817, 653544870, 1557759837, 1042722497,
|
||||
65439800, 155156957, 1218512162, 426095068, 416547875, 1798289200, 1052294911,
|
||||
1083112658, 1233079359, 774244699, 952418618, 1215601556, 1716860484,
|
||||
1853687192, 247930283, 247930283, 2132635226, 1869027023, 2001674915,
|
||||
766449506, 153828422, 145274786, 2046238715, 253694988, 1507817897,
|
||||
1646270753, 542766539, 351814673, 365160220, 828883677, 2033416503, 37123544,
|
||||
961728307, 94814174, 1304192493, 1414342672, 2137156610, 1894770459,
|
||||
103555344, 174993017, 1205888044, 1252537152, 1469901896, 1457907846,
|
||||
388895429, 1201515958, 1460910617, 504159584, 1988458085, 938609279,
|
||||
151073647, 1638157021, 608899192, 699791521, 940653944, 191262706, 1433232464,
|
||||
949130070, 985289297, 160421750, 423901399, 2053086809, 813603540, 262358277,
|
||||
240859002, 1788524537, 717454965, 1896548568, 1624081483, 135101486,
|
||||
1673600636, 523037306, 1713725183, 602978453, 951411520, 644853372,
|
||||
2031630654, 199624311, 1740705355,
|
||||
];
|
||||
|
||||
Reference in New Issue
Block a user