fix: sync system proxy status indicator with hotkey

This commit is contained in:
wonfen 2025-03-04 06:57:42 +08:00
parent 73310b466b
commit 44ca513241
2 changed files with 13 additions and 8 deletions

View File

@ -54,10 +54,6 @@ const SettingSystem = ({ onError }: Props) => {
proxy_auto_config, proxy_auto_config,
} = verge ?? {}; } = verge ?? {};
const isProxyEnabled = proxy_auto_config
? autoproxy?.enable
: sysproxy?.enable;
const onSwitchFormat = (_e: any, value: boolean) => value; const onSwitchFormat = (_e: any, value: boolean) => value;
const onChangeData = (patch: Partial<IVergeConfig>) => { const onChangeData = (patch: Partial<IVergeConfig>) => {
mutateVerge({ ...verge, ...patch }, false); mutateVerge({ ...verge, ...patch }, false);
@ -149,7 +145,13 @@ const SettingSystem = ({ onError }: Props) => {
icon={SettingsRounded} icon={SettingsRounded}
onClick={() => sysproxyRef.current?.open()} onClick={() => sysproxyRef.current?.open()}
/> />
{isProxyEnabled ? ( {proxy_auto_config ? (
autoproxy?.enable ? (
<PlayArrowRounded sx={{ color: "success.main", mr: 1 }} />
) : (
<PauseRounded sx={{ color: "error.main", mr: 1 }} />
)
) : sysproxy?.enable ? (
<PlayArrowRounded sx={{ color: "success.main", mr: 1 }} /> <PlayArrowRounded sx={{ color: "success.main", mr: 1 }} />
) : ( ) : (
<PauseRounded sx={{ color: "error.main", mr: 1 }} /> <PauseRounded sx={{ color: "error.main", mr: 1 }} />

View File

@ -166,9 +166,12 @@ const Layout = () => {
}), }),
// verge 配置更新监听 // verge 配置更新监听
addListener("verge://refresh-verge-config", () => addListener("verge://refresh-verge-config", () => {
mutate("getVergeConfig"), mutate("getVergeConfig");
), // 添加对系统代理状态的刷新
mutate("getSystemProxy");
mutate("getAutotemProxy");
}),
// 通知消息监听 // 通知消息监听
addListener("verge://notice-message", ({ payload }) => addListener("verge://notice-message", ({ payload }) =>