Skip to content

Commit

Permalink
Fixed whitelisting
Browse files Browse the repository at this point in the history
  • Loading branch information
Err0r430 committed Oct 27, 2024
1 parent 93f4d85 commit 29e6855
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions server/src/server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,13 @@ const ipCheck = Config.protection?.ipChecker
? new IpChecker(Config.protection.ipChecker.baseUrl, Config.protection.ipChecker.key)
: undefined;

const isVPN = new Map<string, boolean>(
existsSync("isVPN.json")
? Object.entries(JSON.parse(readFileSync("isVPN.json", "utf8")) as Record<string, boolean>)
: undefined
);
const isVPN = Config.protection?.ipChecker
? new Map<string, boolean>()
: new Map<string, boolean>(
existsSync("isVPN.json")
? Object.entries(JSON.parse(readFileSync("isVPN.json", "utf8")) as Record<string, boolean>)
: undefined
);

async function isVPNCheck(ip: string): Promise<boolean> {
if (!ipCheck) return false;
Expand Down Expand Up @@ -382,7 +384,7 @@ if (isMainThread) {

teamsCreated = {};

if (protection.ipChecker) {
if (!Config.protection?.ipChecker) {
writeFileSync("isVPN.json", JSON.stringify(Object.fromEntries(isVPN)));
}

Expand Down

0 comments on commit 29e6855

Please sign in to comment.