Add some default relays so the list loads synchronously

This commit is contained in:
Jonathan Staab 2023-01-03 04:35:34 -08:00
parent 06b357de1d
commit dbee0d6f8a
4 changed files with 52 additions and 10 deletions

View File

@ -182,7 +182,7 @@
</div>
{/if}
{#each note.replies as r (r.id)}
{#if r.created_at < until}
{#if r.created_at <= until}
<svelte:self showParent={false} note={r} depth={depth - 1} {invertColors} {anchorId} />
{/if}
{/each}

View File

@ -29,7 +29,7 @@
$: newNotes = ($notes || []).filter(e => e.created_at > until)
$: newNotesLength = reject(findReply, newNotes).length
$: visibleNotes = ($notes || []).filter(e => e.created_at < until)
$: visibleNotes = ($notes || []).filter(e => e.created_at <= until)
onMount(() => {
const scroller = createScroller(loadNotes)

View File

@ -3,18 +3,12 @@
import {fuzzy} from "src/util/misc"
import Input from "src/partials/Input.svelte"
import Anchor from "src/partials/Anchor.svelte"
import {modal, settings} from "src/state/app"
import {modal} from "src/state/app"
import relay, {connections} from 'src/relay'
let q = ""
let search
fetch($settings.dufflepudUrl + '/relay').then(r => r.json()).then(({relays}) => {
for (const url of relays) {
relay.db.relays.put({url})
}
})
const knownRelays = relay.lq(() => relay.db.relays.toArray())
$: search = fuzzy($knownRelays, {keys: ["name", "description", "url"]})

View File

@ -1,7 +1,8 @@
import {writable} from 'svelte/store'
import {writable, get} from 'svelte/store'
import {navigate} from "svelte-routing"
import {globalHistory} from "svelte-routing/src/history"
import {getLocalJson, setLocalJson, now, timedelta} from "src/util/misc"
import relay from 'src/relay'
// Modals
@ -46,3 +47,50 @@ export const alerts = writable({
alerts.subscribe($alerts => {
setLocalJson("coracle/alerts", $alerts)
})
// Populate relays initially. Hardcode some, load the rest asynchronously
fetch(get(settings).dufflepudUrl + '/relay').then(r => r.json()).then(({relays}) => {
for (const url of relays) {
relay.db.relays.put({url})
}
})
const defaultRelays = [
'wss://no.contry.xyz',
'wss://nostr.ethtozero.fr',
'wss://relay.nostr.ro',
'wss://nostr.actn.io',
'wss://relay.realsearch.cc',
'wss://nostr.mrbits.it',
'wss://relay.nostr.vision',
'wss://nostr.massmux.com',
'wss://nostr.robotechy.com',
'wss://satstacker.cloud',
'wss://relay.kronkltd.net',
'wss://nostr.developer.li',
'wss://nostr.vulpem.com',
'wss://nostr.openchain.fr',
'wss://nostr-01.bolt.observer',
'wss://nostr.oxtr.dev',
'wss://nostr.zebedee.cloud',
'wss://nostr-verif.slothy.win',
'wss://nostr.rewardsbunny.com',
'wss://nostr.onsats.org',
'wss://relay.boring.surf',
'wss://no.str.watch',
'wss://relay.nostr.pro',
'wss://nostr.ono.re',
'wss://nostr.rocks',
'wss://btc.klendazu.com',
'wss://nostr-relay.untethr.me',
'wss://nostr.orba.ca',
'wss://sg.qemura.xyz',
'wss://nostr.hyperlingo.com',
'wss://nostr.d11n.net',
'wss://relay.nostr.express',
]
for (const url of defaultRelays) {
relay.db.relays.put({url})
}