diff options
| author | Adam Soltys <[email protected]> | 2026-02-04 22:53:22 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2026-02-04 22:56:02 +0000 |
| commit | 0ad6c9ec8a4f91e1d45af4a76330cc3ddcf177a2 (patch) | |
| tree | 55e214cb025446f8a1515a36ece8364253d98fef /routes | |
| parent | 63fa3a65399de3bc52ba753e6ce758b49ccef389 (diff) | |
| download | coinos-server-0ad6c9ec8a4f91e1d45af4a76330cc3ddcf177a2.tar.gz coinos-server-0ad6c9ec8a4f91e1d45af4a76330cc3ddcf177a2.zip | |
whitelist ua's
Diffstat (limited to 'routes')
| -rw-r--r-- | routes/users.ts | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/routes/users.ts b/routes/users.ts index 37dd2d7f..4f1cb487 100644 --- a/routes/users.ts +++ b/routes/users.ts @@ -34,6 +34,17 @@ const verifyRecaptcha = async (response, req?) => { const host = req?.headers?.["host"] || ""; if (host.endsWith(".onion")) return true; + // Skip captcha for allowlisted User-Agents (prefix match) + const uaRaw = req?.headers?.["user-agent"] || req?.headers?.["User-Agent"]; + const ua = Array.isArray(uaRaw) ? uaRaw[0] : uaRaw; + if (typeof ua === "string") { + const prefixes = await db.sMembers("nocaptcha_ua"); + const uaLower = ua.toLowerCase(); + if (prefixes.some((p) => uaLower.startsWith(p.toLowerCase()))) { + return true; + } + } + // Check for valid API key to bypass captcha const apiKey = req?.headers?.["x-api-key"]; if (apiKey && (await db.sIsMember("apikeys", apiKey))) { |
