From 8f5ef24cec3d6c19e272311f7088182abb9cef35 Mon Sep 17 00:00:00 2001 From: Jonathan Staab Date: Thu, 15 Jun 2023 16:45:21 -0700 Subject: [PATCH] Start users off with some relays --- ROADMAP.md | 6 +++--- src/agent/pool.ts | 5 ++++- src/agent/relays.ts | 6 +++--- src/agent/user.ts | 2 +- src/app/SideNav.svelte | 6 +----- 5 files changed, 12 insertions(+), 13 deletions(-) diff --git a/ROADMAP.md b/ROADMAP.md index e9afb3cf..00823fdd 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -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 diff --git a/src/agent/pool.ts b/src/agent/pool.ts index 42c92e6e..678d5ffe 100644 --- a/src/agent/pool.ts +++ b/src/agent/pool.ts @@ -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, diff --git a/src/agent/relays.ts b/src/agent/relays.ts index 9b114e38..1158a1ea 100644 --- a/src/agent/relays.ts +++ b/src/agent/relays.ts @@ -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) diff --git a/src/agent/user.ts b/src/agent/user.ts index df65b4fb..418ee595 100644 --- a/src/agent/user.ts +++ b/src/agent/user.ts @@ -38,7 +38,7 @@ const profile = synced("agent/user/profile", { rooms_joined: [], last_checked: {}, petnames: [], - relays: [], + relays: pool.defaultRelays, mutes: [], lists: [], }) diff --git a/src/app/SideNav.svelte b/src/app/SideNav.svelte index b914e3e5..54d2cd03 100644 --- a/src/app/SideNav.svelte +++ b/src/app/SideNav.svelte @@ -72,11 +72,7 @@ {/if} -
  • +
  • Chat {#if $newChatMessages}