xff header check

This commit is contained in:
undefined committed 2020-07-25 10:50:03 +08:00
1 parent 71ab562592
commit 3f84f131a1
8 files changed
+77 -70

No files matched your search

+6 -7
View File
@@ -1,4 +1,7 @@
// @ts-nocheck
import { Udoc } from '../interface';
/* Why nocheck?
* BitInt requires at least ES2020, but we can't use it as
* NodeJS doesn't support some of this new features.
@@ -83,10 +86,10 @@ export const PERM = {
PERM_VIEW_RANKING: 1n << 50n,
// Placeholder
PERM_ALL: 0n,
PERM_ALL: -1n,
PERM_BASIC: 0n,
PERM_DEFAULT: 0n,
PERM_ADMIN: 0n,
PERM_ADMIN: -1n,
};
export const Permission = (family: string, key: BigInt, desc: string) => ({ family, key, desc });
@@ -153,10 +156,6 @@ export const PERMS = [
Permission('perm_ranking', PERM.PERM_VIEW_RANKING, 'View ranking'),
];
let PERM_ALL = 0n;
for (const p in PERM) if (PERM[p]) PERM_ALL |= PERM[p];
PERM.PERM_ALL = PERM_ALL;
export const PERMS_BY_FAMILY = {};
for (const p of PERMS) {
if (!PERMS_BY_FAMILY[p.family]) PERMS_BY_FAMILY[p.family] = [p];
@@ -268,7 +267,7 @@ export const LEVELS = [
[1, 100],
];
export const BUILTIN_USERS = [
export const BUILTIN_USERS: Udoc[] = [
{
_id: 0,
mail: 'Guest@hydro.local',