From cc39b2734ecbe3ac9c3c2def3a52f5736391fce2 Mon Sep 17 00:00:00 2001 From: Tunglies Date: Thu, 12 Jun 2025 22:42:33 +0800 Subject: [PATCH] fix: enhance system proxy toggle logic to account for autoproxy and sysproxy states --- src/components/setting/setting-system.tsx | 30 ++++++++++++++++++++--- 1 file changed, 27 insertions(+), 3 deletions(-) diff --git a/src/components/setting/setting-system.tsx b/src/components/setting/setting-system.tsx index d276af5d..f892bc8e 100644 --- a/src/components/setting/setting-system.tsx +++ b/src/components/setting/setting-system.tsx @@ -210,12 +210,29 @@ const SettingSystem = ({ onError }: Props) => { } > onChangeData({ enable_system_proxy: e })} + onChange={(e) => { + if (autoproxy?.enable === false && sysproxy?.enable === false) { + onChangeData({ enable_system_proxy: !enable_system_proxy }); + } else { + onChangeData({ enable_system_proxy: e }); + } + }} onGuard={async (e) => { + if (autoproxy?.enable === false && sysproxy?.enable === false) { + await patchVerge({ enable_system_proxy: !enable_system_proxy }); + await updateProxyStatus(); + return; + } if (!e && verge?.auto_close_connection) { closeAllConnections(); } @@ -223,7 +240,14 @@ const SettingSystem = ({ onError }: Props) => { await updateProxyStatus(); }} > - +