Start users off with some relays

This commit is contained in:
Jonathan Staab 2023-06-15 16:45:21 -07:00
parent f8252e68b2
commit 8f5ef24cec
5 changed files with 12 additions and 13 deletions

View File

@ -1,7 +1,6 @@
# Current
- [ ] Fix content spacing
- [ ] List detail pages with follow all and add all to list
- [ ] Clean up lists/advanced search
- [ ] Use vida to stream development
- [ ] Fix connection management stuff. Have GPT help
- [ ] Add preview proxy thing
@ -14,7 +13,7 @@
- [ ] Avoid leaking events from private relays
- [ ] Image classification
- https://github.com/bhky/opennsfw2
- [ ] Private groups using nsec bunker
- [ ] Private groups
- [ ] Fix unauthenticated experience. Going to an npub just spins
- [ ] Convert app store to nip 89
- [ ] Put search icon in header or hover button, open in modal
@ -29,6 +28,7 @@
# Core
- [ ] Deploy ontology.coracle.social
- [ ] List detail pages with follow all and add all to list
- [ ] Add threads - replies by self get shown at the top of replies?
- [ ] Embedded music players for Spotify, youtube, etc
- [ ] Make mutes private

View File

@ -2,7 +2,7 @@ import type {Relay, Filter} from "nostr-tools"
import type {MyEvent} from "src/util/types"
import {Socket, Pool, Plex, Relays, Executor} from "paravel"
import {verifySignature} from "nostr-tools"
import {pluck, identity} from "ramda"
import {pluck, objOf, identity} from "ramda"
import {ensurePlural, switcher} from "hurdak/lib/hurdak"
import {warn, log, error} from "src/util/logger"
import {union, sleep, difference} from "src/util/misc"
@ -108,6 +108,8 @@ const defaultUrls =
"wss://nostr-pub.wellorder.net",
]
const defaultRelays = defaultUrls.map(objOf("url"))
const getUrls = relays => {
if (relays.length === 0) {
error(`Attempted to connect to zero urls`)
@ -405,6 +407,7 @@ export default {
forceUrls,
forceRelays,
defaultUrls,
defaultRelays,
disconnect,
getQuality,
publish,

View File

@ -25,7 +25,7 @@ import user from "src/agent/user"
export const initializeRelayList = async () => {
// Throw some hardcoded defaults in there
await relays.patch(pool.defaultUrls.map(objOf("url")))
await relays.patch(pool.defaultRelays)
// Load relays from nostr.watch via dufflepud
if (pool.forceUrls.length === 0) {
@ -176,9 +176,9 @@ export const sampleRelays = (relays, scale = 1) => {
relays = relays.concat(shuffle(getUserReadRelays()).slice(0, limit - relays.length))
}
// And if we still have nothing, add a default
// And if we still have nothing, add our defaults
if (relays.length === 0) {
relays = [{url: pool.forceUrls[0] || pool.defaultUrls[0]}]
relays = pool.defaultRelays
}
return uniqByUrl(relays)

View File

@ -38,7 +38,7 @@ const profile = synced("agent/user/profile", {
rooms_joined: [],
last_checked: {},
petnames: [],
relays: [],
relays: pool.defaultRelays,
mutes: [],
lists: [],
})

View File

@ -72,11 +72,7 @@
{/if}
</a>
</li>
<li
class={cx("relative", {
"cursor-pointer": $canPublish,
"pointer-events-none opacity-75": !$canPublish,
})}>
<li class="relative">
<a class="block px-4 py-2 transition-all hover:bg-accent hover:text-white" href="/chat">
<i class="fa fa-comment mr-2" /> Chat
{#if $newChatMessages}