aboutsummaryrefslogtreecommitdiffstats
path: root/src/lib/utils.ts
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2026-02-06 22:52:09 -0800
committerAdam Soltys <[email protected]>2026-02-06 22:52:09 -0800
commit7cb3a8db191a0d67b6caccd0aabda15a35015058 (patch)
tree7f7fe79cb93c0a5bd3a2dd9138d0e72f5f804103 /src/lib/utils.ts
parent3a27ae85e5167c0745a28061d03c7cd9c4f52230 (diff)
downloadcoinos-ui-7cb3a8db191a0d67b6caccd0aabda15a35015058.tar.gz
coinos-ui-7cb3a8db191a0d67b6caccd0aabda15a35015058.zip
skip captcha for funds
Diffstat (limited to 'src/lib/utils.ts')
-rw-r--r--src/lib/utils.ts13
1 files changed, 10 insertions, 3 deletions
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<string, string>,
) => {
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<string, string>) => {
let error;
+ const headers: Record<string, string> = {
+ ...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;