summary refs log tree commit diff
path: root/api/src/middlewares/RateLimit.ts
diff options
context:
space:
mode:
authorErkin Alp Güney <erkinalp9035@gmail.com>2022-04-28 21:38:39 +0300
committerErkin Alp Güney <erkinalp9035@gmail.com>2022-04-28 21:38:39 +0300
commite1399b2875b98c997aa51fc2196a99910248523e (patch)
treec0b28008890a55c483c03d0ed18701fa34d81bb3 /api/src/middlewares/RateLimit.ts
parentexempt users logic (diff)
downloadserver-e1399b2875b98c997aa51fc2196a99910248523e.tar.xz
needs to be async
Diffstat (limited to 'api/src/middlewares/RateLimit.ts')
-rw-r--r--api/src/middlewares/RateLimit.ts3
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);