From 21cfc8218b026bed745c260463b18170019a0efa Mon Sep 17 00:00:00 2001 From: Mystikfluu Date: Sat, 10 Sep 2022 17:35:51 +0200 Subject: [PATCH] add ratelimit to error code list --- error_codes.txt | 1 + server.js | 1 + 2 files changed, 2 insertions(+) diff --git a/error_codes.txt b/error_codes.txt index b08f376..476de90 100644 --- a/error_codes.txt +++ b/error_codes.txt @@ -3,5 +3,6 @@ 403: login error (no cookie) 404: invalid url / not found 410-419: argument/data error +429: ratelimit 500: server error \ No newline at end of file diff --git a/server.js b/server.js index 4a1325e..6a7646b 100644 --- a/server.js +++ b/server.js @@ -295,6 +295,7 @@ function increaseIndividualCall(url, req) { } INDIVIDUAL_CALLS[ip][url]++; if (INDIVIDUAL_CALLS[ip][url] >= conf["max"]) { + res.status(429) console.log(5, "ratelimiting someone on", url, INDIVIDUAL_CALLS[ip][url], conf["max"]); return false; }