From 51e01eb2dc6e7976963c31b9349c4e621c535874 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 28 Feb 2026 22:06:55 -0800 Subject: disable rate limiting in dev --- routes/users.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'routes/users.ts') diff --git a/routes/users.ts b/routes/users.ts index 9ebe3614..6869021a 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -14,7 +14,7 @@ import { import register from "$lib/register"; import { emit } from "$lib/sockets"; import upload from "$lib/upload"; -import { bail, fail, fields, getUser, pick } from "$lib/utils"; +import { bail, fail, fields, getUser, pick, prod } from "$lib/utils"; import whitelist from "$lib/whitelist"; import rpc from "@coinos/rpc"; import { $ } from "bun"; @@ -371,7 +371,7 @@ export default { const ipKey = `ip:${ip}:login`; const ipCount = await db.incr(ipKey); if (ipCount === 1) await db.expire(ipKey, 10); - if (Number(ipCount) > 30) return c.json({}, 429); + if (prod && Number(ipCount) > 30) return c.json({}, 429); const recaptchaOk = await verifyRecaptcha(recaptcha, c, body); if (!recaptchaOk) { @@ -384,7 +384,7 @@ export default { const fk = `${username}:failures`; const ipFailKey = `ip:${ip}:login:fail`; const ipFailures = await g(ipFailKey); - if (Number(ipFailures) > 20) return c.json({}, 429); + if (prod && Number(ipFailures) > 20) return c.json({}, 429); let user = await getUser(username); @@ -447,7 +447,7 @@ export default { const ipKey = `ip:${ip}:login`; const ipCount = await db.incr(ipKey); if (ipCount === 1) await db.expire(ipKey, 10); - if (Number(ipCount) > 30) return c.json({}, 429); + if (prod && Number(ipCount) > 30) return c.json({}, 429); const recaptchaOk = await verifyRecaptcha(recaptcha, c, body); if (!recaptchaOk) return c.json("failed captcha", 401); -- cgit v1.2.3