gui-for-singbox: 1.8.9 -> 1.9.0 (#368130)

This commit is contained in:
Christian Kögler
2024-12-30 12:45:24 +01:00
committed by GitHub
2 changed files with 33 additions and 25 deletions
+11 -6
View File
@@ -1,5 +1,5 @@
--- old/bridge/bridge.go 2024-11-03 02:07:33.553972040 +0800
+++ new/bridge/bridge.go 2024-11-03 02:10:09.239584378 +0800
--- 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 @@
func InitBridge(fs embed.FS) {
@@ -12,23 +12,28 @@
for _, v := range os.Args {
if v == "tasksch" {
Env.FromTaskSch = true
@@ -50,8 +45,8 @@
@@ -50,8 +45,13 @@
}
}
- Env.BasePath = filepath.Dir(exePath)
- Env.AppName = filepath.Base(exePath)
+ Env.AppName = "GUI.for.SingBox"
+ Env.BasePath = filepath.Join(os.Getenv("HOME"), ".config", Env.AppName)
+ xdgDataHome := os.Getenv("XDG_DATA_HOME")
+ if xdgDataHome == "" {
+ homeDir, _ := os.UserHomeDir()
+ xdgDataHome = filepath.Join(homeDir, ".local", "share")
+ }
+ Env.BasePath = filepath.Join(xdgDataHome, Env.AppName)
// step2: Create a persistent data symlink
if Env.OS == "darwin" {
@@ -128,7 +123,7 @@
@@ -128,7 +128,7 @@
}
func (a *App) RestartApp() FlagResult {
- exePath := Env.BasePath + "/" + Env.AppName
+ exePath := Env.AppName
+ exePath := "@basepath@/bin" + "/" + Env.AppName
cmd := exec.Command(exePath)
HideExecWindow(cmd)
+22 -19
View File
@@ -9,20 +9,22 @@
webkitgtk_4_0,
pkg-config,
libsoup_3,
wrapGAppsHook3,
autoPatchelfHook,
makeDesktopItem,
copyDesktopItems,
replaceVars,
}:
let
pname = "gui-for-singbox";
version = "1.8.9";
version = "1.9.0";
src = fetchFromGitHub {
owner = "GUI-for-Cores";
repo = "GUI.for.SingBox";
rev = "v${version}";
hash = "sha256-mN+j2O/pM+kblmxZjVWvHXLHJSxydxLRh/Fol2+WALE=";
tag = "v${version}";
hash = "sha256-5zd4CVWVR+E3E097Xjd/V6QFRV9Ye2UQvBalAQ9zqXc=";
};
frontend = stdenv.mkDerivation (finalAttrs: {
inherit pname version src;
@@ -34,7 +36,7 @@ let
pnpmDeps = pnpm.fetchDeps {
inherit (finalAttrs) pname version src;
sourceRoot = "${finalAttrs.src.name}/frontend";
hash = "sha256-bAgyGZLmEr8tMunoeQHl+B2IDGr4Gw3by1lC811lqio=";
hash = "sha256-dLI1YMzs9lLk9lJBkBgc6cpirM79khy0g5VaOVEzUAc=";
};
sourceRoot = "${finalAttrs.src.name}/frontend";
@@ -42,7 +44,7 @@ let
buildPhase = ''
runHook preBuild
pnpm run build
pnpm run build-only
runHook postBuild
'';
@@ -50,8 +52,7 @@ let
installPhase = ''
runHook preInstall
mkdir $out/
cp -r ./dist/* $out/
cp -r ./dist $out
runHook postInstall
'';
@@ -67,12 +68,17 @@ in
buildGoModule {
inherit pname version src;
vendorHash = "sha256-rDbJOj8t/qu04Rd8J0LnXiBoIDmdzBQ9avAhImK7dFg=";
patches = [
(replaceVars ./bridge.patch {
basepath = placeholder "out";
})
];
vendorHash = "sha256-OrysyJF+lUMf+0vWmOZHjxUdE6fQCKArmpV4alXxtYs=";
nativeBuildInputs = [
wails
pkg-config
wrapGAppsHook3
autoPatchelfHook
copyDesktopItems
];
@@ -84,9 +90,9 @@ buildGoModule {
desktopItems = [
(makeDesktopItem {
name = "GUI.for.SingBox";
name = "gui-for-singbox";
exec = "GUI.for.SingBox";
icon = "GUI.for.SingBox";
icon = "gui-for-singbox";
genericName = "GUI.for.SingBox";
desktopName = "GUI.for.SingBox";
categories = [
@@ -98,12 +104,10 @@ buildGoModule {
})
];
postUnpack = ''
cp -r ${frontend} $sourceRoot/frontend/dist
preBuild = ''
cp -r ${frontend} ./frontend/dist
'';
patches = [ ./bridge.patch ];
buildPhase = ''
runHook preBuild
@@ -115,9 +119,8 @@ buildGoModule {
installPhase = ''
runHook preInstall
mkdir -p $out/share/pixmaps
cp -r ./build/bin $out/bin
cp build/appicon.png $out/share/pixmaps/GUI.for.SingBox.png
install -Dm 0755 ./build/bin/GUI.for.SingBox $out/bin/GUI.for.SingBox
install -Dm 0644 build/appicon.png $out/share/pixmaps/gui-for-singbox.png
runHook postInstall
'';