diff --git a/ROADMAP.md b/ROADMAP.md index d2f07aa4..59d8b75b 100644 --- a/ROADMAP.md +++ b/ROADMAP.md @@ -1,8 +1,6 @@ # Current - [ ] Await publish, show error if it fails or times out -- [ ] Fix initial relay loading, don't nuke people's relay lists - - [ ] Add a nuclear bypass with a warning, after we fail to find anything # Next @@ -24,6 +22,8 @@ # More +- [ ] Hover badge to view profile like twitter +- [ ] Show created date as bitcoin block height (add a setting?) - [ ] Support relay auth - [ ] Following indicator on person info - [ ] Share button for notes, shows qr code and nevent diff --git a/src/agent/cmd.ts b/src/agent/cmd.ts index 34a1c747..46d1b116 100644 --- a/src/agent/cmd.ts +++ b/src/agent/cmd.ts @@ -3,7 +3,7 @@ import {prop, pick, join, uniqBy, last} from 'ramda' import {get} from 'svelte/store' import {first} from "hurdak/lib/hurdak" import {roomAttrs, displayPerson} from 'src/util/nostr' -import {getPubkeyWriteRelays, getRelayForPersonHint, getUserReadRelays} from 'src/agent/relays' +import {getPubkeyWriteRelays, getRelayForPersonHint, sampleRelays} from 'src/agent/relays' import database from 'src/agent/database' import network from 'src/agent/network' import keys from 'src/agent/keys' @@ -45,7 +45,7 @@ const createDirectMessage = (relays, pubkey, content) => const createNote = (relays, content, mentions = [], topics = []) => { mentions = mentions.map(pubkey => { const name = displayPerson(database.getPersonWithFallback(pubkey)) - const [{url}] = getPubkeyWriteRelays(pubkey) || getUserReadRelays() + const [{url}] = sampleRelays(getPubkeyWriteRelays(pubkey)) return ["p", pubkey, url, name] }) diff --git a/src/agent/pool.ts b/src/agent/pool.ts index e75e1c53..098c7b5a 100644 --- a/src/agent/pool.ts +++ b/src/agent/pool.ts @@ -199,7 +199,8 @@ const subscribe = async ( if (!seen.has(e.id)) { seen.add(e.id) - onEvent({...e, seen_on: relay.url}) + // Normalize events here, annotate with relay url + onEvent({...e, seen_on: relay.url, content: e.content || ''}) } }) diff --git a/src/app/index.ts b/src/app/index.ts index 1981c252..08641c5b 100644 --- a/src/app/index.ts +++ b/src/app/index.ts @@ -1,9 +1,9 @@ import type {DisplayEvent} from 'src/util/types' import {navigate} from 'svelte-routing' -import {omit, sortBy, identity} from 'ramda' +import {omit, sortBy} from 'ramda' import {createMap, ellipsize} from 'hurdak/lib/hurdak' import {renderContent} from 'src/util/html' -import {Tags, displayPerson, findReplyId} from 'src/util/nostr' +import {displayPerson, findReplyId} from 'src/util/nostr' import {getUserFollows} from 'src/agent/social' import {getUserReadRelays} from 'src/agent/relays' import database from 'src/agent/database' @@ -40,16 +40,12 @@ export const signup = privkey => { } export const renderNote = (note, {showEntire = false}) => { - const shouldEllipsize = note.content.length > 500 && !showEntire - const peopleByPubkey = createMap( - 'pubkey', - Tags.from(note).type("p").values().all().map(k => database.people.get(k)).filter(identity) - ) - let content // Ellipsize - content = shouldEllipsize ? ellipsize(note.content, 500) : note.content + content = note.content.length > 500 && !showEntire + ? ellipsize(note.content, 500) + : note.content // Escape html, replace urls content = renderContent(content) @@ -62,7 +58,7 @@ export const renderNote = (note, {showEntire = false}) => { } const pubkey = note.tags[parseInt(i)][1] - const person = peopleByPubkey[pubkey] || {pubkey} + const person = database.getPersonWithFallback(pubkey) const name = displayPerson(person) const path = routes.person(pubkey) diff --git a/src/partials/EnsureData.svelte b/src/partials/EnsureData.svelte index c756ca6a..9d49264d 100644 --- a/src/partials/EnsureData.svelte +++ b/src/partials/EnsureData.svelte @@ -64,7 +64,7 @@

Your Follows

{/if} {#each $petnamePubkeys as pubkey (pubkey)} - + {:else}
diff --git a/src/partials/NewNoteButton.svelte b/src/partials/NewNoteButton.svelte index 8cc2ea4e..7b32485a 100644 --- a/src/partials/NewNoteButton.svelte +++ b/src/partials/NewNoteButton.svelte @@ -1,11 +1,14 @@ -{#if keys.canSign()} +{#if keys.canSign() && $relays.length > 0}