aboutsummaryrefslogtreecommitdiffstats
path: root/src/routes/(app)/ln
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2025-07-19 08:41:49 -0700
committerAdam Soltys <[email protected]>2025-07-19 08:41:49 -0700
commitfea147df07046f240e77075e7c743959d85b1271 (patch)
treeaeb578df4777ea0b74c06b3141ffd4ba0b5b4a1c /src/routes/(app)/ln
parentf063e6a88999f1fe4d9ed2900b90efba1bcf1ac5 (diff)
downloadcoinos-ui-fea147df07046f240e77075e7c743959d85b1271.tar.gz
coinos-ui-fea147df07046f240e77075e7c743959d85b1271.zip
handle tipping for lnurls, sweep fixes
Diffstat (limited to 'src/routes/(app)/ln')
-rw-r--r--src/routes/(app)/ln/[lnurl]/+page.server.ts28
1 files changed, 16 insertions, 12 deletions
diff --git a/src/routes/(app)/ln/[lnurl]/+page.server.ts b/src/routes/(app)/ln/[lnurl]/+page.server.ts
index 1ee182b1..b77a84e7 100644
--- a/src/routes/(app)/ln/[lnurl]/+page.server.ts
+++ b/src/routes/(app)/ln/[lnurl]/+page.server.ts
@@ -23,17 +23,17 @@ export async function load({ params, parent }) {
}
let { callback, minSendable, maxSendable, comment, tag } = data;
- if (callback.includes(PUBLIC_DOMAIN)) {
- const username = url.split(`https://${PUBLIC_DOMAIN}/p/`)[1];
- // const inv = await post("/invoice", {
- // invoice: { type: types.lightning, amount: minSendable / 1000 },
- // user: { username },
- // });
- // const { id: iid } = inv;
- let redir = `/pay/${username}`;
- if (minSendable === maxSendable && minSendable > 0) redir += `/${minSendable / 1000}`;
- redirect(307, redir);
- }
+ // if (callback.includes(PUBLIC_DOMAIN)) {
+ // const username = url.split(`https://${PUBLIC_DOMAIN}/p/`)[1];
+ // // const inv = await post("/invoice", {
+ // // invoice: { type: types.lightning, amount: minSendable / 1000 },
+ // // user: { username },
+ // // });
+ // // const { id: iid } = inv;
+ // let redir = `/pay/${username}`;
+ // if (minSendable === maxSendable && minSendable > 0) redir += `/${minSendable / 1000}`;
+ // redirect(307, redir);
+ // }
if (tag === "payRequest" && minSendable === maxSendable) {
minSendable = Math.round(minSendable / 1000);
maxSendable = Math.round(maxSendable / 1000);
@@ -43,7 +43,10 @@ export async function load({ params, parent }) {
if (comment) url += `&comment=${comment}`;
const { pr } = await fetch(url).then((r) => (r as Response).json());
- console.log("PR", pr);
+
+ const invoice = await get(`/invoice/${pr}`);
+ if (invoice) redirect(307, `/invoice/${invoice.id}`);
+
let path = `/send/lightning/${pr}`;
if (comment) path += `/${encodeURIComponent(comment)}`;
redirect(307, path);
@@ -75,6 +78,7 @@ export const actions = {
if (comment) url += `&comment=${comment}`;
const { pr } = await fetch(url).then((r) => r.json());
+
let path = `/send/lightning/${pr}`;
if (comment) path += `/${encodeURIComponent(comment)}`;
redirect(307, path);