feat: add customizable search relays setting

Replace hardcoded SEARCHABLE_RELAY_URLS with user-configurable search
relays stored in localStorage. Add SearchRelaysSetting UI in System
settings page with add/remove/reset functionality.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
codytseng 2026-03-12 23:19:47 +08:00
parent 7be7b30d52
commit aae8fc2f17
27 changed files with 202 additions and 50 deletions

View file

@ -1,11 +1,10 @@
import { Favicon } from '@/components/Favicon'
import NormalFeed from '@/components/NormalFeed'
import { Button } from '@/components/ui/button'
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 { getDefaultRelayUrls, getSearchRelayUrls } from '@/lib/relay'
import { useSecondaryPage } from '@/PageManager'
import { useNostr } from '@/providers/NostrProvider'
import client from '@/services/client.service'
@ -60,7 +59,7 @@ const NoteListPage = forwardRef(({ index }: { index?: number }, ref) => {
setSubRequests([
{
filter: { search, ...(kinds.length > 0 ? { kinds } : {}) },
urls: SEARCHABLE_RELAY_URLS
urls: getSearchRelayUrls()
}
])
return

View file

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