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

View File

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

View File

@ -25,7 +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(pool.defaultUrls.map(objOf("url"))) await relays.patch(pool.defaultRelays)
// Load relays from nostr.watch via dufflepud // Load relays from nostr.watch via dufflepud
if (pool.forceUrls.length === 0) { 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)) 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) { if (relays.length === 0) {
relays = [{url: pool.forceUrls[0] || pool.defaultUrls[0]}] relays = pool.defaultRelays
} }
return uniqByUrl(relays) return uniqByUrl(relays)

View File

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

View File

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