diff options
| author | Adam Soltys <[email protected]> | 2023-05-03 17:26:45 +0000 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-05-03 17:26:50 +0000 |
| commit | f695cbd6d1ed9d8560363693c0f3bdcb7c78c7d8 (patch) | |
| tree | 096915c34f6157ef9763c0fe91145ba52dc1fc24 | |
| parent | 1b8f6a552f10a02f1b752ae7ed9920ff40de9edd (diff) | |
| download | coinos-server-f695cbd6d1ed9d8560363693c0f3bdcb7c78c7d8.tar.gz coinos-server-f695cbd6d1ed9d8560363693c0f3bdcb7c78c7d8.zip | |
error handling
| -rw-r--r-- | routes/lnurl.js | 14 | ||||
| -rw-r--r-- | routes/nostr.js | 2 |
2 files changed, 11 insertions, 5 deletions
diff --git a/routes/lnurl.js b/routes/lnurl.js index 5cfb26bb..14f848a4 100644 --- a/routes/lnurl.js +++ b/routes/lnurl.js @@ -34,11 +34,15 @@ export default { }, async decode({ query: { text } }, res) { - let url = Buffer.from( - bech32.fromWords(bech32.decode(text, 20000).words) - ).toString(); + try { + let url = Buffer.from( + bech32.fromWords(bech32.decode(text, 20000).words) + ).toString(); - res.send(await got(url).json()); + res.send(await got(url).json()); + } catch (e) { + bail(res, e.message); + } }, async lnurlp({ params: { username } }, res) { @@ -92,7 +96,7 @@ export default { let uid = await g(`lnurl:${id}`); let user = await g(`user:${uid}`); let { username } = user; - username = username.replace(/\s/g, '').toLowerCase(); + username = username.replace(/\s/g, "").toLowerCase(); let metadata = JSON.stringify([ ["text/plain", `Paying ${username}@${host}`], diff --git a/routes/nostr.js b/routes/nostr.js index 33233a7a..d0b54f1f 100644 --- a/routes/nostr.js +++ b/routes/nostr.js @@ -187,6 +187,8 @@ export default { async identities(req, res) { res.send({ names: { + coinos: + "ba80990666ef0b6f4ba5059347beb13242921e54669e680064ca755256a1e3a6", adam: "566c166f3adab0c8fba5da015b0b3bcc8eb3696b455f2a1d43bfbd97059646a8", asoltys: |
