From c3c8026041d29d7b50d54080d21518cadae97fff Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 1 Jul 2021 21:27:46 +0200 Subject: :sparkles: route specific rate limits --- src/Server.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/Server.ts') diff --git a/src/Server.ts b/src/Server.ts index 326fcc5c..94aab0f5 100644 --- a/src/Server.ts +++ b/src/Server.ts @@ -93,10 +93,11 @@ export class FosscordServer extends Server { const prefix = Router(); // @ts-ignore this.app = prefix; - prefix.use(RateLimit({ bucket: "global", count: 10, error: 10, window: 5, bot: 250 })); - prefix.use("/guilds/:id", RateLimit({ count: 10, window: 5 })); - prefix.use("/webhooks/:id", RateLimit({ count: 10, window: 5 })); - prefix.use("/channels/:id", RateLimit({ count: 10, window: 5 })); + prefix.use(RateLimit({ bucket: "global", count: 10, window: 5, bot: 250 })); + prefix.use(RateLimit({ bucket: "error", count: 5, error: true, window: 5, bot: 15, onylIp: true })); + prefix.use("/guilds/:id", RateLimit({ count: 5, window: 5 })); + prefix.use("/webhooks/:id", RateLimit({ count: 5, window: 5 })); + prefix.use("/channels/:id", RateLimit({ count: 5, window: 5 })); this.routes = await this.registerRoutes(path.join(__dirname, "routes", "/")); app.use("/api", prefix); // allow unversioned requests -- cgit 1.5.1