mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-30 00:41:12 +00:00
Add changelog, wait for only some relays to eose
This commit is contained in:
parent
fd3f8ec4f6
commit
4a47ea2dc9
17
README.md
17
README.md
@ -30,12 +30,21 @@ If you like Coracle and want to support its development, you can donate sats via
|
|||||||
- [ ] With link/image previews, remove the url from the note body if it's on a separate last line
|
- [ ] With link/image previews, remove the url from the note body if it's on a separate last line
|
||||||
- [ ] Stack views so scroll position isn't lost on navigation
|
- [ ] Stack views so scroll position isn't lost on navigation
|
||||||
- [ ] Add notification for slow relays
|
- [ ] Add notification for slow relays
|
||||||
- [ ] Wait for 60% or so of relays to eose to balance completeness with speed
|
- [ ] Parent notes are having a hard time loading
|
||||||
- [ ] Add a CSP, check for XSS in image urls
|
|
||||||
|
|
||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
## 0.2.0
|
## 0.2.0
|
||||||
|
|
||||||
- [x] Completely re-worked data synchronization layer, moving from naive just-in-time requests to background listeners and a local copy stored in dexie. Events and tags, but not people are deleted from the database on logout, and old events are periodically purged.
|
- [x] Completely re-worked data synchronization layer, moving from naive just-in-time requests to background listeners, loaders, and a local copy stored in dexie. Events and tags, but not people are deleted from the database on logout, and old events are periodically purged.
|
||||||
- [x]
|
- [x] Added alert badge and page.
|
||||||
|
- [x] Improved relay page. Suggestions are now taken from
|
||||||
|
- [x] Removed chat to keep scope of work smaller. Let me know if you'd like to see that come back.
|
||||||
|
- [x] Split tabs out into separate components
|
||||||
|
- [x] Removed dispatch, added cmd instead
|
||||||
|
- [x] Added image previews in addition to link previews
|
||||||
|
- [x] Fixed infinite scrolling
|
||||||
|
- [x] Removed cursor/listener abstractions
|
||||||
|
- [x] Added some default pubkeys
|
||||||
|
- [x] Wait for some, not all relays to send eose to keep things fast
|
||||||
|
- [x] General refactoring and bugfixing
|
||||||
|
@ -60,7 +60,9 @@
|
|||||||
settings.set($settings)
|
settings.set($settings)
|
||||||
|
|
||||||
// do a hard refresh so everything gets totally cleared
|
// do a hard refresh so everything gets totally cleared
|
||||||
window.location = '/login'
|
setTimeout(() => {
|
||||||
|
window.location = '/login'
|
||||||
|
}, 100)
|
||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
|
@ -35,11 +35,6 @@ const createReply = (content, e) =>
|
|||||||
|
|
||||||
const deleteEvent = ids => publishEvent(5, '', ids.map(id => t("e", id)))
|
const deleteEvent = ids => publishEvent(5, '', ids.map(id => t("e", id)))
|
||||||
|
|
||||||
export default {
|
|
||||||
updateUser, addPetname, removePetname, muffle, createRoom, updateRoom, createMessage, createNote,
|
|
||||||
createReaction, createReply, deleteEvent,
|
|
||||||
}
|
|
||||||
|
|
||||||
// utils
|
// utils
|
||||||
|
|
||||||
const copyTags = (e, newTags = []) => {
|
const copyTags = (e, newTags = []) => {
|
||||||
@ -76,3 +71,8 @@ const publishEvent = async (...args) => {
|
|||||||
|
|
||||||
return event
|
return event
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export default {
|
||||||
|
updateUser, addPetname, removePetname, muffle, createRoom, updateRoom, createMessage, createNote,
|
||||||
|
createReaction, createReply, deleteEvent, publishEvent,
|
||||||
|
}
|
||||||
|
@ -22,19 +22,28 @@ class Channel {
|
|||||||
this.status = 'idle'
|
this.status = 'idle'
|
||||||
}
|
}
|
||||||
sub(filter, onEvent, onEose = noop, opts = {}) {
|
sub(filter, onEvent, onEose = noop, opts = {}) {
|
||||||
|
const relays = Object.keys(pool.relays)
|
||||||
|
|
||||||
// If we don't have any relays, we'll wait forever for an eose, but
|
// If we don't have any relays, we'll wait forever for an eose, but
|
||||||
// we already know we're done. Use a timeout since callers are
|
// we already know we're done. Use a timeout since callers are
|
||||||
// expecting this to be async and we run into errors otherwise.
|
// expecting this to be async and we run into errors otherwise.
|
||||||
if (Object.keys(pool.relays).length === 0) {
|
if (relays.length === 0) {
|
||||||
setTimeout(onEose)
|
setTimeout(onEose)
|
||||||
|
|
||||||
return {unsub: noop}
|
return {unsub: noop}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Start our subscription, wait for only one relay to eose before
|
// Start our subscription, wait for only our fastest relays to eose before calling it done.
|
||||||
// calling it done. We were waiting for all before, but that made
|
// We were waiting for all before, but that made the slowest relay a bottleneck. Waiting for
|
||||||
// the slowest relay a bottleneck
|
// only one meant we might be settling for very incomplete data
|
||||||
const sub = pool.sub({filter, cb: onEvent}, this.name, onEose)
|
const eoseRelays = []
|
||||||
|
const sub = pool.sub({filter, cb: onEvent}, this.name, r => {
|
||||||
|
eoseRelays.push(r)
|
||||||
|
|
||||||
|
if (eoseRelays.length >= relays.length - 2) {
|
||||||
|
onEose()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
const done = () => {
|
const done = () => {
|
||||||
if (this.status === 'busy') {
|
if (this.status === 'busy') {
|
||||||
@ -184,11 +193,12 @@ const syncNetwork = async () => {
|
|||||||
// Fall back to some pubkeys we like so we can support new users
|
// Fall back to some pubkeys we like so we can support new users
|
||||||
if (pubkeys.length === 0) {
|
if (pubkeys.length === 0) {
|
||||||
pubkeys = [
|
pubkeys = [
|
||||||
|
"3bf0c63fcb93463407af97a5e5ee64fa883d107ef9e558472c4eb9aaaefa459d", // fiatjaf
|
||||||
|
"32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245", // jb55
|
||||||
"97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322", // hodlbod
|
"97c70a44366a6535c145b333f973ea86dfdc2d7a99da618c40c64705ad98e322", // hodlbod
|
||||||
"472f440f29ef996e92a186b8d320ff180c855903882e59d50de1b8bd5669301e", // Marty Bent
|
"472f440f29ef996e92a186b8d320ff180c855903882e59d50de1b8bd5669301e", // Marty Bent
|
||||||
"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2", // Jack
|
"82341f882b6eabcd2ba7f1ef90aad961cf074af15b9ef44a09f9d2a8fbfbe6a2", // Jack
|
||||||
"85080d3bad70ccdcd7f74c29a44f55bb85cbcd3dd0cbb957da1d215bdb931204", // Preston
|
"85080d3bad70ccdcd7f74c29a44f55bb85cbcd3dd0cbb957da1d215bdb931204", // Preston
|
||||||
"32e1827635450ebb3c5a7d12c1f8e7b2b514439ac10a67eef3d9fd9c5c68e245", // jb55
|
|
||||||
"c4eabae1be3cf657bc1855ee05e69de9f059cb7a059227168b80b89761cbc4e0", // Jack Mallers
|
"c4eabae1be3cf657bc1855ee05e69de9f059cb7a059227168b80b89761cbc4e0", // Jack Mallers
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
|
@ -41,11 +41,15 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
const loadLikes = async limit => {
|
const loadLikes = async limit => {
|
||||||
return relay.annotateChunk(take(limit, await relay.filterEvents({
|
const events = await relay.annotateChunk(
|
||||||
kinds: [7],
|
take(limit, await relay.filterEvents({
|
||||||
authors: [pubkey],
|
kinds: [7],
|
||||||
muffle: getTagValues($user?.muffle || []),
|
authors: [pubkey],
|
||||||
})))
|
muffle: getTagValues($user?.muffle || []),
|
||||||
|
}))
|
||||||
|
)
|
||||||
|
|
||||||
|
return events.filter(e => e.kind === 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
const loadNetwork = async limit => {
|
const loadNetwork = async limit => {
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
<script>
|
<script>
|
||||||
import {when, propEq} from 'ramda'
|
import {when, propEq} from 'ramda'
|
||||||
|
import {fly} from 'svelte/transition'
|
||||||
import {onMount, onDestroy} from 'svelte'
|
import {onMount, onDestroy} from 'svelte'
|
||||||
|
import {now} from 'src/util/misc'
|
||||||
import relay from 'src/relay'
|
import relay from 'src/relay'
|
||||||
import Note from 'src/partials/Note.svelte'
|
import Note from 'src/partials/Note.svelte'
|
||||||
import Spinner from 'src/partials/Spinner.svelte'
|
import Spinner from 'src/partials/Spinner.svelte'
|
||||||
@ -18,7 +20,7 @@
|
|||||||
if (note) {
|
if (note) {
|
||||||
sub = await relay.pool.listenForEvents(
|
sub = await relay.pool.listenForEvents(
|
||||||
'routes/NoteDetail',
|
'routes/NoteDetail',
|
||||||
[{kinds: [1, 5, 7], '#e': [note.id]}],
|
[{kinds: [1, 5, 7], '#e': [note.id], since: now()}],
|
||||||
when(propEq('kind', 1), relay.loadNoteContext)
|
when(propEq('kind', 1), relay.loadNoteContext)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
@ -42,11 +44,11 @@
|
|||||||
</script>
|
</script>
|
||||||
|
|
||||||
{#if !note}
|
{#if !note}
|
||||||
<div class="text-white">
|
<div class="text-white" in:fly={{y: 20}}>
|
||||||
Sorry, we weren't able to find this note.
|
Sorry, we weren't able to find this note.
|
||||||
</div>
|
</div>
|
||||||
{:else if $observable}
|
{:else if $observable}
|
||||||
<div n:fly={{y: 20}}>
|
<div in:fly={{y: 20}}>
|
||||||
<Note invertColors anchorId={note.id} note={$observable} depth={2} />
|
<Note invertColors anchorId={note.id} note={$observable} depth={2} />
|
||||||
</div>
|
</div>
|
||||||
{:else}
|
{:else}
|
||||||
|
Loading…
Reference in New Issue
Block a user