mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 05:03:39 +08:00
increased limit on getting basic user data
This commit is contained in:
parent
5d66c3f6b8
commit
ecb11e0f9d
2 changed files with 17 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ const router = Router();
|
|||
|
||||
router.get(
|
||||
"/",
|
||||
RateLimit.limit60perhour,
|
||||
RateLimit.limit120perhour,
|
||||
authenticateRequest,
|
||||
UserController.getUser
|
||||
);
|
||||
|
|
|
|||
|
|
@ -18,6 +18,22 @@ exports.limit60perhour = rateLimit({
|
|||
},
|
||||
});
|
||||
|
||||
exports.limit120perhour = rateLimit({
|
||||
windowMs: 60 * 60 * 1000, // 60 min
|
||||
max: 120 * multiplier,
|
||||
message: {
|
||||
message: "Too many requests, please try again later",
|
||||
},
|
||||
keyGenerator: (req) => {
|
||||
return `${
|
||||
req.headers["cf-connecting-ip"] ||
|
||||
req.headers["x-forwarded-for"] ||
|
||||
req.ip ||
|
||||
"255.255.255.255"
|
||||
}`;
|
||||
},
|
||||
});
|
||||
|
||||
exports.limit3perday = rateLimit({
|
||||
windowMs: 24 * 60 * 60 * 1000, // 1 day
|
||||
max: 3 * multiplier,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue