diff options
| author | Adam Soltys <[email protected]> | 2022-12-29 08:56:43 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-12-29 08:56:43 -0800 |
| commit | 43d11679dda199924632e7c1825b6cdbc7fd5387 (patch) | |
| tree | e0864420a3f4aec906e87103ca121ba0862f9312 | |
| parent | 33d8a7d5235281d705bc1ac27113e150b2b9c617 (diff) | |
| download | coinos-server-43d11679dda199924632e7c1825b6cdbc7fd5387.tar.gz coinos-server-43d11679dda199924632e7c1825b6cdbc7fd5387.zip | |
prettier
| -rw-r--r-- | lib/utils.js | 1 | ||||
| -rw-r--r-- | routes/events.js | 22 |
2 files changed, 16 insertions, 7 deletions
diff --git a/lib/utils.js b/lib/utils.js index 5355cc2c..133be3c6 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -10,7 +10,6 @@ import lnd from "$lib/lnd"; import ln from "$lib/ln"; import { coinos } from "$lib/nostr"; - const { Op } = sequelize; export const sleep = n => new Promise(r => setTimeout(r, n)); diff --git a/routes/events.js b/routes/events.js index 3f42fead..074579b0 100644 --- a/routes/events.js +++ b/routes/events.js @@ -23,7 +23,14 @@ app.get("/nostr/:pubkey", async (req, res) => { }); } - if (!user) user = { username: pubkey.substr(0, 6), pubkey, anon: true, follows: [], followers: [] }; + if (!user) + user = { + username: pubkey.substr(0, 6), + pubkey, + anon: true, + follows: [], + followers: [] + }; let { since } = user; @@ -33,8 +40,11 @@ app.get("/nostr/:pubkey", async (req, res) => { authors: [pubkey] }); - coinos.subscribe(`${pubkey}:followers`, { since, kinds: [3], "#p": [pubkey] }); - + coinos.subscribe(`${pubkey}:followers`, { + since, + kinds: [3], + "#p": [pubkey] + }); user.since = Math.round(Date.now() / 1000); await redis.set(`user:${pubkey}`, JSON.stringify(user)); @@ -42,9 +52,9 @@ app.get("/nostr/:pubkey", async (req, res) => { await wait(() => !store.fetching[pubkey], 100, 100); let ids = await redis.sMembers(pubkey); - let events = ids.length ? ( - await redis.mGet((ids).map(k => "ev:" + k)) - ).map(JSON.parse) : []; + let events = ids.length + ? (await redis.mGet(ids.map(k => "ev:" + k))).map(JSON.parse) + : []; res.send(events); } catch (e) { |
