feat: add option to disable filtering for onion relays

This commit is contained in:
codytseng 2025-11-15 13:58:20 +08:00
parent 606f9af1ba
commit 5ba5c26fcd
25 changed files with 98 additions and 36 deletions

View file

@ -1,14 +1,19 @@
import { Input } from '@/components/ui/input'
import { Label } from '@/components/ui/label'
import { Switch } from '@/components/ui/switch'
import { DEFAULT_FAVICON_URL_TEMPLATE } from '@/constants'
import SecondaryPageLayout from '@/layouts/SecondaryPageLayout'
import { useContentPolicy } from '@/providers/ContentPolicyProvider'
import { forwardRef } from 'react'
import storage from '@/services/local-storage.service'
import { forwardRef, useState } from 'react'
import { useTranslation } from 'react-i18next'
const SystemSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
const { t } = useTranslation()
const { faviconUrlTemplate, setFaviconUrlTemplate } = useContentPolicy()
const [filterOutOnionRelays, setFilterOutOnionRelays] = useState(
storage.getFilterOutOnionRelays()
)
return (
<SecondaryPageLayout ref={ref} index={index} title={t('System')}>
@ -25,6 +30,19 @@ const SystemSettingsPage = forwardRef(({ index }: { index?: number }, ref) => {
placeholder={DEFAULT_FAVICON_URL_TEMPLATE}
/>
</div>
<div className="flex justify-between items-center px-4 min-h-9">
<Label htmlFor="filter-out-onion-relays" className="text-base font-normal">
{t('Filter out onion relays')}
</Label>
<Switch
id="filter-out-onion-relays"
checked={filterOutOnionRelays}
onCheckedChange={(checked) => {
storage.setFilterOutOnionRelays(checked)
setFilterOutOnionRelays(checked)
}}
/>
</div>
</div>
</SecondaryPageLayout>
)