add ratelimit to error code list

This commit is contained in:
Mystikfluu 2022-09-10 17:35:51 +02:00
parent a763bde1f8
commit 21cfc8218b
2 changed files with 2 additions and 0 deletions

View File

@ -3,5 +3,6 @@
403: login error (no cookie) 403: login error (no cookie)
404: invalid url / not found 404: invalid url / not found
410-419: argument/data error 410-419: argument/data error
429: ratelimit
500: server error 500: server error

View File

@ -295,6 +295,7 @@ function increaseIndividualCall(url, req) {
} }
INDIVIDUAL_CALLS[ip][url]++; INDIVIDUAL_CALLS[ip][url]++;
if (INDIVIDUAL_CALLS[ip][url] >= conf["max"]) { if (INDIVIDUAL_CALLS[ip][url] >= conf["max"]) {
res.status(429)
console.log(5, "ratelimiting someone on", url, INDIVIDUAL_CALLS[ip][url], conf["max"]); console.log(5, "ratelimiting someone on", url, INDIVIDUAL_CALLS[ip][url], conf["max"]);
return false; return false;
} }