summary refs log tree commit diff
path: root/src/Server.ts
diff options
context:
space:
mode:
authorFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-07-01 21:27:46 +0200
committerFlam3rboy <34555296+Flam3rboy@users.noreply.github.com>2021-07-01 21:27:46 +0200
commitc3c8026041d29d7b50d54080d21518cadae97fff (patch)
tree3c95d992accbc99624d5a6dcc7ec946f56e48697 /src/Server.ts
parentMerge pull request #162 from fosscord/feat--rate-limit (diff)
downloadserver-c3c8026041d29d7b50d54080d21518cadae97fff.tar.xz
:sparkles: route specific rate limits
Diffstat (limited to 'src/Server.ts')
-rw-r--r--src/Server.ts9
1 files changed, 5 insertions, 4 deletions
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