polish webui and add desktop gateway service support

This commit is contained in:
lpf
2026-03-10 21:25:01 +08:00
parent 74a10ed4e3
commit cfab4cd1cc
22 changed files with 712 additions and 364 deletions

View File

@@ -4,6 +4,7 @@ import (
"fmt"
"os"
"path/filepath"
"runtime"
)
func uninstallCmd() {
@@ -52,6 +53,28 @@ func uninstallCmd() {
}
func uninstallGatewayService() error {
switch runtime.GOOS {
case "darwin":
scope, plistPath, err := detectInstalledLaunchdService()
if err != nil {
return nil
}
_ = runLaunchctl(scope, "bootout", launchdDomainTarget(scope), plistPath)
if err := os.Remove(plistPath); err != nil && !os.IsNotExist(err) {
return fmt.Errorf("remove launchd plist failed: %w", err)
}
return nil
case "windows":
_, taskName, err := detectInstalledWindowsTask()
if err != nil {
return nil
}
_ = stopGatewayProcessByPIDFile()
if err := runSCHTASKS("/Delete", "/TN", taskName, "/F"); err != nil {
return err
}
return nil
}
scope, unitPath, err := detectInstalledGatewayService()
if err != nil {
return nil