diff --git a/src/constants/index.ts b/src/constants/index.ts index 9a9fd39..0a3c058 100644 --- a/src/constants/index.ts +++ b/src/constants/index.ts @@ -36,7 +36,6 @@ export const themes = [ export enum ROUTES { Overview = '/overview', Proxies = '/proxies', - ProxyProvider = '/proxyprovider', Rules = '/rules', Conns = '/conns', Log = '/logs', @@ -148,3 +147,9 @@ export enum TAILWINDCSS_SIZE { MD = 'md', LG = 'lg', } + +export enum MODE_OPTIONS { + Global = 'global', + Rule = 'rule', + Direct = 'direct', +} diff --git a/src/i18n/en.ts b/src/i18n/en.ts index a0948c5..fdb71c6 100644 --- a/src/i18n/en.ts +++ b/src/i18n/en.ts @@ -75,4 +75,7 @@ export default { details: 'Details', endpointURL: 'Endpoint URL', secret: 'Secret', + global: 'Global', + rule: 'Rule', + direct: 'Direct', } diff --git a/src/i18n/zh.ts b/src/i18n/zh.ts index c541912..fe48430 100644 --- a/src/i18n/zh.ts +++ b/src/i18n/zh.ts @@ -75,4 +75,7 @@ export default { details: '详情', endpointURL: '后端地址', secret: '密钥', + global: '全局', + rule: '规则', + direct: '直连', } diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index f4442cb..4b87484 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -14,6 +14,7 @@ import { z } from 'zod' import { Button } from '~/components' import { LANG, + MODE_OPTIONS, PROXIES_ORDERING_TYPE, PROXIES_PREVIEW_TYPE, ROUTES, @@ -24,14 +25,17 @@ import { applyThemeByMode, autoCloseConns, autoSwitchTheme, + backendConfig, favDayTheme, favNightTheme, + fetchBackendConfig, latencyTestTimeoutDuration, proxiesOrderingType, proxiesPreviewType, renderInTwoColumns, setAutoCloseConns, setAutoSwitchTheme, + setBackendConfig, setFavDayTheme, setFavNightTheme, setLatencyTestTimeoutDuration, @@ -43,11 +47,12 @@ import { setTwemoji, setUrlForLatencyTest, tableSize, + updateBackendConfig, urlForLatencyTest, useRequest, useTwemoji, } from '~/signals' -import type { BackendVersion, DNSQuery, Config as IConfig } from '~/types' +import type { BackendVersion, DNSQuery } from '~/types' const dnsQueryFormSchema = z.object({ name: z.string(), @@ -155,8 +160,8 @@ const ConfigForm = () => { >({ extend: validator({ schema: configFormSchema }) }) onMount(async () => { - const configs = await request.get('configs').json() - + const configs = await fetchBackendConfig() + setBackendConfig(configs) setInitialValues(configs) reset() }) @@ -191,6 +196,16 @@ const ConfigForm = () => { return (
+ +
{(item) => ( diff --git a/src/pages/Connections.tsx b/src/pages/Connections.tsx index c9ee74c..3c0ca8d 100644 --- a/src/pages/Connections.tsx +++ b/src/pages/Connections.tsx @@ -334,20 +334,20 @@ export default () => {
setGlobalFilter(e.target.value)} />