diff --git a/src/components/ProxyNodePreview.tsx b/src/components/ProxyNodePreview.tsx index d0b6421..df0b4f2 100644 --- a/src/components/ProxyNodePreview.tsx +++ b/src/components/ProxyNodePreview.tsx @@ -1,6 +1,6 @@ import { Show, createMemo } from 'solid-js' import { PROXIES_PREVIEW_TYPE } from '~/config/enum' -import { proxiesPreviewType } from '~/pages/Config' +import { proxiesPreviewType } from '~/signals/config' import ProxyPreviewBar from './ProxyPreviewBar' import ProxyPreviewDots from './ProxyPreviewDots' diff --git a/src/i18n/en.ts b/src/i18n/en.ts index 4d9f6da..cf626ab 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -39,4 +39,5 @@ export default { auto: 'Auto', proxiesPreviewType: 'Proxies preview type', urlForDelayTest: 'Url for delay test', + autoCloseConns: 'Automatically close all connections', } diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index d5d93b2..6f1aeb7 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -39,4 +39,5 @@ export default { auto: '自适应', proxiesPreviewType: '节点组预览样式', urlForDelayTest: '测速链接', + autoCloseConns: '切换代理时自动断开全部连接', } diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 7800a04..b4ade0c 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -1,11 +1,18 @@ import { createForm } from '@felte/solid' import { validator } from '@felte/validator-zod' import { useI18n } from '@solid-primitives/i18n' -import { makePersisted } from '@solid-primitives/storage' import { For, Show, createSignal, onMount } from 'solid-js' import { z } from 'zod' import { PROXIES_PREVIEW_TYPE } from '~/config/enum' import { useRequest } from '~/signals' +import { + autoCloseConns, + proxiesPreviewType, + setAutoCloseConns, + setProxiesPreviewType, + setUrlForDelayTest, + urlForDelayTest, +} from '~/signals/config' import type { DNSQuery, Config as IConfig } from '~/types' const dnsQueryFormSchema = z.object({ @@ -128,47 +135,54 @@ const ConfigForm = () => { ) } -export const [proxiesPreviewType, setProxiesPreviewType] = makePersisted( - createSignal(PROXIES_PREVIEW_TYPE.BAR), - { name: 'proxiesPreviewType', storage: localStorage }, -) -export const [urlForDelayTest, setUrlForDelayTest] = makePersisted( - createSignal('https://www.gstatic.com/generate_204'), - { name: 'urlForDelayTest', storage: localStorage }, -) - const ConfigForXd = () => { const [t] = useI18n() return ( - <> -