core: allow rate limit override

pull/297/head
undefined 3 years ago
parent a70c55e585
commit 688ccf811b

@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.3.13",
"version": "3.3.14",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
@ -36,7 +36,7 @@
"minio": "7.0.25",
"moment-timezone": "^0.5.34",
"mongodb": "^3.7.3",
"nanoid": "^3.1.30",
"nanoid": "^3.2.0",
"nodemailer": "^6.7.2",
"notp": "^2.0.3",
"p-queue": "^7.1.0",

@ -314,8 +314,9 @@ export class HandlerCommon {
async limitRate(op: string, periodSecs: number, maxOperations: number) {
if (ignoredLimit.includes(op)) return;
// TODO: support limit override
if (this.user && this.user.hasPriv(PRIV.PRIV_UNLIMITED_ACCESS)) return;
const overrideLimit = system.get(`limit.${op}`);
if (overrideLimit) maxOperations = overrideLimit;
await opcount.inc(op, this.request.ip, periodSecs, maxOperations);
}

Loading…
Cancel
Save