feat: outbox model (#4)

This commit is contained in:
Cody Tseng 2024-11-07 21:42:51 +08:00 committed by GitHub
parent bd3078bcd0
commit ead1710392
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
21 changed files with 171 additions and 59 deletions

View file

@ -48,7 +48,8 @@ export function NoteStatsProvider({ children }: { children: React.ReactNode }) {
}, [pubkey])
const fetchNoteLikeCount = async (event: Event) => {
const events = await client.fetchEvents({
const relayList = await client.fetchRelayList(event.pubkey)
const events = await client.fetchEvents(relayList.read, {
'#e': [event.id],
kinds: [kinds.Reaction],
limit: 500
@ -72,7 +73,8 @@ export function NoteStatsProvider({ children }: { children: React.ReactNode }) {
}
const fetchNoteRepostCount = async (event: Event) => {
const events = await client.fetchEvents({
const relayList = await client.fetchRelayList(event.pubkey)
const events = await client.fetchEvents(relayList.read, {
'#e': [event.id],
kinds: [kinds.Repost],
limit: 100
@ -92,7 +94,8 @@ export function NoteStatsProvider({ children }: { children: React.ReactNode }) {
const fetchNoteLikedStatus = async (event: Event) => {
if (!pubkey) return false
const events = await client.fetchEvents({
const relayList = await client.fetchRelayList(pubkey)
const events = await client.fetchEvents(relayList.write, {
'#e': [event.id],
authors: [pubkey],
kinds: [kinds.Reaction]
@ -119,7 +122,8 @@ export function NoteStatsProvider({ children }: { children: React.ReactNode }) {
const fetchNoteRepostedStatus = async (event: Event) => {
if (!pubkey) return false
const events = await client.fetchEvents({
const relayList = await client.fetchRelayList(pubkey)
const events = await client.fetchEvents(relayList.write, {
'#e': [event.id],
authors: [pubkey],
kinds: [kinds.Repost]