aboutsummaryrefslogtreecommitdiffstats
path: root/routes/events.js
diff options
context:
space:
mode:
authorAdam Soltys <[email protected]>2022-12-28 15:05:56 -0800
committerAdam Soltys <[email protected]>2022-12-28 15:05:56 -0800
commit33d8a7d5235281d705bc1ac27113e150b2b9c617 (patch)
tree2d37343db785e4d1cfc54fed193c8db545359797 /routes/events.js
parent581a905b2fc14240d0bcbe6e2c14023fae3589a4 (diff)
downloadcoinos-server-33d8a7d5235281d705bc1ac27113e150b2b9c617.tar.gz
coinos-server-33d8a7d5235281d705bc1ac27113e150b2b9c617.zip
fix follows and followers endpoints
Diffstat (limited to 'routes/events.js')
-rw-r--r--routes/events.js5
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));