fix: improve Service connection method and permissions for Windows and Unix

This commit is contained in:
Tunglies
2025-10-11 23:40:37 +08:00
parent 4f1d61a56e
commit d531432f4a
16 changed files with 535 additions and 779 deletions

View File

@@ -3,6 +3,7 @@ import { useCallback } from "react";
import { installService, restartCore } from "@/services/cmds";
import { showNotice } from "@/services/noticeService";
import { useSystemState } from "./use-system-state";
const executeWithErrorHandling = async (
operation: () => Promise<void>,
@@ -23,6 +24,8 @@ const executeWithErrorHandling = async (
};
export const useServiceInstaller = () => {
const { mutateRunningMode, mutateServiceOk } = useSystemState();
const installServiceAndRestartCore = useCallback(async () => {
await executeWithErrorHandling(
() => installService(),
@@ -31,6 +34,6 @@ export const useServiceInstaller = () => {
);
await executeWithErrorHandling(() => restartCore(), "Restarting Core...");
}, []);
}, [mutateRunningMode, mutateServiceOk]);
return { installServiceAndRestartCore };
};