diff options
author | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-24 03:01:57 +0200 |
---|---|---|
committer | TheArcaneBrony <myrainbowdash949@gmail.com> | 2022-08-24 03:07:14 +0200 |
commit | 401eda069a3ced17f1c43294d19765663cb8dcb7 (patch) | |
tree | 89081905f2b2d1f940372555d5edf62bc8b1cadd /src/api/middlewares | |
parent | Check Captcha (diff) | |
download | server-401eda069a3ced17f1c43294d19765663cb8dcb7.tar.xz |
case insensitive header for rate limits, fix rate limit default settings
Also disabled rate limit bypass right as it doesn't work...
Diffstat (limited to 'src/api/middlewares')
-rw-r--r-- | src/api/middlewares/RateLimit.ts | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/api/middlewares/RateLimit.ts b/src/api/middlewares/RateLimit.ts index 7754edf6..dc93dcef 100644 --- a/src/api/middlewares/RateLimit.ts +++ b/src/api/middlewares/RateLimit.ts @@ -48,7 +48,7 @@ export default function rateLimit(opts: { // exempt user? if so, immediately short circuit if (req.user_id) { const rights = await getRights(req.user_id); - if (rights.has("BYPASS_RATE_LIMITS")) return; + if (rights.has("BYPASS_RATE_LIMITS")) return next(); } const bucket_id = opts.bucket || req.originalUrl.replace(API_PREFIX_TRAILING_SLASH, ""); @@ -121,6 +121,7 @@ export default function rateLimit(opts: { export async function initRateLimits(app: Router) { const { routes, global, ip, error, disabled } = Config.get().limits.rate; if (disabled) return; + console.log("Enabling rate limits..."); await listenEvent(EventRateLimit, (event) => { Cache.set(event.channel_id as string, event.data); event.acknowledge?.(); |