mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-30 00:41:12 +00:00
Show image previews
This commit is contained in:
parent
75ccc747ec
commit
43906205f4
@ -20,7 +20,6 @@ Coracle is currently in _alpha_ - expect bugs, slow loading times, and rough edg
|
||||
- [ ] Server discovery and relay publishing - https://github.com/nostr-protocol/nips/pull/32/files
|
||||
- [ ] Support invoices https://twitter.com/jb55/status/1604131336247476224
|
||||
- [ ] Expand/collapse large threads
|
||||
- [ ] Don't send note on enter, allow linebreaks
|
||||
- [ ] NIP 05
|
||||
|
||||
# Bugs
|
||||
@ -29,15 +28,12 @@ Coracle is currently in _alpha_ - expect bugs, slow loading times, and rough edg
|
||||
- [ ] Add alerts for replies to posts the user liked
|
||||
- [ ] With link/image previews, remove the url from the note body if it's on a separate last line
|
||||
- [ ] Stack views so scroll position isn't lost on navigation
|
||||
- [ ] We're sending client=astral tags, event id 125ff9dc495f65d302e8d95ea6f9385106cc31b81c80e8c582b44be92fa50c44
|
||||
- [ ] Add notification for slow relays
|
||||
- [ ] Wait for 60% or so of relays to eose to balance completeness with speed
|
||||
- [ ] Add a CSP, check for XSS in image urls
|
||||
|
||||
# Current update
|
||||
|
||||
- [ ] Add depth to findNote
|
||||
- [ ] Add date to alerts
|
||||
- [ ] Re-implement muffle
|
||||
- Don't store muffled events, when muffle changes delete them
|
||||
- [ ] Delete old events
|
||||
|
@ -19,7 +19,7 @@
|
||||
|
||||
const json = await res.json()
|
||||
|
||||
if (json.title) {
|
||||
if (json.title || json.image) {
|
||||
preview = json
|
||||
}
|
||||
})
|
||||
@ -35,10 +35,12 @@
|
||||
<img src={preview.image} />
|
||||
<div class="h-px bg-medium" />
|
||||
{/if}
|
||||
{#if preview.title}
|
||||
<div class="px-4 py-2 text-black flex flex-col bg-white">
|
||||
<strong class="whitespace-nowrap text-ellipsis overflow-hidden">{preview.title}</strong>
|
||||
<small>{preview.description}</small>
|
||||
</div>
|
||||
{/if}
|
||||
</Anchor>
|
||||
</div>
|
||||
{/if}
|
||||
|
@ -66,7 +66,7 @@ const filterReactions = async (id, filter) => {
|
||||
return events.filter(e => e.kind === 7)
|
||||
}
|
||||
|
||||
const findNote = async (id, {showEntire = false} = {}) => {
|
||||
const findNote = async (id, {showEntire = false, depth = 1} = {}) => {
|
||||
const note = await db.events.get(id)
|
||||
|
||||
if (!note) {
|
||||
@ -95,7 +95,7 @@ const findNote = async (id, {showEntire = false} = {}) => {
|
||||
|
||||
return {
|
||||
...note, reactions, person, html, parent,
|
||||
replies: await Promise.all(replies.map(r => findNote(r.id))),
|
||||
replies: depth === 0 ? [] : await Promise.all(replies.map(r => findNote(r.id, {depth: depth - 1}))),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1 +0,0 @@
|
||||
|
@ -31,7 +31,7 @@
|
||||
})
|
||||
|
||||
onMount(() => {
|
||||
observable = relay.lq(() => relay.findNote(note.id, {showEntire: true}))
|
||||
observable = relay.lq(() => relay.findNote(note.id, {showEntire: true, depth: 5}))
|
||||
|
||||
return () => {
|
||||
if (sub) {
|
||||
|
@ -5,6 +5,7 @@
|
||||
import {fuzzy} from "src/util/misc"
|
||||
import Note from "src/partials/Note.svelte"
|
||||
import Spinner from "src/partials/Spinner.svelte"
|
||||
import relay from 'src/relay'
|
||||
|
||||
export let q
|
||||
|
||||
|
@ -3,7 +3,7 @@
|
||||
import {onMount, onDestroy} from 'svelte'
|
||||
import Notes from "src/partials/Notes.svelte"
|
||||
import {timedelta, Cursor, getLastSync} from 'src/util/misc'
|
||||
import relay, {network} from 'src/relay'
|
||||
import relay, {user, network} from 'src/relay'
|
||||
|
||||
let sub
|
||||
|
||||
@ -27,7 +27,7 @@
|
||||
})
|
||||
|
||||
const loadNotes = async limit => {
|
||||
const filter = {kinds: [1], authors: $network}
|
||||
const filter = {kinds: [1], authors: $network.concat($user.pubkey)}
|
||||
const notes = take(limit + 1, await relay.filterEvents(filter))
|
||||
|
||||
if (notes.length <= limit) {
|
||||
|
Loading…
Reference in New Issue
Block a user