aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-09-18 15:01:06 -0700
committerAdam Soltys <[email protected]>2025-09-18 15:01:06 -0700
commit0ce3367bedf79c7b93009489963de7609336a965 (patch)
treecd6f959f521d602aded37f632fab8b587989681e
parent8ce8e2ed32cd8e9f8137c5b05e716c51822d1b3c (diff)
downloadcoinos-ui-0ce3367bedf79c7b93009489963de7609336a965.tar.gz
coinos-ui-0ce3367bedf79c7b93009489963de7609336a965.zip
pass cookies to parse
-rw-r--r--src/lib/parse.ts6
-rw-r--r--src/routes/(app)/receive/[...token]/+page.server.ts10
-rw-r--r--src/routes/(app)/send/[...text]/+page.server.ts6
3 files changed, 11 insertions, 11 deletions
diff --git a/src/lib/parse.ts b/src/lib/parse.ts
index e350c1ab..6ff4556c 100644
--- a/src/lib/parse.ts
+++ b/src/lib/parse.ts
@@ -1,10 +1,10 @@
import { PUBLIC_DOMAIN } from "$env/static/public";
import { decode } from "$lib/bip21";
-import { get, isLiquid, post, sats } from "$lib/utils";
+import { auth, get, isLiquid, post, sats } from "$lib/utils";
import { redirect } from "@sveltejs/kit";
import { validate } from "bitcoin-address-validation";
-export default async (s, host) => {
+export default async (s, host, cookies) => {
if (!s) return;
let t = s.trim();
let amount;
@@ -59,7 +59,7 @@ export default async (s, host) => {
if (t.includes(":")) t = t.split(":")[1];
if (t.toLowerCase().startsWith("lnr")) {
- const { iid } = await post("/sendinvoice", { invstring: t });
+ const { iid } = await post("/sendinvoice", { invreq: t }, auth(cookies));
invoice = { id: iid };
} else if (t.toLowerCase().startsWith("ln")) {
try {
diff --git a/src/routes/(app)/receive/[...token]/+page.server.ts b/src/routes/(app)/receive/[...token]/+page.server.ts
index 05b2dad8..052d507f 100644
--- a/src/routes/(app)/receive/[...token]/+page.server.ts
+++ b/src/routes/(app)/receive/[...token]/+page.server.ts
@@ -1,17 +1,17 @@
+import parse from "$lib/parse";
import { fd } from "$lib/utils";
import { fail, redirect } from "@sveltejs/kit";
-import parse from "$lib/parse";
-export async function load({ params, parent, url }) {
+export async function load({ cookies, params, parent, url }) {
const { user } = await parent();
if (!user) redirect(307, `/register?redirect=${url.pathname}`);
- await parse(params.token, url.host);
+ await parse(params.token, url.host, cookies);
}
export const actions = {
- default: async ({ request, url }) => {
+ default: async ({ cookies, request, url }) => {
const { text } = await fd(request);
- await parse(text, url.host);
+ await parse(text, url.host, cookies);
return fail(400, { error: "default" });
},
};
diff --git a/src/routes/(app)/send/[...text]/+page.server.ts b/src/routes/(app)/send/[...text]/+page.server.ts
index 9f0891d9..59d53dbe 100644
--- a/src/routes/(app)/send/[...text]/+page.server.ts
+++ b/src/routes/(app)/send/[...text]/+page.server.ts
@@ -9,16 +9,16 @@ export async function load({ cookies, depends, params, parent, url }) {
if (!user) redirect(307, "/login");
const { text } = params;
- await parse(text, url.host);
+ await parse(text, url.host, cookies);
const contacts = await get(`/contacts/${limit}`, auth(cookies));
return { contacts };
}
export const actions = {
- default: async ({ request, url }) => {
+ default: async ({ cookies, request, url }) => {
const { text } = await fd(request);
- await parse(text, url.host);
+ await parse(text, url.host, cookies);
return fail(400, { error: "default" });
},
};