mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-10-02 19:47:40 +08:00
updated admin limit
This commit is contained in:
parent
b2ac4e7197
commit
cca3f8090d
3 changed files with 8 additions and 8 deletions
|
@ -7,7 +7,7 @@ import {
|
|||
validateConfiguration,
|
||||
} from "../../middlewares/api-utils";
|
||||
import * as AdminController from "../controllers/admin";
|
||||
import { onePerMin } from "../../middlewares/rate-limit";
|
||||
import { adminLimit } from "../../middlewares/rate-limit";
|
||||
import { toggleBan } from "../controllers/user";
|
||||
|
||||
const router = Router();
|
||||
|
@ -23,7 +23,7 @@ router.use(
|
|||
|
||||
router.get(
|
||||
"/",
|
||||
onePerMin,
|
||||
adminLimit,
|
||||
authenticateRequest({
|
||||
noCache: true,
|
||||
}),
|
||||
|
@ -33,7 +33,7 @@ router.get(
|
|||
|
||||
router.post(
|
||||
"/toggleBan",
|
||||
onePerMin,
|
||||
adminLimit,
|
||||
authenticateRequest({
|
||||
noCache: true,
|
||||
}),
|
||||
|
|
|
@ -8,7 +8,7 @@ import {
|
|||
} from "../../middlewares/api-utils";
|
||||
import * as ConfigurationController from "../controllers/configuration";
|
||||
import { authenticateRequest } from "../../middlewares/auth";
|
||||
import { onePerMin } from "../../middlewares/rate-limit";
|
||||
import { adminLimit } from "../../middlewares/rate-limit";
|
||||
|
||||
const router = Router();
|
||||
|
||||
|
@ -22,7 +22,7 @@ router.get("/", asyncHandler(ConfigurationController.getConfiguration));
|
|||
|
||||
router.patch(
|
||||
"/",
|
||||
onePerMin,
|
||||
adminLimit,
|
||||
useInProduction([authenticateRequest(), checkIfUserIsConfigurationMod]),
|
||||
validateRequest({
|
||||
body: {
|
||||
|
@ -34,7 +34,7 @@ router.patch(
|
|||
|
||||
router.get(
|
||||
"/schema",
|
||||
onePerMin,
|
||||
adminLimit,
|
||||
useInProduction([authenticateRequest(), checkIfUserIsConfigurationMod]),
|
||||
asyncHandler(ConfigurationController.getSchema)
|
||||
);
|
||||
|
|
|
@ -98,8 +98,8 @@ export async function incrementBadAuth(
|
|||
} catch (error) {}
|
||||
}
|
||||
|
||||
export const onePerMin = rateLimit({
|
||||
windowMs: 60 * 1000,
|
||||
export const adminLimit = rateLimit({
|
||||
windowMs: 5000,
|
||||
max: 1 * REQUEST_MULTIPLIER,
|
||||
keyGenerator: getKeyWithUid,
|
||||
handler: customHandler,
|
||||
|
|
Loading…
Add table
Reference in a new issue