auto restart core

This commit is contained in:
pompurin404 2024-08-14 15:19:19 +08:00
parent 559e8f247e
commit cfec86102f
No known key found for this signature in database

View File

@ -3,7 +3,12 @@ import { useControledMihomoConfig } from '@renderer/hooks/use-controled-mihomo-c
import BorderSwitch from '@renderer/components/base/border-swtich'
import { TbDeviceIpadHorizontalBolt } from 'react-icons/tb'
import { useLocation, useNavigate } from 'react-router-dom'
import { encryptString, patchMihomoConfig, isEncryptionAvailable } from '@renderer/utils/ipc'
import {
encryptString,
patchMihomoConfig,
isEncryptionAvailable,
restartCore
} from '@renderer/utils/ipc'
import { useSortable } from '@dnd-kit/sortable'
import { CSS } from '@dnd-kit/utilities'
import { platform } from '@renderer/utils/init'
@ -66,7 +71,8 @@ const TunSwitcher: React.FC = () => {
onCancel={() => setOpenPasswordModal(false)}
onConfirm={async (password: string) => {
const encrypted = await encryptString(password)
patchAppConfig({ encryptedPassword: encrypted })
await patchAppConfig({ encryptedPassword: encrypted })
await restartCore()
setOpenPasswordModal(false)
}}
/>