mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-18 19:23:40 +00:00
Small zap fixes, lengthen delay for onChunk
This commit is contained in:
parent
6714eac7e0
commit
b2f74b7fcd
@ -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
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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('@')
|
||||
|
@ -92,7 +92,6 @@ const user = {
|
||||
canPublish,
|
||||
getProfile: () => profileCopy,
|
||||
getPubkey: () => profileCopy?.pubkey,
|
||||
canZap: () => profileCopy?.zapper,
|
||||
muffle: events => {
|
||||
const muffle = user.getMuffle()
|
||||
|
||||
|
@ -166,6 +166,7 @@ const listen = async pubkey => {
|
||||
}
|
||||
|
||||
listener = await network.listen({
|
||||
delay: 10000,
|
||||
relays: getUserReadRelays(),
|
||||
filter: [
|
||||
{kinds: personKinds, authors: [pubkey], since},
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 @@
|
||||
<i class={cx('fa fa-heart cursor-pointer', {'fa-beat fa-beat-custom': like})} />
|
||||
{$likesCount}
|
||||
</button>
|
||||
<button class="w-20 text-left" class:text-accent={zapped} on:click|stopPropagation={startZap}>
|
||||
<i class={cx("fa fa-bolt cursor-pointer", {'pointer-events-none opacity-50': !canZap})} />
|
||||
<button
|
||||
class={cx("w-20 text-left", {'pointer-events-none opacity-50': !canZap})}
|
||||
class:text-accent={zapped}
|
||||
on:click|stopPropagation={startZap}>
|
||||
<i class="fa fa-bolt cursor-pointer" />
|
||||
{formatSats($zapsTotal)}
|
||||
</button>
|
||||
<button class="w-16 text-left" on:click|stopPropagation={() => react("-")}>
|
||||
|
Loading…
Reference in New Issue
Block a user