mirror of
https://github.com/coracle-social/coracle.git
synced 2024-10-06 11:43:30 +00:00
Improve initial load using purplepag.es
This commit is contained in:
parent
282c036fa5
commit
3e1b0cb9fe
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
# 0.2.25
|
||||||
|
|
||||||
|
- [x] Add purplepag.es to sign in flow
|
||||||
|
- [x] Include people with only a display_name in search
|
||||||
|
|
||||||
## 0.2.24
|
## 0.2.24
|
||||||
|
|
||||||
- [x] Replace localforage with loki.js for storage
|
- [x] Replace localforage with loki.js for storage
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
# Current
|
# Current
|
||||||
|
|
||||||
- [ ] Remember message/chat status
|
- [ ] Remember message/chat status
|
||||||
- [ ] Add purplepag.es to sign in flow
|
|
||||||
- [ ] Add way to turn off likes/zaps
|
- [ ] Add way to turn off likes/zaps
|
||||||
- [ ] Improve AUTH status display
|
- [ ] Improve AUTH status display
|
||||||
- [ ] Image classification
|
- [ ] Image classification
|
||||||
|
@ -95,10 +95,10 @@ const Meta = {
|
|||||||
const forceUrls = (import.meta.env.VITE_FORCE_RELAYS || "").split(",").filter(identity)
|
const forceUrls = (import.meta.env.VITE_FORCE_RELAYS || "").split(",").filter(identity)
|
||||||
|
|
||||||
const defaultUrls = [
|
const defaultUrls = [
|
||||||
|
"wss://purplepag.es",
|
||||||
|
"wss://relay.damus.io",
|
||||||
|
"wss://relay.nostr.band",
|
||||||
"wss://nostr-pub.wellorder.net",
|
"wss://nostr-pub.wellorder.net",
|
||||||
"wss://nostr.zebedee.cloud",
|
|
||||||
"wss://nos.lol",
|
|
||||||
"wss://brb.io",
|
|
||||||
]
|
]
|
||||||
|
|
||||||
const getUrls = relays => {
|
const getUrls = relays => {
|
||||||
|
@ -25,15 +25,7 @@ import user from "src/agent/user"
|
|||||||
|
|
||||||
export const initializeRelayList = async () => {
|
export const initializeRelayList = async () => {
|
||||||
// Throw some hardcoded defaults in there
|
// Throw some hardcoded defaults in there
|
||||||
await relays.patch([
|
await relays.patch(pool.defaultUrls.map(objOf("url")))
|
||||||
{url: "wss://brb.io"},
|
|
||||||
{url: "wss://nostr.zebedee.cloud"},
|
|
||||||
{url: "wss://nostr-pub.wellorder.net"},
|
|
||||||
{url: "wss://relay.nostr.band"},
|
|
||||||
{url: "wss://nostr.pleb.network"},
|
|
||||||
{url: "wss://relay.nostrich.de"},
|
|
||||||
{url: "wss://relay.damus.io"},
|
|
||||||
])
|
|
||||||
|
|
||||||
// Load relays from nostr.watch via dufflepud
|
// Load relays from nostr.watch via dufflepud
|
||||||
try {
|
try {
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<script lang="ts">
|
<script lang="ts">
|
||||||
import type {Relay} from "src/util/types"
|
import type {Relay} from "src/util/types"
|
||||||
import {isNil, find, all, last} from "ramda"
|
import {isNil, prop, uniqBy, objOf, find, all, last} from "ramda"
|
||||||
import {onDestroy, onMount} from "svelte"
|
import {onDestroy, onMount} from "svelte"
|
||||||
import {navigate} from "svelte-routing"
|
import {navigate} from "svelte-routing"
|
||||||
import {sleep, shuffle} from "src/util/misc"
|
import {sleep, shuffle} from "src/util/misc"
|
||||||
@ -25,8 +25,14 @@
|
|||||||
let currentRelays = {} as Record<number, Relay>
|
let currentRelays = {} as Record<number, Relay>
|
||||||
let attemptedRelays = new Set()
|
let attemptedRelays = new Set()
|
||||||
let customRelays = []
|
let customRelays = []
|
||||||
let knownRelays = watch("relays", table => shuffle(table.all()))
|
|
||||||
let allRelays = []
|
let allRelays = []
|
||||||
|
let knownRelays = watch("relays", table =>
|
||||||
|
uniqBy(
|
||||||
|
prop("url"),
|
||||||
|
// Make sure our hardcoded urls are first, since they're more likely to find a match
|
||||||
|
pool.defaultUrls.map(objOf("url")).concat(shuffle(table.all()))
|
||||||
|
)
|
||||||
|
)
|
||||||
|
|
||||||
$: allRelays = $knownRelays.concat(customRelays)
|
$: allRelays = $knownRelays.concat(customRelays)
|
||||||
|
|
||||||
@ -57,13 +63,13 @@
|
|||||||
|
|
||||||
currentRelays[i] = null
|
currentRelays[i] = null
|
||||||
|
|
||||||
// Make sure we have relays and follows before calling it good. This helps us avoid
|
if (searching && user.getRelays().length > 0) {
|
||||||
// nuking follow lists later on
|
|
||||||
if (searching && user.getRelays().length > 0 && user.getPetnames().length > 0) {
|
|
||||||
searching = false
|
searching = false
|
||||||
modal = "success"
|
modal = "success"
|
||||||
|
|
||||||
await Promise.all([loadAppData(user.getPubkey()), sleep(3000)])
|
// Reload everything, it's possible we didn't get their petnames if we got a match
|
||||||
|
// from something like purplepag.es. This helps us avoid nuking follow lists later
|
||||||
|
await Promise.all([loadAppData(user.getPubkey()), sleep(1500)])
|
||||||
|
|
||||||
navigate("/notes")
|
navigate("/notes")
|
||||||
} else {
|
} else {
|
||||||
|
Loading…
Reference in New Issue
Block a user