From 6c15fc8b5fcba2ffbfed8c90d56fdc0d3a3db7c9 Mon Sep 17 00:00:00 2001 From: Ashley Date: Thu, 24 Aug 2023 19:34:52 +0000 Subject: [PATCH] add ratelimits :3 --- server.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/server.js b/server.js index 758ef9ae..ac892698 100644 --- a/server.js +++ b/server.js @@ -61,9 +61,16 @@ ); const sha384 = modules.hash; - + const rateLimit = require("express-rate-limit"); + + + const limiter = rateLimit({ + windowMs: 30 * 1000, // 30 Seconds + max: 870, // limit each IP to 870 requests per windowMs + }); var app = modules.express(); + app.use(limiter); initlog("Loaded express.js"); app.engine("html", require("ejs").renderFile); app.use(modules.express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded