feat: allow changing default relays

This commit is contained in:
codytseng 2026-01-04 23:40:43 +08:00
parent 36959a1052
commit 53a67d8233
44 changed files with 356 additions and 92 deletions

View file

@ -3,9 +3,10 @@ import FollowingFavoriteRelayList from '@/components/FollowingFavoriteRelayList'
import NoteList from '@/components/NoteList'
import Tabs from '@/components/Tabs'
import { Button } from '@/components/ui/button'
import { BIG_RELAY_URLS, ExtendedKind } from '@/constants'
import { ExtendedKind } from '@/constants'
import PrimaryPageLayout from '@/layouts/PrimaryPageLayout'
import { getReplaceableEventIdentifier } from '@/lib/event'
import { getDefaultRelayUrls } from '@/lib/relay'
import { isLocalNetworkUrl, isOnionUrl, isWebsocketUrl } from '@/lib/url'
import storage from '@/services/local-storage.service'
import { TPageRef } from '@/types'
@ -42,7 +43,7 @@ const ExplorePage = forwardRef<TPageRef>((_, ref) => {
) : tab === 'reviews' ? (
<NoteList
showKinds={[ExtendedKind.RELAY_REVIEW]}
subRequests={[{ urls: BIG_RELAY_URLS, filter: {} }]}
subRequests={[{ urls: getDefaultRelayUrls(), filter: {} }]}
filterFn={relayReviewFilterFn}
filterMutedNotes
hideSpam

View file

@ -1,8 +1,8 @@
import EmojiPackList from '@/components/EmojiPackList'
import NoteList from '@/components/NoteList'
import Tabs from '@/components/Tabs'
import { BIG_RELAY_URLS } from '@/constants'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { getDefaultRelayUrls } from '@/lib/relay'
import { kinds } from 'nostr-tools'
import { forwardRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
@ -30,7 +30,7 @@ const EmojiPackSettingsPage = forwardRef(({ index }: { index?: number }, ref) =>
) : (
<NoteList
showKinds={[kinds.Emojisets]}
subRequests={[{ urls: BIG_RELAY_URLS, filter: {} }]}
subRequests={[{ urls: getDefaultRelayUrls(), filter: {} }]}
/>
)}
</SecondaryPageLayout>

View file

@ -1,10 +1,11 @@
import { Favicon } from '@/components/Favicon'
import NormalFeed from '@/components/NormalFeed'
import { Button } from '@/components/ui/button'
import { BIG_RELAY_URLS, SEARCHABLE_RELAY_URLS } from '@/constants'
import { SEARCHABLE_RELAY_URLS } from '@/constants'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { toProfileList } from '@/lib/link'
import { fetchPubkeysFromDomain, getWellKnownNip05Url } from '@/lib/nip05'
import { getDefaultRelayUrls } from '@/lib/relay'
import { useSecondaryPage } from '@/PageManager'
import { useNostr } from '@/providers/NostrProvider'
import client from '@/services/client.service'
@ -47,7 +48,7 @@ const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => {
setSubRequests([
{
filter: { '#t': [hashtag], ...(kinds.length > 0 ? { kinds } : {}) },
urls: BIG_RELAY_URLS
urls: getDefaultRelayUrls()
}
])
return

View file

@ -1,6 +1,7 @@
import NoteList from '@/components/NoteList'
import { BIG_RELAY_URLS, ExtendedKind } from '@/constants'
import { ExtendedKind } from '@/constants'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { getDefaultRelayUrls } from '@/lib/relay'
import { normalizeUrl, simplifyUrl } from '@/lib/url'
import { forwardRef, useMemo } from 'react'
import { useTranslation } from 'react-i18next'
@ -24,7 +25,7 @@ const RelayReviewsPage = forwardRef(({ url, index }: { url?: string; index?: num
showKinds={[ExtendedKind.RELAY_REVIEW]}
subRequests={[
{
urls: [normalizedUrl, ...BIG_RELAY_URLS],
urls: [normalizedUrl, ...getDefaultRelayUrls()],
filter: { '#d': [normalizedUrl] }
}
]}

View file

@ -1,3 +1,4 @@
import DefaultRelaysSetting from '@/components/DefaultRelaysSetting'
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Switch } from '@/components/ui/switch'
@ -43,6 +44,9 @@ const SystemSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
}}
/>
</div>
<div className="px-4 space-y-2">
<DefaultRelaysSetting />
</div>
</div>
</SecondaryPageLayout>
)