From 1ca89fb6c736bcdb4d4b84552828fc7df3fa131d Mon Sep 17 00:00:00 2001 From: Zephyruso <176294927+Zephyruso@users.noreply.github.com> Date: Sun, 24 Nov 2024 15:01:48 +0800 Subject: [PATCH] feat: modes list for sing-box offical (#1182) --- src/pages/Config.tsx | 8 +++++--- src/types/index.d.ts | 3 +++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/pages/Config.tsx b/src/pages/Config.tsx index 8458565..75c649b 100644 --- a/src/pages/Config.tsx +++ b/src/pages/Config.tsx @@ -232,9 +232,11 @@ const ConfigForm: ParentComponent<{ } }) - const modes = createMemo( - () => configsData()?.modes || ['rule', 'direct', 'global'], - ) + const modes = createMemo(() => { + const cfg = configsData() + + return cfg?.['mode-list'] || cfg?.modes || ['rule', 'direct', 'global'] + }) return (
diff --git a/src/types/index.d.ts b/src/types/index.d.ts index ca58914..af04a4f 100644 --- a/src/types/index.d.ts +++ b/src/types/index.d.ts @@ -119,6 +119,9 @@ export type LogWithSeq = Log & { seq: number } export type Config = { mode: string + // sing-box added + 'mode-list': string[] + // sing-box-p added modes?: string[] port: number 'socks-port': number