From d87ecae6ee46af4790e1f57cd5d82a35ab29e646 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 19 Jul 2025 17:59:56 -0700 Subject: prompt for tip for auto pays --- src/lib/parse.ts | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'src/lib') diff --git a/src/lib/parse.ts b/src/lib/parse.ts index ba264be7..f6405e4a 100644 --- a/src/lib/parse.ts +++ b/src/lib/parse.ts @@ -57,10 +57,11 @@ export default async (s, host) => { t = params.get("lightning"); } + let invoice; if (t.toLowerCase().startsWith("ln")) { try { - const inv = await get(`/invoice/${t}`); - if (inv.user.username === "mint") throw new Error("mint payment"); + invoice = await get(`/invoice/${t}`); + if (invoice.user.username === "mint") throw new Error("mint payment"); } catch (e) { if (t.toLowerCase().startsWith("lno")) { const { offer_amount_msat: a } = await get(`/decode/${t}`); @@ -115,11 +116,9 @@ export default async (s, host) => { if (fund) redirect(307, `/send/fund/${t}`); - // invoice - let invoice; try { - invoice = await get(`/invoice/${t}`); + invoice ||= await get(`/invoice/${t}`); } catch (e) {} - if (invoice) redirect(307, `/send/invoice/${invoice.id}`); + if (invoice) redirect(307, `/invoice/${invoice.id}`); }; -- cgit v1.2.3