feat: auto restart core after grand permission

This commit is contained in:
GyDi 2023-03-16 21:32:39 +08:00
parent c8d9951ae4
commit b9976ee68e

View File

@ -59,6 +59,8 @@ export const ClashCoreViewer = forwardRef<DialogRef>((props, ref) => {
const onGrant = useLockFn(async (core: string) => { const onGrant = useLockFn(async (core: string) => {
try { try {
await grantPermission(core); await grantPermission(core);
// 自动重启
if (core === clash_core) await restartSidecar();
Notice.success(`Successfully grant permission to ${core}`, 1000); Notice.success(`Successfully grant permission to ${core}`, 1000);
} catch (err: any) { } catch (err: any) {
Notice.error(err?.message || err.toString()); Notice.error(err?.message || err.toString());