mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 11:43:35 +00:00
Fix url display, content editable line break parsing, and person relays
This commit is contained in:
parent
e9d1592ba7
commit
ce6993b214
14
ROADMAP.md
14
ROADMAP.md
@ -1,19 +1,13 @@
|
||||
# Current
|
||||
|
||||
- [ ] Move blog to nostr
|
||||
- [ ] Improve note rendering
|
||||
- [ ] Fix reactions and replies showing up
|
||||
- [x] Show all images in preview as slideshow or something
|
||||
- [x] Extract nostr: links and bech32 entities, hover
|
||||
- [x] Add nostr: links and bech32 entities in compose to tags
|
||||
- [x] Fix extra newlines when composing
|
||||
- [ ] Multiplexer
|
||||
- [ ] Announce multiplextr, paravel, coracle update w/url
|
||||
- [ ] Look into AUTH not working for mazin
|
||||
- [ ] Write NIP to support proxies. Update COUNT NIP to mention how proxies are a good use case for COUNT
|
||||
- [ ] Write blog post on multiplexer
|
||||
- [ ] Fix performance issues
|
||||
- [ ] Fix reactions and replies showing up
|
||||
- [ ] Fix iOS/safari/firefox
|
||||
- [ ] https://github.com/coracle-social/coracle/issues/42
|
||||
- [ ] Multiplex, charge past a certain usage level based on bandwidth
|
||||
- [ ] Move blog to https://twitter.com/fiatjaf/status/1638514052014940162
|
||||
- [ ] Add onError handler to subscriptions for when sockets fail to connect?
|
||||
- [ ] Add bugsnag to multiplexr
|
||||
|
||||
|
@ -180,6 +180,7 @@ class PublishableEvent {
|
||||
}
|
||||
async publish(relays, onProgress = null) {
|
||||
const event = await this.getSignedEvent()
|
||||
//console.log(event); return
|
||||
const promise = pool.publish({relays, event, onProgress})
|
||||
|
||||
sync.processEvents(event)
|
||||
|
@ -57,10 +57,13 @@ export const getPubkeyRelays = (pubkey, mode = null, routesOverride = null) => {
|
||||
let result = routesOverride || _getPubkeyRelaysCache.get(key)
|
||||
if (!result) {
|
||||
result = routes.all(filter)
|
||||
|
||||
if (result.length > 0) {
|
||||
_getPubkeyRelaysCache.set(key, result)
|
||||
}
|
||||
}
|
||||
|
||||
return sortByScore(map(pick(["url", "score"]), result))
|
||||
return sortByScore(map(pick(["url", "score"]), uniqByUrl(result)))
|
||||
}
|
||||
|
||||
export const getPubkeyReadRelays = pubkey => getPubkeyRelays(pubkey, "read")
|
||||
|
@ -56,16 +56,11 @@
|
||||
let annotations = []
|
||||
|
||||
for (const child of node.childNodes) {
|
||||
const lineBreaks = child.querySelectorAll?.("br") || []
|
||||
|
||||
if (child.tagName === "BR") {
|
||||
continue
|
||||
content += "\n"
|
||||
}
|
||||
|
||||
// Line breaks may be bare brs or divs wrapping brs
|
||||
if (lineBreaks.length > 0) {
|
||||
content += "\n".repeat(lineBreaks.length)
|
||||
} else if (isLineBreak(child)) {
|
||||
if (child.tagName === "DIV" && !child.querySelector("br")) {
|
||||
content += "\n"
|
||||
}
|
||||
|
||||
|
@ -31,7 +31,6 @@
|
||||
|
||||
const interpolate = (a, b) => t => a + Math.round((b - a) * t)
|
||||
const {petnamePubkeys, canPublish, mutes} = user
|
||||
const getRelays = () => sampleRelays(relays.concat(getPubkeyWriteRelays(pubkey)))
|
||||
const tabs = ["notes", "likes", pool.forceUrls.length === 0 && "relays"].filter(identity)
|
||||
|
||||
let pubkey = toHex(npub)
|
||||
@ -44,6 +43,9 @@
|
||||
let actions = []
|
||||
let rgb, rgba
|
||||
|
||||
$: ownRelays = getPubkeyWriteRelays(pubkey)
|
||||
$: relays = sampleRelays(relays.concat(ownRelays))
|
||||
|
||||
$: {
|
||||
const color = parseHex(getThemeColor($theme, "gray-8"))
|
||||
|
||||
@ -101,6 +103,7 @@
|
||||
|
||||
// Refresh our person
|
||||
network.loadPeople([pubkey], {force: true}).then(() => {
|
||||
ownRelays = getPubkeyWriteRelays(pubkey)
|
||||
person = getPersonWithFallback(pubkey)
|
||||
loading = false
|
||||
})
|
||||
@ -114,8 +117,8 @@
|
||||
const followers = new Set()
|
||||
|
||||
await network.load({
|
||||
relays,
|
||||
shouldProcess: false,
|
||||
relays: getRelays(),
|
||||
filter: [{kinds: [3], "#p": [pubkey]}],
|
||||
onChunk: events => {
|
||||
for (const e of events) {
|
||||
@ -143,7 +146,7 @@
|
||||
}
|
||||
|
||||
const follow = async () => {
|
||||
const [{url}] = getRelays()
|
||||
const [{url}] = relays
|
||||
|
||||
user.addPetname(pubkey, url, displayPerson(person))
|
||||
}
|
||||
@ -244,8 +247,8 @@
|
||||
{:else if activeTab === "likes"}
|
||||
<Likes {pubkey} />
|
||||
{:else if activeTab === "relays"}
|
||||
{#if getRelays().length > 0}
|
||||
<Relays relays={getRelays()} />
|
||||
{#if ownRelays.length > 0}
|
||||
<Relays relays={ownRelays} />
|
||||
{:else if loading}
|
||||
<Spinner />
|
||||
{:else}
|
||||
|
@ -172,6 +172,10 @@ export const parseContent = content => {
|
||||
url = url.slice(0, -1)
|
||||
}
|
||||
|
||||
if (!url.match("://")) {
|
||||
url = "https://" + url
|
||||
}
|
||||
|
||||
push("link", urlMatch[0], url)
|
||||
continue
|
||||
}
|
||||
|
@ -9,6 +9,7 @@
|
||||
import Content from "src/partials/Content.svelte"
|
||||
import Heading from "src/partials/Heading.svelte"
|
||||
import user from "src/agent/user"
|
||||
import pool from "src/agent/pool"
|
||||
import {toast} from "src/app/ui"
|
||||
|
||||
let values = {...user.getSettings()}
|
||||
@ -79,6 +80,7 @@
|
||||
>.
|
||||
</p>
|
||||
</div>
|
||||
{#if pool.forceUrls.length === 0}
|
||||
<div class="flex flex-col gap-1">
|
||||
<strong>Multiplextr URL</strong>
|
||||
<Input bind:value={values.multiplextrUrl}>
|
||||
@ -86,12 +88,13 @@
|
||||
</Input>
|
||||
<p class="text-sm text-gray-1">
|
||||
Enter a custom proxy server for multiplexing relay connections. This can drastically
|
||||
improve resource usage, but has some privacy trade-offs. Leave blank to connect to relays
|
||||
directly. You can find the source code <Anchor
|
||||
improve resource usage, but has some privacy trade-offs. Leave blank to connect to
|
||||
relays directly. You can find the source code <Anchor
|
||||
href="https://github.com/coracle-social/multiplextr">here</Anchor
|
||||
>.
|
||||
</p>
|
||||
</div>
|
||||
{/if}
|
||||
<div class="flex flex-col gap-1">
|
||||
<div class="flex items-center gap-2">
|
||||
<strong>Report errors and analytics</strong>
|
||||
|
@ -22,7 +22,7 @@
|
||||
|
||||
const links = []
|
||||
const entities = []
|
||||
const shouldTruncate = !showEntire && note.content.length > 800
|
||||
const shouldTruncate = !showEntire && note.content.length > 500
|
||||
const content = parseContent(note.content)
|
||||
|
||||
let l = 0
|
||||
@ -62,7 +62,7 @@
|
||||
if (value instanceof String) {
|
||||
l += value.length
|
||||
|
||||
if (shouldTruncate && l > 400 && type !== "br") {
|
||||
if (shouldTruncate && l > 350 && type !== "br") {
|
||||
content[i].value = value.trim()
|
||||
content.splice(i + 1, content.length, {type: "text", value: "..."})
|
||||
break
|
||||
|
Loading…
Reference in New Issue
Block a user