From 9bf9c7151be64317ec5b8b43fb41064e62dc743a Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Mon, 14 Oct 2024 15:37:09 -0700 Subject: support lnurl comments --- src/routes/(app)/ln/[lnurl]/+page.server.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/routes') diff --git a/src/routes/(app)/ln/[lnurl]/+page.server.ts b/src/routes/(app)/ln/[lnurl]/+page.server.ts index c078ae8e..0caadfc0 100644 --- a/src/routes/(app)/ln/[lnurl]/+page.server.ts +++ b/src/routes/(app)/ln/[lnurl]/+page.server.ts @@ -24,7 +24,7 @@ export const actions = { pay: async ({ fetch, request }) => { let error; - let { callback, amount, minSendable, maxSendable } = await fd(request); + let { callback, amount, minSendable, maxSendable, comment } = await fd(request); minSendable = Math.round(minSendable / 1000); maxSendable = Math.round(maxSendable / 1000); @@ -34,9 +34,10 @@ export const actions = { error = `Amount must be at most ${maxSendable} sats`; if (error) return fail(400, { error }); - let { pr } = await fetch(`${callback}?amount=${amount * 1000}`).then((r) => - r.json() - ); + let url = `${callback}?amount=${amount * 1000}`; + + if (comment) url += `&comment=${comment}`; + let { pr } = await fetch(url).then((r) => r.json()); redirect(307, `/send/lightning/${pr}`); }, -- cgit v1.2.3