chore(lint): fix eslint and typescript issues; no rule changes

This commit is contained in:
Gigi
2025-10-12 22:55:46 +02:00
parent 484c2e0c2f
commit e1420140d1
4 changed files with 15 additions and 12 deletions

View File

@@ -11,7 +11,7 @@ interface UseExternalUrlLoaderProps {
setReaderContent: (content: ReadableContent | undefined) => void setReaderContent: (content: ReadableContent | undefined) => void
setReaderLoading: (loading: boolean) => void setReaderLoading: (loading: boolean) => void
setIsCollapsed: (collapsed: boolean) => void setIsCollapsed: (collapsed: boolean) => void
setHighlights: (highlights: Highlight[]) => void setHighlights: (highlights: Highlight[] | ((prev: Highlight[]) => Highlight[])) => void
setHighlightsLoading: (loading: boolean) => void setHighlightsLoading: (loading: boolean) => void
setCurrentArticleCoordinate: (coord: string | undefined) => void setCurrentArticleCoordinate: (coord: string | undefined) => void
setCurrentArticleEventId: (id: string | undefined) => void setCurrentArticleEventId: (id: string | undefined) => void

View File

@@ -1,4 +1,4 @@
import { RelayPool, completeOnEose, onlyEvents } from 'applesauce-relay' import { RelayPool, onlyEvents } from 'applesauce-relay'
import { lastValueFrom, take, takeUntil, timer, toArray } from 'rxjs' import { lastValueFrom, take, takeUntil, timer, toArray } from 'rxjs'
import { nip19 } from 'nostr-tools' import { nip19 } from 'nostr-tools'
import { AddressPointer } from 'nostr-tools/nip19' import { AddressPointer } from 'nostr-tools/nip19'
@@ -103,7 +103,7 @@ export async function fetchArticleByNaddr(
? pointer.relays ? pointer.relays
: RELAYS : RELAYS
const orderedRelays = prioritizeLocalRelays(baseRelays) const orderedRelays = prioritizeLocalRelays(baseRelays)
const { local: localRelays, remote: remoteRelays } = partitionRelays(orderedRelays) const { local: localRelays } = partitionRelays(orderedRelays)
// Fetch the article event // Fetch the article event
const filter = { const filter = {

View File

@@ -1,4 +1,4 @@
import { RelayPool, completeOnEose, onlyEvents } from 'applesauce-relay' import { RelayPool, onlyEvents } from 'applesauce-relay'
import { lastValueFrom, take, takeUntil, timer, toArray } from 'rxjs' import { lastValueFrom, take, takeUntil, timer, toArray } from 'rxjs'
import { nip19 } from 'nostr-tools' import { nip19 } from 'nostr-tools'
import { AddressPointer } from 'nostr-tools/nip19' import { AddressPointer } from 'nostr-tools/nip19'
@@ -40,7 +40,7 @@ export async function fetchArticleTitle(
} }
// Try to get the first event quickly from local relays // Try to get the first event quickly from local relays
let events = [] as any[] let events: { created_at: number }[] = []
if (localRelays.length > 0) { if (localRelays.length > 0) {
try { try {
events = await lastValueFrom( events = await lastValueFrom(
@@ -54,11 +54,12 @@ export async function fetchArticleTitle(
} }
// Fallback to all relays if nothing from local quickly // Fallback to all relays if nothing from local quickly
if (events.length === 0) { if (events.length === 0) {
events = await lastValueFrom( const fallbackEvents = await lastValueFrom(
relayPool relayPool
.req(orderedRelays, filter) .req(orderedRelays, filter)
.pipe(onlyEvents(), take(1), takeUntil(timer(5000)), toArray()) .pipe(onlyEvents(), take(1), takeUntil(timer(5000)), toArray())
) )
events = fallbackEvents as { created_at: number }[]
} }
if (events.length === 0) { if (events.length === 0) {
@@ -67,7 +68,7 @@ export async function fetchArticleTitle(
// Sort by created_at and take the most recent // Sort by created_at and take the most recent
events.sort((a, b) => b.created_at - a.created_at) events.sort((a, b) => b.created_at - a.created_at)
const article = events[0] const article = events[0] as unknown as Parameters<typeof getArticleTitle>[0]
return getArticleTitle(article) || null return getArticleTitle(article) || null
} catch (err) { } catch (err) {

View File

@@ -20,19 +20,20 @@ export const fetchContacts = async (
// Local-first quick attempt // Local-first quick attempt
const localRelays = relayUrls.filter(url => url.includes('localhost') || url.includes('127.0.0.1')) const localRelays = relayUrls.filter(url => url.includes('localhost') || url.includes('127.0.0.1'))
let events = [] as any[] let events: Array<{ created_at: number; tags: string[][] }> = []
if (localRelays.length > 0) { if (localRelays.length > 0) {
try { try {
events = await lastValueFrom( const localEvents = await lastValueFrom(
relayPool relayPool
.req(localRelays, { kinds: [3], authors: [pubkey] }) .req(localRelays, { kinds: [3], authors: [pubkey] })
.pipe(completeOnEose(), takeUntil(timer(1200)), toArray()) .pipe(completeOnEose(), takeUntil(timer(1200)), toArray())
) )
events = localEvents as Array<{ created_at: number; tags: string[][] }>
} catch { } catch {
events = [] events = []
} }
} }
let followed = new Set<string>() const followed = new Set<string>()
if (events.length > 0) { if (events.length > 0) {
// Get the most recent contact list // Get the most recent contact list
const sortedEvents = events.sort((a, b) => b.created_at - a.created_at) const sortedEvents = events.sort((a, b) => b.created_at - a.created_at)
@@ -55,8 +56,9 @@ export const fetchContacts = async (
.pipe(completeOnEose(), takeUntil(timer(6000)), toArray()) .pipe(completeOnEose(), takeUntil(timer(6000)), toArray())
) )
if (remoteEvents.length > 0) { if (remoteEvents.length > 0) {
const sortedEvents = remoteEvents.sort((a, b) => b.created_at - a.created_at) const sortedRemote = (remoteEvents as Array<{ created_at: number; tags: string[][] }>).
const contactList = sortedEvents[0] sort((a, b) => b.created_at - a.created_at)
const contactList = sortedRemote[0]
for (const tag of contactList.tags) { for (const tag of contactList.tags) {
if (tag[0] === 'p' && tag[1]) { if (tag[0] === 'p' && tag[1]) {
followed.add(tag[1]) followed.add(tag[1])