diff --git a/ROADMAP.md b/ROADMAP.md index 83d29eb6..3bdad007 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -2,6 +2,7 @@ - [ ] Collapse relaycard and relaycardsimple? +- [ ] Review sampleRelays, seems like we shouldn't be shuffling - [ ] Go over onboarding process, suggest some good relays for newcomers - [ ] Submit blog post with new onboarding process built in - [ ] Fix hover on notes in modal diff --git a/src/agent/network.ts b/src/agent/network.ts index 129aa2f3..21f0c614 100644 --- a/src/agent/network.ts +++ b/src/agent/network.ts @@ -21,11 +21,11 @@ const getStalePubkeys = pubkeys => { }) } -const listen = ({relays, filter, onChunk = null, shouldProcess = true}) => { +const listen = ({relays, filter, onChunk = null, shouldProcess = true, delay = 500}) => { return pool.subscribe({ filter, relays, - onEvent: batch(300, chunk => { + onEvent: batch(delay, chunk => { if (shouldProcess) { sync.processEvents(chunk) } diff --git a/src/agent/sync.ts b/src/agent/sync.ts index b5c43535..ac0acc2a 100644 --- a/src/agent/sync.ts +++ b/src/agent/sync.ts @@ -41,13 +41,15 @@ const processProfileEvents = async events => { 0: () => tryJson(() => { const kind0 = JSON.parse(e.content) - if (e.created_at > (person.kind0_updated_at || 0)) { + if (e.created_at >= (person.kind0_updated_at || 0)) { if (kind0.nip05) { verifyNip05(e.pubkey, kind0.nip05) } - if (kind0.lud16 || kind0.lud06) { - verifyZapper(e.pubkey, kind0.lud16 || kind0.lud06) + const address = kind0.lud16 || kind0.lud06 + + if (address) { + verifyZapper(e.pubkey, address) } return { @@ -310,7 +312,7 @@ const verifyZapper = async (pubkey, address) => { let url // Try to parse it as a lud06 LNURL or as a lud16 address - if (address.startsWith('lnurl1')) { + if (address.toLowerCase().startsWith('lnurl1')) { url = lnurlDecode(address) } else if (address.includes('@')) { const [name, domain] = address.split('@') diff --git a/src/agent/user.ts b/src/agent/user.ts index 38566f22..45ad55c5 100644 --- a/src/agent/user.ts +++ b/src/agent/user.ts @@ -92,7 +92,6 @@ const user = { canPublish, getProfile: () => profileCopy, getPubkey: () => profileCopy?.pubkey, - canZap: () => profileCopy?.zapper, muffle: events => { const muffle = user.getMuffle() diff --git a/src/app/alerts.ts b/src/app/alerts.ts index ff2d4844..702e08f9 100644 --- a/src/app/alerts.ts +++ b/src/app/alerts.ts @@ -166,6 +166,7 @@ const listen = async pubkey => { } listener = await network.listen({ + delay: 10000, relays: getUserReadRelays(), filter: [ {kinds: personKinds, authors: [pubkey], since}, diff --git a/src/app/index.ts b/src/app/index.ts index 7223ff4b..5de713ff 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -2,7 +2,6 @@ import type {DisplayEvent} from 'src/util/types' import {omit, sortBy} from 'ramda' import {createMap, ellipsize} from 'hurdak/lib/hurdak' import {renderContent} from 'src/util/html' -import {sleep} from 'src/util/misc' import {displayPerson, findReplyId} from 'src/util/nostr' import {getUserFollows} from 'src/agent/social' import {getUserReadRelays} from 'src/agent/relays' @@ -14,13 +13,11 @@ import {routes, modal, toast} from 'src/app/ui' export const loadAppData = async pubkey => { if (getUserReadRelays().length > 0) { - // Delay since this gets in the way of quickly loading feeds very often - await sleep(5000) + // Start our listener, but don't wait for it + alerts.listen(pubkey) - await Promise.all([ - alerts.listen(pubkey), - network.loadPeople(getUserFollows()), - ]) + // Make sure the user's network is loaded + await network.loadPeople(getUserFollows()) } } diff --git a/src/views/notes/Note.svelte b/src/views/notes/Note.svelte index 0dee3ede..17193f7e 100644 --- a/src/views/notes/Note.svelte +++ b/src/views/notes/Note.svelte @@ -121,7 +121,7 @@ $: $zapsTotal = sum(zaps.map(zap => zap.invoiceAmount)) / 1000 $: $repliesCount = note.replies.length $: visibleNotes = note.replies.filter(r => showContext ? true : !r.isContext) - $: canZap = $person?.zapper && user.canZap() + $: canZap = $person?.zapper const onClick = e => { const target = e.target as HTMLElement @@ -405,8 +405,11 @@ {$likesCount} -