diff options
author | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-04-28 21:38:39 +0300 |
---|---|---|
committer | Erkin Alp Güney <erkinalp9035@gmail.com> | 2022-04-28 21:38:39 +0300 |
commit | e1399b2875b98c997aa51fc2196a99910248523e (patch) | |
tree | c0b28008890a55c483c03d0ed18701fa34d81bb3 /api/src/middlewares/RateLimit.ts | |
parent | exempt users logic (diff) | |
download | server-e1399b2875b98c997aa51fc2196a99910248523e.tar.xz |
needs to be async
Diffstat (limited to 'api/src/middlewares/RateLimit.ts')
-rw-r--r-- | api/src/middlewares/RateLimit.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/api/src/middlewares/RateLimit.ts b/api/src/middlewares/RateLimit.ts index 7d5c51e2..ca6de98f 100644 --- a/api/src/middlewares/RateLimit.ts +++ b/api/src/middlewares/RateLimit.ts @@ -46,7 +46,8 @@ export default function rateLimit(opts: { }): any { return async (req: Request, res: Response, next: NextFunction): Promise<any> => { // exempt user? if so, immediately short circuit - if (getRights(req.user_id).has("BYPASS_RATE_LIMITS")) return; + const rights = await getRights(req.user_id); + if (rights.has("BYPASS_RATE_LIMITS")) return; const bucket_id = opts.bucket || req.originalUrl.replace(API_PREFIX_TRAILING_SLASH, ""); var executor_id = getIpAdress(req); |