From 0ce3367bedf79c7b93009489963de7609336a965 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 18 Sep 2025 15:01:06 -0700 Subject: pass cookies to parse --- src/lib/parse.ts | 6 +++--- src/routes/(app)/receive/[...token]/+page.server.ts | 10 +++++----- src/routes/(app)/send/[...text]/+page.server.ts | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) (limited to 'src') 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" }); }, }; -- cgit v1.2.3