aboutsummaryrefslogtreecommitdiffstats
path: root/routes/users.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-28 22:06:55 -0800
committerAdam Soltys <[email protected]>2026-02-28 22:06:55 -0800
commit51e01eb2dc6e7976963c31b9349c4e621c535874 (patch)
tree6987a086e1dfe156d3addd3f88254e5ebd53bebd /routes/users.ts
parent205ffb7684f18256690f374ab78745ccfe5d850d (diff)
downloadcoinos-server-51e01eb2dc6e7976963c31b9349c4e621c535874.tar.gz
coinos-server-51e01eb2dc6e7976963c31b9349c4e621c535874.zip
disable rate limiting in dev
Diffstat (limited to 'routes/users.ts')
-rw-r--r--routes/users.ts8
1 files changed, 4 insertions, 4 deletions
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);