diff options
| author | Adam Soltys <[email protected]> | 2025-07-19 22:56:05 -0700 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2025-07-19 22:56:05 -0700 |
| commit | 476418f9711ac91760a9ca279a6e671d88e70fc3 (patch) | |
| tree | 42bcd2dbf4fb8977baad89a6089924e097a0d921 /src/routes/(app)/ln | |
| parent | d87ecae6ee46af4790e1f57cd5d82a35ab29e646 (diff) | |
| download | coinos-ui-476418f9711ac91760a9ca279a6e671d88e70fc3.tar.gz coinos-ui-476418f9711ac91760a9ca279a6e671d88e70fc3.zip | |
handle null tips
Diffstat (limited to 'src/routes/(app)/ln')
| -rw-r--r-- | src/routes/(app)/ln/[lnurl]/+page.server.ts | 16 |
1 files changed, 4 insertions, 12 deletions
diff --git a/src/routes/(app)/ln/[lnurl]/+page.server.ts b/src/routes/(app)/ln/[lnurl]/+page.server.ts index b77a84e7..84aa415e 100644 --- a/src/routes/(app)/ln/[lnurl]/+page.server.ts +++ b/src/routes/(app)/ln/[lnurl]/+page.server.ts @@ -1,6 +1,6 @@ import { PUBLIC_DOMAIN } from "$env/static/public"; import getRates from "$lib/rates"; -import { auth, fd, get, post, types } from "$lib/utils"; +import { auth, fd, get, post } from "$lib/utils"; import { bech32 } from "@scure/base"; import { error, fail, redirect } from "@sveltejs/kit"; const { decode, fromWords } = bech32; @@ -23,17 +23,6 @@ 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 (tag === "payRequest" && minSendable === maxSendable) { minSendable = Math.round(minSendable / 1000); maxSendable = Math.round(maxSendable / 1000); @@ -50,6 +39,9 @@ export async function load({ params, parent }) { let path = `/send/lightning/${pr}`; if (comment) path += `/${encodeURIComponent(comment)}`; redirect(307, path); + } else if (callback.includes(PUBLIC_DOMAIN)) { + const username = url.split(`https://${PUBLIC_DOMAIN}/p/`)[1]; + redirect(307, `/pay/${username}`); } if (!["payRequest", "withdrawRequest"].includes(data.tag)) |
