diff options
| author | Adam Soltys <[email protected]> | 2022-12-22 13:42:00 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2022-12-22 13:42:00 -0800 |
| commit | a487b5a2b80d270771f9932c17d2b6babf0fd49a (patch) | |
| tree | 86d2b894f33d383012752e0a1bd01744f2548fb3 /routes/events.js | |
| parent | 728ac80f9cc8a3268bdced6339f58936bd69648b (diff) | |
| download | coinos-server-a487b5a2b80d270771f9932c17d2b6babf0fd49a.tar.gz coinos-server-a487b5a2b80d270771f9932c17d2b6babf0fd49a.zip | |
return mock user objects for anon pubkeys
Diffstat (limited to 'routes/events.js')
| -rw-r--r-- | routes/events.js | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/routes/events.js b/routes/events.js index 18abf1d7..07062140 100644 --- a/routes/events.js +++ b/routes/events.js @@ -1,4 +1,5 @@ import app from "$app"; +import db from "$db"; import redis from "$lib/redis"; import { pool } from "$lib/nostr"; import store from "$lib/store"; @@ -13,6 +14,13 @@ app.get("/:pubkey/events", async (req, res) => { 500 ); + let user = await db.User.findOne({ + where: { pubkey } + }); + + if (!user) user = { username: pubkey.substr(0,6), pubkey, anon: true } + await redis.set(`user:${pubkey}`, JSON.stringify(user)); + pool.subscribe(pubkey, { limit: 500, kinds: [1], |
