From 5c46fe3126d40f2798ed5bb106c8a0e560b27d86 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 19 Dec 2024 14:12:56 -0800 Subject: bolt 12 --- src/lib/parse.ts | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'src/lib/parse.ts') diff --git a/src/lib/parse.ts b/src/lib/parse.ts index 7ddb2104..309e53d7 100644 --- a/src/lib/parse.ts +++ b/src/lib/parse.ts @@ -44,12 +44,6 @@ export default async (s, host) => { if (t.toLowerCase().startsWith("lnurl")) redirect(307, `/ln/${t}`); if (t.includes(":")) t = t.split(":")[1]; - if (t.toLowerCase().startsWith("lno")) { - const { offer_amount_msat: a } = await get(`/decode/${t}`); - if (a) ({ invoice: t } = await post("/fetchinvoice", { offer: t })); - redirect(307, `/send/lightning/${t}`); - } - if (t.includes("lightning=")) { const url = new URL(t); const params = new URLSearchParams(url.search); @@ -60,6 +54,10 @@ export default async (s, host) => { try { await get(`/invoice/${t}`); } catch (e) { + if (t.toLowerCase().startsWith("lno")) { + const { offer_amount_msat: a } = await get(`/decode/${t}`); + if (a) ({ invoice: t } = await post("/fetchinvoice", { offer: t })); + } redirect(307, `/send/lightning/${t}`); } } -- cgit v1.2.3