Unverified Commit a0bcecc8 authored by Pol Dellaiera's avatar Pol Dellaiera Committed by GitHub
Browse files

gui-for-singbox: 1.9.6 -> 1.9.7 (#406615)

parents fbd8eb42 0dc8d85b
Loading
Loading
Loading
Loading
+17 −25
Original line number Diff line number Diff line
--- a/bridge/bridge.go	2024-12-25 20:53:45.504021585 +0000
+++ b/bridge/bridge.go	2024-12-25 21:02:20.318422528 +0000
@@ -38,11 +38,6 @@
--- a/bridge/bridge.go	2025-05-13 07:36:58.578038227 +0000
+++ b/bridge/bridge.go	2025-05-13 07:39:01.667180229 +0000
@@ -41,13 +41,13 @@
 }

 func InitBridge(fs embed.FS) {
 	// step1: Set Env
 func CreateApp(fs embed.FS) *App {
-	exePath, err := os.Executable()
-	if err != nil {
-		panic(err)
-	}
-
 	for _, v := range os.Args {
 		if v == "tasksch" {
 			Env.FromTaskSch = true
@@ -50,8 +45,13 @@
 		}
 	}
 
-	Env.BasePath = filepath.Dir(exePath)
-	Env.AppName = filepath.Base(exePath)
+	Env.AppName = "GUI.for.SingBox"
+	xdgDataHome := os.Getenv("XDG_DATA_HOME")
+	if xdgDataHome == "" {
+		homeDir, _ := os.UserHomeDir()
+		xdgDataHome = filepath.Join(homeDir, ".local", "share")
+	}
 	}
-
-	Env.BasePath = filepath.Dir(exePath)
-	Env.AppName = filepath.Base(exePath)
+	Env.BasePath = filepath.Join(xdgDataHome, Env.AppName)

 	// step2: Create a persistent data symlink
 	if Env.OS == "darwin" {
@@ -128,7 +128,7 @@
 	if slices.Contains(os.Args, "tasksch") {
 		Env.FromTaskSch = true
@@ -76,7 +76,7 @@
 }

 func (a *App) RestartApp() FlagResult {
@@ -36,4 +28,4 @@
+	exePath := "@basepath@/bin" + "/" + Env.AppName

 	cmd := exec.Command(exePath)
 	HideExecWindow(cmd)
 	SetCmdWindowHidden(cmd)
 No newline at end of file
+7 −11
Original line number Diff line number Diff line
{
  lib,
  stdenv,
  nodejs,
  pnpm_9,
  fetchFromGitHub,
  buildGoModule,
  lib,
  wails,
  webkitgtk_4_0,
  pkg-config,
@@ -17,13 +17,13 @@

let
  pname = "gui-for-singbox";
  version = "1.9.6";
  version = "1.9.7";

  src = fetchFromGitHub {
    owner = "GUI-for-Cores";
    repo = "GUI.for.SingBox";
    tag = "v${version}";
    hash = "sha256-qmYZWLzGAjUlbORhr67KqhTTeOxskAb7/HO+pPZ6uQE=";
    hash = "sha256-2wmg0qPXFRuVd5jU1RT9QuqEaG/h2R+VSNeniVZELLk=";
  };

  metaCommon = {
@@ -45,7 +45,7 @@ let
    pnpmDeps = pnpm_9.fetchDeps {
      inherit (finalAttrs) pname version src;
      sourceRoot = "${finalAttrs.src.name}/frontend";
      hash = "sha256-RIkdnDyHjl5C0+Hdtne1NYEh46+yylW7Q/agT7AtDBo=";
      hash = "sha256-5tz1FItH9AvZhJjka8i5Kz22yf/tEmRPkDhz6iswZzc=";
    };

    sourceRoot = "${finalAttrs.src.name}/frontend";
@@ -81,7 +81,7 @@ buildGoModule {
      --replace-fail '@basepath@' "$out"
  '';

  vendorHash = "sha256-4MPKAI1/F/sgfUORulhcpKJYHX7LpLknlzZx4DqnCfY=";
  vendorHash = "sha256-Coq8GtaIS7ClmOTFw6PSgGDFW/CpGpKPvXgNw8qz3Hs=";

  nativeBuildInputs = [
    wails
@@ -114,12 +114,8 @@ buildGoModule {
      icon = "gui-for-singbox";
      genericName = "GUI.for.SingBox";
      desktopName = "GUI.for.SingBox";
      categories = [
        "Network"
      ];
      keywords = [
        "Proxy"
      ];
      categories = [ "Network" ];
      keywords = [ "Proxy" ];
    })
  ];