summary refs log tree commit diff
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
parentexempt users logic (diff)
downloadserver-e1399b2875b98c997aa51fc2196a99910248523e.tar.xz
needs to be async
-rw-r--r--api/src/middlewares/RateLimit.ts3
-rw-r--r--api/src/routes/channels/#channel_id/messages/#message_id/index.ts2
-rw-r--r--bundle/package-lock.json6
3 files changed, 6 insertions, 5 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);
diff --git a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
index 958954b6..63fee9b9 100644
--- a/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
+++ b/api/src/routes/channels/#channel_id/messages/#message_id/index.ts
@@ -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 )
diff --git a/bundle/package-lock.json b/bundle/package-lock.json
index 4742b4a4..6fbd6978 100644
--- a/bundle/package-lock.json
+++ b/bundle/package-lock.json
@@ -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",