mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
fix tun switcher
This commit is contained in:
parent
938802d0bf
commit
924765fa80
@ -86,7 +86,11 @@ const buildContextMenu = (): Menu => {
|
|||||||
checked: getControledMihomoConfig().tun?.enable ?? false,
|
checked: getControledMihomoConfig().tun?.enable ?? false,
|
||||||
click: (item): void => {
|
click: (item): void => {
|
||||||
const enable = item.checked
|
const enable = item.checked
|
||||||
setControledMihomoConfig({ tun: { enable } })
|
if (enable) {
|
||||||
|
setControledMihomoConfig({ tun: { enable }, dns: { enable: true } })
|
||||||
|
} else {
|
||||||
|
setControledMihomoConfig({ tun: { enable } })
|
||||||
|
}
|
||||||
patchMihomoConfig({ tun: { enable } })
|
patchMihomoConfig({ tun: { enable } })
|
||||||
window?.webContents.send('controledMihomoConfigUpdated')
|
window?.webContents.send('controledMihomoConfigUpdated')
|
||||||
updateTrayMenu()
|
updateTrayMenu()
|
||||||
|
|||||||
@ -34,9 +34,9 @@ const TunSwitcher: React.FC = () => {
|
|||||||
if (enable) {
|
if (enable) {
|
||||||
await patchControledMihomoConfig({ tun: { enable }, dns: { enable: true } })
|
await patchControledMihomoConfig({ tun: { enable }, dns: { enable: true } })
|
||||||
} else {
|
} else {
|
||||||
await patchControledMihomoConfig({ tun: { enable }, dns: { enable: true } })
|
await patchControledMihomoConfig({ tun: { enable } })
|
||||||
await patchMihomoConfig({ tun: { enable } })
|
|
||||||
}
|
}
|
||||||
|
await patchMihomoConfig({ tun: { enable } })
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user