mirror of
https://gh.catmak.name/https://github.com/mihomo-party-org/mihomo-party
synced 2025-12-27 21:20:29 +08:00
auto restart
This commit is contained in:
parent
7504fd8010
commit
c2179c94f4
@ -4,7 +4,7 @@ import SettingItem from '../base/base-setting-item'
|
|||||||
import { Input, Select, SelectItem, Switch } from '@nextui-org/react'
|
import { Input, Select, SelectItem, Switch } from '@nextui-org/react'
|
||||||
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
import { useAppConfig } from '@renderer/hooks/use-app-config'
|
||||||
import debounce from '@renderer/utils/debounce'
|
import debounce from '@renderer/utils/debounce'
|
||||||
import { patchControledMihomoConfig } from '@renderer/utils/ipc'
|
import { patchControledMihomoConfig, restartCore } from '@renderer/utils/ipc'
|
||||||
|
|
||||||
const MihomoConfig: React.FC = () => {
|
const MihomoConfig: React.FC = () => {
|
||||||
const { appConfig, patchAppConfig } = useAppConfig()
|
const { appConfig, patchAppConfig } = useAppConfig()
|
||||||
@ -84,8 +84,13 @@ const MihomoConfig: React.FC = () => {
|
|||||||
size="sm"
|
size="sm"
|
||||||
isSelected={controlDns}
|
isSelected={controlDns}
|
||||||
onValueChange={async (v) => {
|
onValueChange={async (v) => {
|
||||||
|
try {
|
||||||
await patchAppConfig({ controlDns: v })
|
await patchAppConfig({ controlDns: v })
|
||||||
await patchControledMihomoConfig({})
|
await patchControledMihomoConfig({})
|
||||||
|
await restartCore()
|
||||||
|
} catch (e) {
|
||||||
|
alert(e)
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
@ -94,8 +99,13 @@ const MihomoConfig: React.FC = () => {
|
|||||||
size="sm"
|
size="sm"
|
||||||
isSelected={controlSniff}
|
isSelected={controlSniff}
|
||||||
onValueChange={async (v) => {
|
onValueChange={async (v) => {
|
||||||
|
try {
|
||||||
await patchAppConfig({ controlSniff: v })
|
await patchAppConfig({ controlSniff: v })
|
||||||
await patchControledMihomoConfig({})
|
await patchControledMihomoConfig({})
|
||||||
|
await restartCore()
|
||||||
|
} catch (e) {
|
||||||
|
alert(e)
|
||||||
|
}
|
||||||
}}
|
}}
|
||||||
/>
|
/>
|
||||||
</SettingItem>
|
</SettingItem>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user