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; }