needs to be async

This commit is contained in:
Erkin Alp Güney 2022-04-28 21:38:39 +03:00
parent 2e451d8fd0
commit f09daaa3de
3 changed files with 3 additions and 2 deletions

View File

@ -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);

View File

@ -95,7 +95,7 @@ router.put(
var body = req.body as MessageCreateSchema;
const attachments: Attachment[] = [];
const rights = getRights(req.user_id);
const rights = await getRights(req.user_id);
rights.hasThrow("SEND_MESSAGES");
// regex to check if message contains anything other than numerals ( also no decimals )

BIN
bundle/package-lock.json generated

Binary file not shown.