aboutsummaryrefslogtreecommitdiffstats
path: root/routes
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2023-12-29 10:11:25 +0000
committerAdam Soltys <[email protected]>2023-12-29 10:12:10 +0000
commitc474dbb763480ec923cd49f5cac0e07a310552a7 (patch)
tree7376dece597eaea7999e732f83b44cfdfe521c1c /routes
parent46522875683db9123f8a6fe9746a5c5db6f1638e (diff)
downloadcoinos-server-c474dbb763480ec923cd49f5cac0e07a310552a7.tar.gz
coinos-server-c474dbb763480ec923cd49f5cac0e07a310552a7.zip
error handling
Diffstat (limited to 'routes')
-rw-r--r--routes/lnurl.js1
-rw-r--r--routes/nostr.js6
2 files changed, 6 insertions, 1 deletions
diff --git a/routes/lnurl.js b/routes/lnurl.js
index 79bac995..81a74991 100644
--- a/routes/lnurl.js
+++ b/routes/lnurl.js
@@ -78,6 +78,7 @@ export default {
async lnurl({ params: { id }, query: { amount, nostr } }, res) {
let uid = await g(`lnurl:${id}`);
let user = await g(`user:${uid}`);
+ if (!user) user = await migrate(uid);
let { username } = user;
username = username.replace(/\s/g, "").toLowerCase();
diff --git a/routes/nostr.js b/routes/nostr.js
index 990317a9..2137150e 100644
--- a/routes/nostr.js
+++ b/routes/nostr.js
@@ -94,6 +94,7 @@ export default {
},
async follows({ params: { pubkey }, query: { tagsonly } }, res) {
+ try {
let sub = `${pubkey}:follows`,
params = {
limit: 1,
@@ -131,9 +132,12 @@ export default {
}
follows = uniq(follows, (e) => e.pubkey);
- follows.sort((a, b) => a.username.localeCompare(b.username));
+ follows.sort((a, b) => a.username && a.username.localeCompare(b.username));
res.send(follows);
+ } catch(e) {
+ bail(res, e.message);
+ }
},
async followers({ params: { pubkey } }, res) {