From b02ba909998a8a61145eaaaadb3beb1845d4a151 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Sat, 7 Jan 2023 01:36:16 +0000 Subject: quiet --- lib/sockets.js | 2 +- routes/events.js | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/lib/sockets.js b/lib/sockets.js index 82cf3f51..5980304b 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -95,7 +95,7 @@ app.register(async function(app) { return ws.close(code, `bad token ${token}`); let { username, uuid } = jwt.decode(token); if (uuid) user = await getUser(uuid); - username = user.username; + if (user) ({ username } = user); if (!(username || uuid)) throw new Error("Invalid JWT token"); if (!store.sockets[username]) store.sockets[username] = {}; diff --git a/routes/events.js b/routes/events.js index bbdd8891..554be5d8 100644 --- a/routes/events.js +++ b/routes/events.js @@ -3,7 +3,7 @@ import db from "$db"; import redis from "$lib/redis"; import { coinos, pool, q } from "$lib/nostr"; import store from "$lib/store"; -import { wait } from "$lib/utils"; +import { nada, wait } from "$lib/utils"; app.get("/nostr/:pubkey", async (req, res) => { try { @@ -29,12 +29,11 @@ app.get("/nostr/:pubkey", async (req, res) => { q(`${pubkey}:notes`, { kinds: [1], authors: [pubkey] - }).catch(console.log); + }).catch(nada); await redis.set(`user:${pubkey}`, JSON.stringify(user)); let ids = await redis.sMembers(pubkey); - console.log("IDS", ids); let events = ids.length ? (await redis.mGet(ids.map(k => "ev:" + k))).map(JSON.parse) -- cgit v1.2.3