diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/components/InvoiceTypes.svelte | 34 | ||||
| -rw-r--r-- | src/lib/parse.ts | 10 | ||||
| -rw-r--r-- | src/routes/(app)/invoice/+page.server.ts | 1 | ||||
| -rw-r--r-- | src/routes/(app)/pay/[username]/[...amount]/+page.server.ts | 1 | ||||
| -rw-r--r-- | src/routes/(app)/send/invoice/[id]/+page.server.ts | 2 |
5 files changed, 21 insertions, 27 deletions
diff --git a/src/components/InvoiceTypes.svelte b/src/components/InvoiceTypes.svelte index 67039bdd..a0a1fc12 100644 --- a/src/components/InvoiceTypes.svelte +++ b/src/components/InvoiceTypes.svelte @@ -24,25 +24,6 @@ <div class="my-auto text-lg">Lightning</div> </button> - <!-- <button --> - <!-- class="btn flex-nowrap" --> - <!-- class:bg-base-300={type === types.bolt12} --> - <!-- class:text-secondary={type === types.bolt12} --> - <!-- onclick={() => setType(types.bolt12)} --> - <!-- > --> - <!-- <div --> - <!-- class="bg-black rounded-full w-8 h-8 items-center justify-center flex" --> - <!-- > --> - <!-- <div class="m-auto"> --> - <!-- <iconify-icon --> - <!-- icon="ph:lightning-fill" --> - <!-- class="text-yellow-300 text-2xl" --> - <!-- ></iconify-icon> --> - <!-- </div> --> - <!-- </div> --> - <!-- <div class="my-auto text-lg">Bolt 12</div> --> - <!-- </button> --> - <button class="btn flex-nowrap" class:bg-base-300={type === types.ecash} @@ -94,6 +75,21 @@ </button> </div> + <button + class="btn flex-nowrap" + class:bg-base-300={type === types.bolt12} + class:text-secondary={type === types.bolt12} + onclick={() => setType(types.bolt12)} + > + <div class="bg-black rounded-full w-8 h-8 items-center justify-center flex"> + <div class="m-auto"> + <iconify-icon icon="ph:lightning-fill" class="text-yellow-300 text-2xl" + ></iconify-icon> + </div> + </div> + <div class="my-auto text-lg">Bolt 12</div> + </button> + {#if type === types.liquid} <div class="flex justify-center"> <div class="my-auto text-xl text-center text-secondary"> 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}`); } } diff --git a/src/routes/(app)/invoice/+page.server.ts b/src/routes/(app)/invoice/+page.server.ts index db68740d..64c49ebc 100644 --- a/src/routes/(app)/invoice/+page.server.ts +++ b/src/routes/(app)/invoice/+page.server.ts @@ -6,6 +6,7 @@ import { error, redirect } from "@sveltejs/kit"; export const load = async ({ cookies, parent }) => { const aid = cookies.get("aid"); let { subject, user } = await parent(); + const rates = await getRates(); if (aid === user.id) redirect(307, `/${user.username}/receive`); diff --git a/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts b/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts index 4c112e67..65665610 100644 --- a/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts +++ b/src/routes/(app)/pay/[username]/[...amount]/+page.server.ts @@ -60,7 +60,6 @@ export const actions = { auth(cookies), )); } catch (e) { - console.log(e); const { message } = e as Error; return fail(400, { message }); } diff --git a/src/routes/(app)/send/invoice/[id]/+page.server.ts b/src/routes/(app)/send/invoice/[id]/+page.server.ts index 4047ed3d..6cacc1c6 100644 --- a/src/routes/(app)/send/invoice/[id]/+page.server.ts +++ b/src/routes/(app)/send/invoice/[id]/+page.server.ts @@ -16,7 +16,7 @@ export async function load({ cookies, params: { id }, parent }) { if (user && invoice.aid === aid) error(500, { message: "Cannot send to self" }); - else if (user && invoice.type !== types.lightning) + else if (user && ![types.lightning, types.bolt12].includes(invoice.type)) redirect(307, `/send/${invoice.type}/${invoice.hash}`); if (!user) redirect(307, `/invoice/${id}`); |
