diff options
author | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-11 21:56:00 +1000 |
---|---|---|
committer | Madeline <46743919+MaddyUnderStars@users.noreply.github.com> | 2022-09-11 21:56:00 +1000 |
commit | 529da53117f46913adc4632a36446068ae5c7d58 (patch) | |
tree | ac3bd888f5ac9e1db4e55ece518aa38081e33da7 | |
parent | Trash ip logging (diff) | |
download | server-529da53117f46913adc4632a36446068ae5c7d58.tar.xz |
Trash ip logging for rate limits
-rw-r--r-- | api/src/middlewares/RateLimit.ts | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/api/src/middlewares/RateLimit.ts b/api/src/middlewares/RateLimit.ts index 6613e25a..57645c0b 100644 --- a/api/src/middlewares/RateLimit.ts +++ b/api/src/middlewares/RateLimit.ts @@ -79,7 +79,7 @@ export default function rateLimit(opts: { resetAfterMs = reset - Date.now(); resetAfterSec = Math.ceil(resetAfterMs / 1000); - console.log("blocked bucket: " + bucket_id, { resetAfterMs }); + console.log(`blocked bucket: ${bucket_id} ${executor_id}`, { resetAfterMs }); return ( res .status(429) @@ -160,7 +160,7 @@ export async function initRateLimits(app: Router) { app.use("/auth/register", rateLimit({ onlyIp: true, success: true, ...routes.auth.register })); } -async function hitRoute(opts: { executor_id: string; bucket_id: string; max_hits: number; window: number }) { +async function hitRoute(opts: { executor_id: string; bucket_id: string; max_hits: number; window: number; }) { const id = opts.executor_id + opts.bucket_id; let limit = Cache.get(id); if (!limit) { |