add ratelimits :3

This commit is contained in:
Ashley 2023-08-24 19:34:52 +00:00
parent 5dfeb84bb1
commit 6c15fc8b5f

View file

@ -61,9 +61,16 @@
); );
const sha384 = modules.hash; 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(); var app = modules.express();
app.use(limiter);
initlog("Loaded express.js"); initlog("Loaded express.js");
app.engine("html", require("ejs").renderFile); app.engine("html", require("ejs").renderFile);
app.use(modules.express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded app.use(modules.express.urlencoded({ extended: true })); // for parsing application/x-www-form-urlencoded