core: allow rate limit override

This commit is contained in:
undefined committed 2022-01-22 16:55:00 +08:00
1 parent a70c55e585
commit 688ccf811b
2 files changed
+4 -3

No files matched your search

+2 -2
View File
@@ -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",
+2 -1
View File
@@ -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);
}