From 7611315ae6de9bf9592bfd65d841aa2b33d06e57 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Tue, 31 Jan 2023 23:11:49 -0800 Subject: classic payments --- src/routes/(app)/send/[...text]/+page.server.js | 5 +++++ src/routes/(app)/send/[uuid=uuid]/+page.server.js | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'src/routes/(app)/send') diff --git a/src/routes/(app)/send/[...text]/+page.server.js b/src/routes/(app)/send/[...text]/+page.server.js index 8e5e02d7..3d25ed7e 100644 --- a/src/routes/(app)/send/[...text]/+page.server.js +++ b/src/routes/(app)/send/[...text]/+page.server.js @@ -21,6 +21,11 @@ let parse = async (t, host) => { } catch (e) {} } + if (t.endsWith('@classic')) { + ({ uuid: id } = await get(`/invoice/classic/${t.replace('@classic', '')}`)); + if (id) throw redirect(307, `/send/${id}`); + } + if (t.includes('/pot')) throw redirect(307, t.substring(t.indexOf('/pot'))); if (t.toLowerCase().startsWith('lnurl')) throw redirect(307, `/ln/${t}`); diff --git a/src/routes/(app)/send/[uuid=uuid]/+page.server.js b/src/routes/(app)/send/[uuid=uuid]/+page.server.js index 7fa613bf..a59853d3 100644 --- a/src/routes/(app)/send/[uuid=uuid]/+page.server.js +++ b/src/routes/(app)/send/[uuid=uuid]/+page.server.js @@ -4,7 +4,7 @@ import { btc as asset, auth, get, post } from '$lib/utils'; export async function load({ params, parent }) { let { user } = await parent(); - let { amount, address, tip, text, user: recipient } = await get(`/invoice/${params.id}`); + let { amount, address, tip, text, user: recipient } = await get(`/invoice/${params.uuid}`); if (recipient.username === user.username) throw error(500, { message: 'Cannot send to self' }); if (tip) amount += tip; return { amount, address, payreq: text, recipient }; -- cgit v1.2.3