From 7cb3a8db191a0d67b6caccd0aabda15a35015058 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Fri, 6 Feb 2026 22:52:09 -0800 Subject: skip captcha for funds --- src/lib/utils.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'src/lib/utils.ts') diff --git a/src/lib/utils.ts b/src/lib/utils.ts index 92b602d5..efb7b239 100644 --- a/src/lib/utils.ts +++ b/src/lib/utils.ts @@ -170,6 +170,7 @@ export const login = async ( cookies, ip: string, host?: string, + extraHeaders?: Record, ) => { const maxAge = 380 * 24 * 60 * 60; @@ -177,6 +178,7 @@ export const login = async ( "content-type": "application/json", accept: "application/json", "cf-connecting-ip": ip, + ...extraHeaders, }; if (host) headers["x-forwarded-host"] = host; @@ -497,18 +499,23 @@ export const ago = (t) => { return `${days}d`; }; -export const register = async (user, ip, cookies, loginRedirect, host?) => { +export const register = async (user, ip, cookies, loginRedirect, host?, extraHeaders?: Record) => { let error; + const headers: Record = { + ...extraHeaders, + }; + if (ip) headers["cf-connecting-ip"] = ip; + let sk; try { - ({ sk } = await post("/register", { user }, { "cf-connecting-ip": ip })); + ({ sk } = await post("/register", { user }, headers)); } catch (e) { ({ message: error } = e as Error); } try { - await login(user, cookies, ip, host); + await login(user, cookies, ip, host, extraHeaders); error = null; } catch (e) { const { message } = e as Error; -- cgit v1.2.3