diff options
| author | Adam Soltys <[email protected]> | 2023-11-30 15:34:45 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-11-30 15:34:45 -0800 |
| commit | a7322928c45848cfb9984454bf8ece6e3439c673 (patch) | |
| tree | 9b1031c31ee1f8160306ac66749afe0802f8aa54 /routes/lnurl.js | |
| parent | acb93f29e83b35c0917d88ebbc62812e2dff989f (diff) | |
| download | coinos-server-a7322928c45848cfb9984454bf8ece6e3439c673.tar.gz coinos-server-a7322928c45848cfb9984454bf8ece6e3439c673.zip | |
zaps and emails
Diffstat (limited to 'routes/lnurl.js')
| -rw-r--r-- | routes/lnurl.js | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/routes/lnurl.js b/routes/lnurl.js index 6567f0b7..0f760695 100644 --- a/routes/lnurl.js +++ b/routes/lnurl.js @@ -47,7 +47,7 @@ export default { async lnurlp({ params: { username } }, res) { try { - let { id: uid } = await getUser(username); + let { id: uid, pubkey: nostrPubkey } = await getUser(username); let metadata = JSON.stringify([ ["text/plain", `Paying ${username}@${host}`], @@ -58,9 +58,11 @@ export default { await s(`lnurl:${id}`, uid); res.send({ + allowsNostr: true, minSendable: 1000, maxSendable: 100000000000, metadata, + nostrPubkey, callback: `${URL}/api/lnurl/${id}`, tag: "payRequest" }); @@ -72,12 +74,22 @@ export default { async lnurlw({ params: { k1, pr } }, res) {}, - async lnurl({ params: { id }, query: { amount } }, res) { + async lnurl({ params: { id }, query: { amount, nostr } }, res) { let uid = await g(`lnurl:${id}`); let user = await g(`user:${uid}`); let { username } = user; username = username.replace(/\s/g, "").toLowerCase(); + if (nostr) { + try { + let event = JSON.parse(decodeURIComponent(nostr)); + // TODO: validate the event + await s(`zap:${id}`, event); + } catch (e) { + err("problem handling zap", e.message); + } + } + let metadata = JSON.stringify([ ["text/plain", `Paying ${username}@${host}`], ["text/identifier", `${username}@${host}`] |
