From cfec86102faf9119a932255742ef0d65161558f1 Mon Sep 17 00:00:00 2001 From: pompurin404 Date: Wed, 14 Aug 2024 15:19:19 +0800 Subject: [PATCH] auto restart core --- src/renderer/src/components/sider/tun-switcher.tsx | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/renderer/src/components/sider/tun-switcher.tsx b/src/renderer/src/components/sider/tun-switcher.tsx index 2b64b75..f2d1b3a 100644 --- a/src/renderer/src/components/sider/tun-switcher.tsx +++ b/src/renderer/src/components/sider/tun-switcher.tsx @@ -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) }} />