gui-for-clash: 1.8.9 -> 1.9.0 (#368129)
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
--- 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) {
|
||||
// step1: Set Env
|
||||
- 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.Clash"
|
||||
+ 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 +128,7 @@
|
||||
}
|
||||
|
||||
func (a *App) RestartApp() FlagResult {
|
||||
- exePath := Env.BasePath + "/" + Env.AppName
|
||||
+ exePath := "@basepath@/bin" + "/" + Env.AppName
|
||||
|
||||
cmd := exec.Command(exePath)
|
||||
HideExecWindow(cmd)
|
||||
@@ -9,20 +9,22 @@
|
||||
webkitgtk_4_0,
|
||||
pkg-config,
|
||||
libsoup_3,
|
||||
wrapGAppsHook3,
|
||||
autoPatchelfHook,
|
||||
makeDesktopItem,
|
||||
copyDesktopItems,
|
||||
replaceVars,
|
||||
}:
|
||||
let
|
||||
pname = "gui-for-clash";
|
||||
version = "1.8.9";
|
||||
version = "1.9.0";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "GUI-for-Cores";
|
||||
repo = "GUI.for.Clash";
|
||||
rev = "v${version}";
|
||||
hash = "sha256-jNYMv3gPbZV2JlTV0v0NQ06HkXDzgHXuEdJrBgQ+p2g=";
|
||||
tag = "v${version}";
|
||||
hash = "sha256-0PNFiOZ+POp1P/HDJmAIMKNGIjft6bfwPiRDLswY2ns=";
|
||||
};
|
||||
|
||||
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-RQtU61H1YklCgJrlyHALxUZp8OvVs2MgFThWBsYk2cs=";
|
||||
hash = "sha256-mG8b16PP876EyaX3Sc4WM41Yc/oDGZDiilZPaxPvvuQ=";
|
||||
};
|
||||
|
||||
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.Clash";
|
||||
name = "gui-for-clash";
|
||||
exec = "GUI.for.Clash";
|
||||
icon = "GUI.for.Clash";
|
||||
icon = "gui-for-clash";
|
||||
genericName = "GUI.for.Clash";
|
||||
desktopName = "GUI.for.Clash";
|
||||
categories = [
|
||||
@@ -98,17 +104,8 @@ buildGoModule {
|
||||
})
|
||||
];
|
||||
|
||||
postUnpack = ''
|
||||
cp -r ${frontend} $sourceRoot/frontend/dist
|
||||
'';
|
||||
|
||||
postPatch = ''
|
||||
sed -i '/exePath, err := os.Executable()/,+3d' bridge/bridge.go
|
||||
substituteInPlace bridge/bridge.go \
|
||||
--replace-fail "Env.BasePath = filepath.Dir(exePath)" "" \
|
||||
--replace-fail "Env.AppName = filepath.Base(exePath)" "Env.AppName = \"GUI.for.Clash\"
|
||||
Env.BasePath = filepath.Join(os.Getenv(\"HOME\"), \".config\", Env.AppName)" \
|
||||
--replace-fail 'exePath := Env.BasePath' 'exePath := "${placeholder "out"}/bin"'
|
||||
preBuild = ''
|
||||
cp -r ${frontend} ./frontend/dist
|
||||
'';
|
||||
|
||||
buildPhase = ''
|
||||
@@ -122,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.Clash.png
|
||||
install -Dm 0755 ./build/bin/GUI.for.Clash $out/bin/GUI.for.Clash
|
||||
install -Dm 0644 build/appicon.png $out/share/pixmaps/gui-for-clash.png
|
||||
|
||||
runHook postInstall
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user