mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-29 08:21:20 +00:00
Fix a few bugs
This commit is contained in:
parent
bddb6f4a76
commit
28f8f8644c
@ -1,12 +1,10 @@
|
||||
# Current
|
||||
|
||||
- [ ] Refactor
|
||||
- [ ] Use limit 1 to find most recent notification, then load when visiting the notifications page.
|
||||
- [ ] Add pagination back to chat/messages. Cache is not cutting it, at least for chat.
|
||||
- [ ] Add DM button to user modal
|
||||
- [ ] Send Sleepy marketing materials
|
||||
- [ ] Get back to blowater
|
||||
- [ ] Fix feed control state
|
||||
- [ ] Remove external dependencies from engine, open source it?
|
||||
- [ ] Show nip 5's in search and other places
|
||||
- [ ] If connections fail, re-open and re-send active subs
|
||||
- [ ] Normalize all relay urls, see comment by daniele
|
||||
- [ ] Pull x recent chat messages on chat detail and sort by that
|
||||
@ -45,6 +43,7 @@
|
||||
# Core
|
||||
|
||||
- [ ] Private groups
|
||||
- [ ] Put topic/channel/list follows in petnames https://github.com/nostr-protocol/nips/pull/665#issuecomment-1640835240
|
||||
- [ ] Add custom emoji support
|
||||
- [ ] Reminders for max time spent on coracle
|
||||
- [ ] Proxy handle requests for CORS
|
||||
|
@ -1,6 +1,7 @@
|
||||
<script lang="ts">
|
||||
import {nip19} from "nostr-tools"
|
||||
import {navigate} from "svelte-routing"
|
||||
import {tryFunc} from "src/util/misc"
|
||||
import {fade} from "src/util/transition"
|
||||
import {keys} from "src/app/engine"
|
||||
import {modal, location} from "src/partials/state"
|
||||
@ -18,7 +19,7 @@
|
||||
const pubkeyMatch = $location.pathname.match(/people\/(npub1[0-9a-z]+)/)
|
||||
const pubkey = pubkeyMatch ? nip19.decode(pubkeyMatch[1]).data : null
|
||||
const relayMatch = $location.pathname.match(/relays\/(.+)/)
|
||||
const relay = relayMatch ? atob(relayMatch[1]) : null
|
||||
const relay = tryFunc(() => atob(relayMatch[1])) || relayMatch?.[1]
|
||||
const relays = relay ? [relay] : null
|
||||
|
||||
modal.push({type: "note/create", pubkey, relays})
|
||||
|
@ -35,6 +35,7 @@ const engine = createDefaultEngine({
|
||||
COUNT_RELAYS,
|
||||
SEARCH_RELAYS,
|
||||
DEFAULT_RELAYS,
|
||||
ENABLE_ZAPS,
|
||||
})
|
||||
|
||||
export default engine
|
||||
|
@ -31,6 +31,8 @@
|
||||
|
||||
const getModal = () => last(document.querySelectorAll(".modal-content"))
|
||||
|
||||
const scrollerElement = getModal()
|
||||
|
||||
const setFeedRelay = relay => {
|
||||
feedRelay = relay
|
||||
|
||||
@ -89,7 +91,7 @@
|
||||
onEvent,
|
||||
})
|
||||
|
||||
scroller = createScroller(loadMore, {element: getModal()})
|
||||
scroller = createScroller(loadMore, {element: scrollerElement})
|
||||
|
||||
newNotes = derived<DisplayEvent[]>(feed.feed, notes =>
|
||||
notes.filter(e => e.created_at > feed.since)
|
||||
|
@ -149,7 +149,7 @@ export const loadAppData = async () => {
|
||||
await PubkeyLoader.load(pubkey, {force: true, kinds: userKinds})
|
||||
|
||||
// Load their network
|
||||
PubkeyLoader.load(User.getFollows())
|
||||
await PubkeyLoader.load(User.getFollows())
|
||||
|
||||
// Load their messages and notifications
|
||||
Network.subscribe({
|
||||
|
@ -59,7 +59,7 @@
|
||||
|
||||
<form on:submit|preventDefault={submit}>
|
||||
<Content>
|
||||
<Heading class="text-center">{values.id ? "Edit" : "Add"} list</Heading>
|
||||
<Heading class="text-center">{values.naddr ? "Edit" : "Add"} list</Heading>
|
||||
<div class="flex w-full flex-col gap-8">
|
||||
<div class="flex flex-col gap-1">
|
||||
<strong>Name</strong>
|
||||
|
@ -29,7 +29,7 @@
|
||||
<p>
|
||||
Select a list to modify. The selected {label} will be added to it as an additional filter.
|
||||
</p>
|
||||
{#each $lists as e (e.id)}
|
||||
{#each $lists as e (e.naddr)}
|
||||
{@const meta = Tags.from(e).asMeta()}
|
||||
<BorderLeft on:click={() => selectlist(e)}>
|
||||
<strong>{meta.d}</strong>
|
||||
|
@ -42,6 +42,8 @@
|
||||
|
||||
await feed.loadAll()
|
||||
|
||||
console.log('NoteDetail', $displayNote)
|
||||
|
||||
loading = false
|
||||
})
|
||||
|
||||
|
@ -12,7 +12,7 @@
|
||||
|
||||
export let note
|
||||
|
||||
let unsubscribe
|
||||
let sub
|
||||
let zap = {
|
||||
amount: user.getSetting("default_zap"),
|
||||
message: "",
|
||||
@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
// Listen for the zap confirmation
|
||||
unsubscribe = network.subscribe({
|
||||
sub = network.subscribe({
|
||||
relays,
|
||||
filter: {
|
||||
kinds: [9735],
|
||||
@ -79,7 +79,7 @@
|
||||
}
|
||||
|
||||
onDestroy(() => {
|
||||
unsubscribe?.()
|
||||
sub?.close()
|
||||
})
|
||||
</script>
|
||||
|
||||
|
@ -56,6 +56,6 @@
|
||||
"#r": [relay.url],
|
||||
}} />
|
||||
{:else}
|
||||
<Feed invertColors relays={[relay]} filter={{kinds: [1]}} />
|
||||
<Feed invertColors relays={[relay.url]} filter={{kinds: [1]}} />
|
||||
{/if}
|
||||
</Content>
|
||||
|
@ -43,7 +43,7 @@
|
||||
</div>
|
||||
<Compose
|
||||
{onSubmit}
|
||||
class="shadow-inset rounded bg-input text-black"
|
||||
class="shadow-inset rounded bg-input px-2 py-2 text-black"
|
||||
style="min-height: 6rem"
|
||||
bind:this={compose} />
|
||||
<Anchor tag="button" theme="button" type="submit" class="flex-grow text-center">Send</Anchor>
|
||||
|
@ -43,7 +43,6 @@ export class Content {
|
||||
Events.addHandler(42, processTopics)
|
||||
|
||||
Events.addHandler(30001, e => {
|
||||
console.log("========", e)
|
||||
const {pubkey, kind, created_at} = e
|
||||
const name = Tags.from(e).getMeta("d")
|
||||
const naddr = nip19.naddrEncode({identifier: name, pubkey, kind})
|
||||
|
@ -148,9 +148,9 @@ export class User {
|
||||
}
|
||||
|
||||
const mute = (type, value) =>
|
||||
setMutes(reject(t => t[1] === value, getMutes()).concat([[type, value]]))
|
||||
setMutes(reject(t => t[1] === value, getMutedTags()).concat([[type, value]]))
|
||||
|
||||
const unmute = target => setMutes(reject(t => t[1] === target, getMutes()))
|
||||
const unmute = target => setMutes(reject(t => t[1] === target, getMutedTags()))
|
||||
|
||||
// Content
|
||||
|
||||
|
@ -92,7 +92,8 @@ export const killEvent = e => {
|
||||
e.stopImmediatePropagation()
|
||||
}
|
||||
|
||||
export const isMobile = localStorage.mobile || window.navigator.maxTouchPoints > 1
|
||||
export const isMobile =
|
||||
localStorage.mobile || window.navigator.maxTouchPoints > 1 || window.innerWidth < 400
|
||||
|
||||
export const parseHex = hex => {
|
||||
const result = /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex)
|
||||
|
@ -281,17 +281,6 @@ export const union = (...sets) => new Set(sets.flatMap(s => Array.from(s)))
|
||||
|
||||
export const difference = (a, b) => new Set(Array.from(a).filter(x => !b.has(x)))
|
||||
|
||||
export const quantile = (a, q) => {
|
||||
const sorted = sortBy(identity, a)
|
||||
const pos = (sorted.length - 1) * q
|
||||
const base = Math.floor(pos)
|
||||
const rest = pos - base
|
||||
|
||||
return isNil(sorted[base + 1])
|
||||
? sorted[base]
|
||||
: sorted[base] + rest * (sorted[base + 1] - sorted[base])
|
||||
}
|
||||
|
||||
type FetchOpts = {
|
||||
method?: string
|
||||
headers?: Record<string, string | boolean>
|
||||
@ -348,31 +337,6 @@ export const formatSats = sats => {
|
||||
return numberFmt.format(round(2, sats / 100_000_000)) + "BTC"
|
||||
}
|
||||
|
||||
type EventBusListener = {
|
||||
id: string
|
||||
handler: (...args: any[]) => void
|
||||
}
|
||||
|
||||
export class EventBus {
|
||||
listeners: Record<string, Array<EventBusListener>> = {}
|
||||
on(name, handler) {
|
||||
const id = randomId()
|
||||
|
||||
this.listeners[name] = this.listeners[name] || ([] as Array<EventBusListener>)
|
||||
this.listeners[name].push({id, handler})
|
||||
|
||||
return id
|
||||
}
|
||||
off(name, id) {
|
||||
this.listeners[name] = reject(whereEq({id}), this.listeners[name])
|
||||
}
|
||||
handle(k, ...payload) {
|
||||
for (const {handler} of this.listeners[k] || []) {
|
||||
handler(...payload)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
export const annotateMedia = url => {
|
||||
if (url.match(/\.(jpg|jpeg|png|gif|webp)/)) {
|
||||
return {type: "image", url}
|
||||
|
Loading…
Reference in New Issue
Block a user