mirror of
https://github.com/coracle-social/coracle.git
synced 2024-09-19 11:43:35 +00:00
Improve feed quality by separating kind 1 and 7 filters
This commit is contained in:
parent
6b2954c48c
commit
447fdab654
@ -1,5 +1,10 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
## 0.2.16
|
||||||
|
|
||||||
|
- [x] Add search by nip05
|
||||||
|
- [x] Fix feed to show more variety
|
||||||
|
|
||||||
## 0.2.15
|
## 0.2.15
|
||||||
|
|
||||||
- [x] Add zaps
|
- [x] Add zaps
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
# Current
|
# Current
|
||||||
|
|
||||||
- [ ] Search by nip05 alias
|
- [ ] Show image upload rather than plop url in
|
||||||
- nevent1qqsdt4ux9c0zvd6hzpwnzznjsmd7a337mpxdspu9wd4fq8drvqejdmqpz3mhxue69uhhyetvv9ujuerpd46hxtnfduqs6amnwvaz7tmwdaejumr0dsffemjp
|
|
||||||
- [ ] Fix feeds
|
|
||||||
- [ ] Hash pubkey so we can track usage by unique user
|
- [ ] Hash pubkey so we can track usage by unique user
|
||||||
- [ ] Try adding boxes/separation on feeds based on user feedback
|
- [ ] Try adding boxes/separation on feeds based on user feedback
|
||||||
- [ ] Strip zero width spaces from compose
|
- [ ] Strip zero width spaces from compose
|
||||||
|
@ -150,7 +150,7 @@ export const getLastSync = (k, fallback = 0) => {
|
|||||||
export class Cursor {
|
export class Cursor {
|
||||||
until: number
|
until: number
|
||||||
limit: number
|
limit: number
|
||||||
constructor(limit = 10) {
|
constructor(limit = 50) {
|
||||||
this.until = now()
|
this.until = now()
|
||||||
this.limit = limit
|
this.limit = limit
|
||||||
}
|
}
|
||||||
@ -170,7 +170,7 @@ export class Cursor {
|
|||||||
if (events.length > 1) {
|
if (events.length > 1) {
|
||||||
const timestamps = sortBy(identity, pluck('created_at', events))
|
const timestamps = sortBy(identity, pluck('created_at', events))
|
||||||
const gaps = aperture(2, timestamps).map(([a, b]) => b - a)
|
const gaps = aperture(2, timestamps).map(([a, b]) => b - a)
|
||||||
const gap = quantile(gaps, 0.5)
|
const gap = quantile(gaps, 0.1)
|
||||||
|
|
||||||
this.until -= Math.round(gap * events.length)
|
this.until -= Math.round(gap * events.length)
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
import type {DisplayEvent} from 'src/util/types'
|
import type {DisplayEvent} from 'src/util/types'
|
||||||
import {fromPairs, last, identity, objOf, prop, flatten, uniq} from 'ramda'
|
import {is, fromPairs, mergeLeft, last, identity, objOf, prop, flatten, uniq} from 'ramda'
|
||||||
import {nip19} from 'nostr-tools'
|
import {nip19} from 'nostr-tools'
|
||||||
import {ensurePlural, ellipsize, first} from 'hurdak/lib/hurdak'
|
import {ensurePlural, ellipsize, first} from 'hurdak/lib/hurdak'
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ export const displayPerson = p => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export const isLike = content => ['', '+', '🤙', '👍', '❤️'].includes(content)
|
export const isLike = content => ['', '+', '🤙', '👍', '❤️', '😎', '🏅'].includes(content)
|
||||||
|
|
||||||
export const isAlert = (e, pubkey) => {
|
export const isAlert = (e, pubkey) => {
|
||||||
if (![1, 7, 9735].includes(e.kind)) {
|
if (![1, 7, 9735].includes(e.kind)) {
|
||||||
@ -130,3 +130,6 @@ export const toHex = (data: string): string | null => {
|
|||||||
return null
|
return null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export const mergeFilter = (filter, extra) =>
|
||||||
|
is(Array, filter) ? filter.map(mergeLeft(extra)) : {...filter, ...extra}
|
||||||
|
@ -4,7 +4,7 @@
|
|||||||
import {slide} from 'svelte/transition'
|
import {slide} from 'svelte/transition'
|
||||||
import {quantify} from 'hurdak/lib/hurdak'
|
import {quantify} from 'hurdak/lib/hurdak'
|
||||||
import {createScroller, now, Cursor} from 'src/util/misc'
|
import {createScroller, now, Cursor} from 'src/util/misc'
|
||||||
import {asDisplayEvent} from 'src/util/nostr'
|
import {asDisplayEvent, mergeFilter} from 'src/util/nostr'
|
||||||
import Spinner from 'src/partials/Spinner.svelte'
|
import Spinner from 'src/partials/Spinner.svelte'
|
||||||
import Content from 'src/partials/Content.svelte'
|
import Content from 'src/partials/Content.svelte'
|
||||||
import Note from "src/views/notes/Note.svelte"
|
import Note from "src/views/notes/Note.svelte"
|
||||||
@ -78,14 +78,14 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
onMount(() => {
|
onMount(() => {
|
||||||
const sub = network.listen({relays, filter: {...filter, since}, onChunk})
|
const sub = network.listen({relays, filter: mergeFilter(filter, {since}), onChunk})
|
||||||
|
|
||||||
const scroller = createScroller(() => {
|
const scroller = createScroller(() => {
|
||||||
if ($modal) {
|
if ($modal) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
return network.load({relays, filter: {...filter, ...cursor.getFilter()}, onChunk})
|
return network.load({relays, filter: mergeFilter(filter, cursor.getFilter()), onChunk})
|
||||||
})
|
})
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
@ -6,7 +6,10 @@
|
|||||||
|
|
||||||
const authors = shuffle(getUserFollows()).slice(0, 256)
|
const authors = shuffle(getUserFollows()).slice(0, 256)
|
||||||
const relays = sampleRelays(getAllPubkeyWriteRelays(authors))
|
const relays = sampleRelays(getAllPubkeyWriteRelays(authors))
|
||||||
const filter = {kinds: [1, 7], authors}
|
|
||||||
|
// Separate notes and reactions into two queries since otherwise reactions dominate,
|
||||||
|
// we never find their parents (or reactions are mostly to a few posts), and the feed sucks
|
||||||
|
const filter = [{kinds: [1], authors}, {kinds: [7], authors}]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Notes {relays} {filter} />
|
<Notes {relays} {filter} />
|
||||||
|
@ -8,7 +8,10 @@
|
|||||||
// sending too many pubkeys. This will also result in some variety.
|
// sending too many pubkeys. This will also result in some variety.
|
||||||
const authors = shuffle(getUserNetwork()).slice(0, 256)
|
const authors = shuffle(getUserNetwork()).slice(0, 256)
|
||||||
const relays = sampleRelays(getAllPubkeyWriteRelays(authors))
|
const relays = sampleRelays(getAllPubkeyWriteRelays(authors))
|
||||||
const filter = {kinds: [1, 7], authors}
|
|
||||||
|
// Separate notes and reactions into two queries since otherwise reactions dominate,
|
||||||
|
// we never find their parents (or reactions are mostly to a few posts), and the feed sucks
|
||||||
|
const filter = [{kinds: [1], authors}, {kinds: [7], authors}]
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<Notes {relays} {filter} />
|
<Notes {relays} {filter} />
|
||||||
|
Loading…
Reference in New Issue
Block a user