mirror of
https://github.com/spacebarchat/server.git
synced 2024-11-22 18:32:29 +01:00
needs to be async
This commit is contained in:
parent
9ecd3d530b
commit
e1399b2875
@ -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);
|
||||
|
@ -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 )
|
||||
|
6
bundle/package-lock.json
generated
6
bundle/package-lock.json
generated
@ -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",
|
||||
|
Loading…
Reference in New Issue
Block a user