diff options
| author | Adam Soltys <[email protected]> | 2023-01-06 23:02:01 -0800 |
|---|---|---|
| committer | Adam Soltys <[email protected]> | 2023-01-06 23:02:01 -0800 |
| commit | 018732b4544fd95b7f1830db8b43dce26ebec1aa (patch) | |
| tree | 1829685a50906b7f21434e64bfad92d876466697 /lib | |
| parent | 6df7873c907024285504f6ad684ecc1d1f9b7141 (diff) | |
| download | coinos-server-018732b4544fd95b7f1830db8b43dce26ebec1aa.tar.gz coinos-server-018732b4544fd95b7f1830db8b43dce26ebec1aa.zip | |
event endpoint, send uuid with contacts
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/nostr.js | 17 |
1 files changed, 6 insertions, 11 deletions
diff --git a/lib/nostr.js b/lib/nostr.js index 4ee5cb13..e1d2f68e 100644 --- a/lib/nostr.js +++ b/lib/nostr.js @@ -25,7 +25,11 @@ export let coinos; let now = () => Math.round(Date.now() / 1000); let timeouts = {}; -export let q = async (sub, query, timeout = 20000, since = 3600, eager = 200) => +export let q = async ( + sub, + query, + { timeout = 20000, since = 3600, eager = 200 } +) => new Promise(async (r, j) => { let start = Date.now(); let seen = []; @@ -157,16 +161,7 @@ pool.on("event", async (relay, sub, ev) => { coinos.send(ev); } else if (sub.includes("notes")) { let pubkey = sub.split(":")[0]; - ev.user = await getUser(pubkey); - - if (!ev.user.updated) { - relay.subscribe(`${pubkey}:${ev.id}:profile`, { - limit: 1, - kinds: [0], - authors: [pubkey] - }); - } - + if (relay.url === config.relay) console.log(ev) await redis.sAdd(pubkey, ev.id); await redis.set(`ev:${ev.id}`, JSON.stringify(ev)); } |
