From f695cbd6d1ed9d8560363693c0f3bdcb7c78c7d8 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Wed, 3 May 2023 17:26:45 +0000 Subject: error handling --- routes/lnurl.js | 14 +++++++++----- 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: -- cgit v1.2.3