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:
parent
2e451d8fd0
commit
f09daaa3de
@ -46,7 +46,8 @@ export default function rateLimit(opts: {
|
|||||||
}): any {
|
}): any {
|
||||||
return async (req: Request, res: Response, next: NextFunction): Promise<any> => {
|
return async (req: Request, res: Response, next: NextFunction): Promise<any> => {
|
||||||
// exempt user? if so, immediately short circuit
|
// 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, "");
|
const bucket_id = opts.bucket || req.originalUrl.replace(API_PREFIX_TRAILING_SLASH, "");
|
||||||
var executor_id = getIpAdress(req);
|
var executor_id = getIpAdress(req);
|
||||||
|
@ -95,7 +95,7 @@ router.put(
|
|||||||
var body = req.body as MessageCreateSchema;
|
var body = req.body as MessageCreateSchema;
|
||||||
const attachments: Attachment[] = [];
|
const attachments: Attachment[] = [];
|
||||||
|
|
||||||
const rights = getRights(req.user_id);
|
const rights = await getRights(req.user_id);
|
||||||
rights.hasThrow("SEND_MESSAGES");
|
rights.hasThrow("SEND_MESSAGES");
|
||||||
|
|
||||||
// regex to check if message contains anything other than numerals ( also no decimals )
|
// 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",
|
"name": "@fosscord/api",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "GPLV3",
|
"license": "AGPLV3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@babel/preset-env": "^7.15.8",
|
"@babel/preset-env": "^7.15.8",
|
||||||
"@babel/preset-typescript": "^7.15.0",
|
"@babel/preset-typescript": "^7.15.0",
|
||||||
@ -164,7 +164,7 @@
|
|||||||
"../cdn": {
|
"../cdn": {
|
||||||
"name": "@fosscord/cdn",
|
"name": "@fosscord/cdn",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"license": "GPLV3",
|
"license": "AGPLV3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@aws-sdk/client-s3": "^3.36.1",
|
"@aws-sdk/client-s3": "^3.36.1",
|
||||||
"@aws-sdk/node-http-handler": "^3.36.0",
|
"@aws-sdk/node-http-handler": "^3.36.0",
|
||||||
@ -208,7 +208,7 @@
|
|||||||
"name": "@fosscord/gateway",
|
"name": "@fosscord/gateway",
|
||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"hasInstallScript": true,
|
"hasInstallScript": true,
|
||||||
"license": "GPLV3",
|
"license": "AGPLV3",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@fosscord/util": "file:../util",
|
"@fosscord/util": "file:../util",
|
||||||
"amqplib": "^0.8.0",
|
"amqplib": "^0.8.0",
|
||||||
|
Loading…
Reference in New Issue
Block a user