diff options
| author | Adam Soltys <[email protected]> | 2022-12-28 15:05:56 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-12-28 15:05:56 -0800 |
| commit | 33d8a7d5235281d705bc1ac27113e150b2b9c617 (patch) | |
| tree | 2d37343db785e4d1cfc54fed193c8db545359797 /routes/events.js | |
| parent | 581a905b2fc14240d0bcbe6e2c14023fae3589a4 (diff) | |
| download | coinos-server-33d8a7d5235281d705bc1ac27113e150b2b9c617.tar.gz coinos-server-33d8a7d5235281d705bc1ac27113e150b2b9c617.zip | |
fix follows and followers endpoints
Diffstat (limited to 'routes/events.js')
| -rw-r--r-- | routes/events.js | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/routes/events.js b/routes/events.js index 63189f70..3f42fead 100644 --- a/routes/events.js +++ b/routes/events.js @@ -23,7 +23,7 @@ app.get("/nostr/:pubkey", async (req, res) => { }); } - if (!user) user = { username: pubkey.substr(0, 6), pubkey, anon: true }; + if (!user) user = { username: pubkey.substr(0, 6), pubkey, anon: true, follows: [], followers: [] }; let { since } = user; @@ -33,6 +33,9 @@ app.get("/nostr/:pubkey", async (req, res) => { authors: [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)); |
