1
0
mirror of https://github.com/spacebarchat/server.git synced 2024-11-23 10:52:30 +01:00

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 6 additions and 5 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 )

View File

@ -101,7 +101,7 @@
"name": "@fosscord/api",
"version": "1.0.0",
"hasInstallScript": true,
"license": "GPLV3",
"license": "AGPLV3",
"dependencies": {
"@babel/preset-env": "^7.15.8",
"@babel/preset-typescript": "^7.15.0",
@ -164,7 +164,7 @@
"../cdn": {
"name": "@fosscord/cdn",
"version": "1.0.0",
"license": "GPLV3",
"license": "AGPLV3",
"dependencies": {
"@aws-sdk/client-s3": "^3.36.1",
"@aws-sdk/node-http-handler": "^3.36.0",
@ -208,7 +208,7 @@
"name": "@fosscord/gateway",
"version": "1.0.0",
"hasInstallScript": true,
"license": "GPLV3",
"license": "AGPLV3",
"dependencies": {
"@fosscord/util": "file:../util",
"amqplib": "^0.8.0",