fix: resolve system proxy status detection and display inconsistency

- Fixed getSystemProxyActualState logic to properly check actual system status
- Unified system proxy state display across all components
- Replaced systemProxyIndicator with actualState for consistent UI display
- Updated components: setting-system, ProxyControlSwitches, proxy-tun-card
- Added entry to v2.4.0 changelog
This commit is contained in:
Tunglies
2025-08-07 02:18:50 +08:00
parent 8046dad56d
commit 3f5cd6c26a
6 changed files with 21 additions and 21 deletions

View File

@@ -26,6 +26,7 @@
### 🐞 修复问题
- 修复系统代理状态检测和显示不一致问题
- 修复系统主题窗口颜色不一致问题
- 修复特殊字符 URL 处理问题
- 修复配置修改后缓存不同步问题

View File

@@ -16,7 +16,7 @@ identifier = "io.github.clash-verge-rev.clash-verge-rev"
tauri-build = { version = "2.3.1", features = [] }
[dependencies]
warp = { version = "0.4.0", features = ["server"]}
warp = { version = "0.4.0", features = ["server"] }
anyhow = "1.0.98"
dirs = "6.0"
open = "5.3.2"

View File

@@ -146,7 +146,7 @@ export const ProxyTunCard: FC = () => {
const { verge } = useVerge();
const { isAdminMode } = useSystemState();
const { indicator: systemProxyIndicator } = useSystemProxyState();
const { actualState: systemProxyActualState } = useSystemProxyState();
const { enable_tun_mode } = verge ?? {};
@@ -182,7 +182,7 @@ export const ProxyTunCard: FC = () => {
const tabDescription = useMemo(() => {
if (activeTab === "system") {
return {
text: systemProxyIndicator
text: systemProxyActualState
? t("System Proxy Enabled")
: t("System Proxy Disabled"),
tooltip: t("System Proxy Info"),
@@ -197,7 +197,7 @@ export const ProxyTunCard: FC = () => {
tooltip: t("TUN Mode Intercept Info"),
};
}
}, [activeTab, systemProxyIndicator, enable_tun_mode, isTunAvailable, t]);
}, [activeTab, systemProxyActualState, enable_tun_mode, isTunAvailable, t]);
return (
<Box sx={{ display: "flex", flexDirection: "column", width: "100%" }}>
@@ -216,7 +216,7 @@ export const ProxyTunCard: FC = () => {
onClick={() => handleTabChange("system")}
icon={ComputerRounded}
label={t("System Proxy")}
hasIndicator={systemProxyIndicator}
hasIndicator={systemProxyActualState}
/>
<TabButton
isActive={activeTab === "tun"}

View File

@@ -34,11 +34,8 @@ const SettingSystem = ({ onError }: Props) => {
const { verge, mutateVerge, patchVerge } = useVerge();
const { installServiceAndRestartCore } = useServiceInstaller();
const {
actualState: systemProxyActualState,
indicator: systemProxyIndicator,
toggleSystemProxy,
} = useSystemProxyState();
const { actualState: systemProxyActualState, toggleSystemProxy } =
useSystemProxyState();
const { isAdminMode, isServiceMode, mutateRunningMode } = useSystemState();
@@ -179,7 +176,7 @@ const SettingSystem = ({ onError }: Props) => {
icon={SettingsRounded}
onClick={() => sysproxyRef.current?.open()}
/>
{systemProxyIndicator ? (
{systemProxyActualState ? (
<PlayArrowRounded sx={{ color: "success.main", mr: 1 }} />
) : (
<PauseRounded sx={{ color: "error.main", mr: 1 }} />

View File

@@ -40,11 +40,8 @@ const ProxyControlSwitches = ({ label, onError }: ProxySwitchProps) => {
const theme = useTheme();
const { installServiceAndRestartCore } = useServiceInstaller();
const {
actualState: systemProxyActualState,
indicator: systemProxyIndicator,
toggleSystemProxy,
} = useSystemProxyState();
const { actualState: systemProxyActualState, toggleSystemProxy } =
useSystemProxyState();
const { data: runningMode } = useSWR("getRunningMode", getRunningMode);
@@ -99,7 +96,7 @@ const ProxyControlSwitches = ({ label, onError }: ProxySwitchProps) => {
}}
>
<Box sx={{ display: "flex", alignItems: "center" }}>
{systemProxyIndicator ? (
{systemProxyActualState ? (
<PlayCircleOutlineRounded
sx={{ color: "success.main", mr: 1.5, fontSize: 28 }}
/>

View File

@@ -18,13 +18,18 @@ export const useSystemProxyState = () => {
const getSystemProxyActualState = () => {
const userEnabled = enable_system_proxy ?? false;
// 用户配置状态应该与系统实际状态一致
// 如果用户启用了系统代理,检查实际的系统状态
if (userEnabled) {
return true;
if (proxy_auto_config) {
return autoproxy?.enable ?? false;
} else {
return sysproxy?.enable ?? false;
}
}
return autoproxy?.enable === false && sysproxy?.enable === false
? false
: userEnabled;
// 用户没有启用时,返回 false
return false;
};
const getSystemProxyIndicator = () => {