diff options
author | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-11 13:17:20 +0200 |
---|---|---|
committer | Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> | 2021-08-11 13:17:20 +0200 |
commit | bec70800df24ce0af95f3e3b91b4821d3743c418 (patch) | |
tree | 4a901b5a7e8aa07a5eb93f3dd8d8ab874cd02cdb | |
parent | :bug: fix guild channel position update (diff) | |
download | server-bec70800df24ce0af95f3e3b91b4821d3743c418.tar.xz |
:pencil2: fix RateLimit onlyIp typo
-rw-r--r-- | src/Server.ts | 2 | ||||
-rw-r--r-- | src/middlewares/RateLimit.ts | 4 |
2 files changed, 3 insertions, 3 deletions
diff --git a/src/Server.ts b/src/Server.ts index fcc5374b..69222636 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -86,7 +86,7 @@ export class FosscordServer extends Server { // @ts-ignore this.app = api; api.use(RateLimit({ bucket: "global", count: 10, window: 5, bot: 250 })); - api.use(RateLimit({ bucket: "error", count: 5, error: true, window: 5, bot: 15, onylIp: true })); + api.use(RateLimit({ bucket: "error", count: 5, error: true, window: 5, bot: 15, onlyIp: true })); api.use("/guilds/:id", RateLimit({ count: 5, window: 5 })); api.use("/webhooks/:id", RateLimit({ count: 5, window: 5 })); api.use("/channels/:id", RateLimit({ count: 5, window: 5 })); diff --git a/src/middlewares/RateLimit.ts b/src/middlewares/RateLimit.ts index 088c3161..0858744a 100644 --- a/src/middlewares/RateLimit.ts +++ b/src/middlewares/RateLimit.ts @@ -42,14 +42,14 @@ export default function RateLimit(opts: { MODIFY?: number; error?: boolean; success?: boolean; - onylIp?: boolean; + onlyIp?: boolean; }): any { Cache.init(); // will only initalize it once return async (req: Request, res: Response, next: NextFunction): Promise<any> => { const bucket_id = opts.bucket || req.originalUrl.replace(API_PREFIX_TRAILING_SLASH, ""); var user_id = getIpAdress(req); - if (!opts.onylIp && req.user_id) user_id = req.user_id; + if (!opts.onlyIp && req.user_id) user_id = req.user_id; var max_hits = opts.count; if (opts.bot && req.user_bot) max_hits = opts.bot; |