diff --git a/doc/release-notes/rl-2611.section.md b/doc/release-notes/rl-2611.section.md index 59c0a3e771f6..c26c085fa554 100644 --- a/doc/release-notes/rl-2611.section.md +++ b/doc/release-notes/rl-2611.section.md @@ -156,6 +156,10 @@ - `sing-box` has been updated to 1.14.0, which has removed some deprecated options. See [upstream documentation](https://sing-box.sagernet.org/migration/) for details and migration options. +- `gui-for-singbox` has been updated from 1.28.1 to 1.29.0 and now uses upstream's native per-user data directory support. + On Linux, the default data directory changes from `$XDG_CONFIG_HOME/GUI.for.SingBox/data` to `$XDG_DATA_HOME/GUI.for.SingBox` (by default, `~/.config/GUI.for.SingBox/data` and `~/.local/share/GUI.for.SingBox`, respectively). + Existing data needs to be migrated manually. + - `xray` The `allowInsecure` option is no longer supported. - `gotosocial` has been updated to 0.22.0. This release contains a very long database migration, which should not be cancelled or interrupted under any circumstances. diff --git a/pkgs/by-name/gu/gui-for-singbox/frontend-runtime-path.patch b/pkgs/by-name/gu/gui-for-singbox/frontend-runtime-path.patch deleted file mode 100644 index 1b6c8b4ba85e..000000000000 --- a/pkgs/by-name/gu/gui-for-singbox/frontend-runtime-path.patch +++ /dev/null @@ -1,108 +0,0 @@ ---- a/src/constant/kernel.ts -+++ b/src/constant/kernel.ts -@@ -324,9 +324,9 @@ - 'run', - '--disable-color', - '-c', -- '$APP_BASE_PATH/$CORE_BASE_PATH/config.json', -+ '$CORE_BASE_PATH/config.json', - '-D', -- '$APP_BASE_PATH/$CORE_BASE_PATH', -+ '$CORE_BASE_PATH', - ], - } - } ---- a/src/stores/env.ts -+++ b/src/stores/env.ts -@@ -14,6 +14,7 @@ - appName: '', - appVersion: '', - basePath: '', -+ configPath: '', - appPath: '', - os: '' as App.OS, - arch: '', ---- a/src/stores/kernelApi.ts -+++ b/src/stores/kernelApi.ts -@@ -273,8 +273,12 @@ - - const runCoreProcess = async (isAlpha: boolean) => { - let stopped = false -+ const coreWorkingDirectory = -+ envStore.env.os === 'linux' && envStore.env.configPath -+ ? `${envStore.env.configPath}/${CoreWorkingDirectory}` -+ : CoreWorkingDirectory - const pid = await ExecBackground( -- CoreWorkingDirectory + '/' + getKernelFileName(isAlpha), -+ coreWorkingDirectory + '/' + getKernelFileName(isAlpha), - getKernelRuntimeArgs(isAlpha), - undefined, - async (end) => { -@@ -285,8 +289,9 @@ - onCoreStopped() - }, - { -- PidFile: CorePidFilePath, - LogFile: CoreLogFilePath, -+ PidFile: coreWorkingDirectory + '/pid.txt', -+ WorkingDirectory: envStore.env.configPath || envStore.env.basePath, - Env: getKernelRuntimeEnv(isAlpha), - }, - ) ---- a/src/types/app.d.ts -+++ b/src/types/app.d.ts -@@ -17,6 +17,7 @@ - appName: string - appVersion: string - basePath: string -+ configPath: string - appPath: string - os: OS - arch: string ---- a/src/views/PluginsView/index.vue -+++ b/src/views/PluginsView/index.vue -@@ -34,7 +34,7 @@ - label: 'common.openFile', - handler: async (id: string) => { - const plugin = pluginsStore.getPluginById(id) -- await OpenURI(envStore.env.basePath + '/' + plugin!.path) -+ await OpenURI(`${envStore.env.configPath || envStore.env.basePath}/${plugin!.path}`) - }, - }, - ] ---- a/src/views/RulesetsView/index.vue -+++ b/src/views/RulesetsView/index.vue -@@ -33,7 +33,7 @@ - label: 'common.openFile', - handler: async (id: string) => { - const ruleset = rulesetsStore.getRulesetById(id) -- await OpenURI(envStore.env.basePath + '/' + ruleset!.path) -+ await OpenURI(`${envStore.env.configPath || envStore.env.basePath}/${ruleset!.path}`) - }, - }, - { ---- a/src/utils/helper.ts -+++ b/src/utils/helper.ts -@@ -416,9 +416,21 @@ - export const processMagicVariables = (str: string) => { - const { env } = useEnvStore() - let result = str -+ const coreBasePath = -+ env.os === 'linux' && env.configPath -+ ? `${env.configPath}/${CoreWorkingDirectory}` -+ : CoreWorkingDirectory -+ -+ if (env.os === 'linux') { -+ result = result.replaceAll('$APP_BASE_PATH/$CORE_BASE_PATH', coreBasePath) -+ result = result.replaceAll( -+ `${env.basePath}/${CoreWorkingDirectory}`, -+ coreBasePath, -+ ) -+ } - Object.entries({ - $APP_BASE_PATH: env.basePath, -- $CORE_BASE_PATH: CoreWorkingDirectory, -+ $CORE_BASE_PATH: coreBasePath, - }).forEach(([source, target]) => { - result = result.replaceAll(source, target) - }) diff --git a/pkgs/by-name/gu/gui-for-singbox/package.nix b/pkgs/by-name/gu/gui-for-singbox/package.nix index 58e8b978e5b5..fe9fd0a9ab20 100644 --- a/pkgs/by-name/gu/gui-for-singbox/package.nix +++ b/pkgs/by-name/gu/gui-for-singbox/package.nix @@ -20,13 +20,13 @@ let pname = "gui-for-singbox"; - version = "1.28.1"; + version = "1.29.0"; src = fetchFromGitHub { owner = "GUI-for-Cores"; repo = "GUI.for.SingBox"; tag = "v${version}"; - hash = "sha256-tPG+FmLCSp3nxU9+FFKPP82KJJeasS11gwOMeIJBabI="; + hash = "sha256-12qnCcmkIeeiahaskhR/L2wxRDw84XzocgiKnWws2eU="; }; metaCommon = { @@ -41,8 +41,6 @@ let sourceRoot = "${finalAttrs.src.name}/frontend"; - patches = [ ./frontend-runtime-path.patch ]; - nativeBuildInputs = [ nodejs pnpmConfigHook @@ -58,7 +56,7 @@ let ; pnpm = pnpm_10; fetcherVersion = 3; - hash = "sha256-oL4u6LiGIN8MVHGKfd5rwW01qYey+NaisxobEt71Q4w="; + hash = "sha256-tZ7qbDt1RjBmFq8VNkGa7x2Y44e91yYVcsIowLLM0YA="; }; buildPhase = '' @@ -87,8 +85,6 @@ in buildGo127Module { inherit pname version src; - patches = [ ./xdg-path-and-restart-patch.patch ]; - vendorHash = "sha256-RhN9P6W5/z1NVMkPtboLwkpoMX7ulb6nnzSsOsFpvao="; nativeBuildInputs = [ diff --git a/pkgs/by-name/gu/gui-for-singbox/xdg-path-and-restart-patch.patch b/pkgs/by-name/gu/gui-for-singbox/xdg-path-and-restart-patch.patch deleted file mode 100644 index c5d5ecc682cf..000000000000 --- a/pkgs/by-name/gu/gui-for-singbox/xdg-path-and-restart-patch.patch +++ /dev/null @@ -1,72 +0,0 @@ ---- a/bridge/bridge.go -+++ b/bridge/bridge.go -@@ -50,6 +50,7 @@ - - Env.BasePath = filepath.ToSlash(filepath.Dir(exePath)) - Env.AppName = filepath.Base(exePath) -+ Env.ConfigPath = filepath.ToSlash(GetConfigPath()) - - if slices.Contains(os.Args, "tasksch") { - Env.FromTaskSch = true -@@ -93,7 +94,10 @@ - - func (a *App) RestartApp() FlagResult { - log.Printf("RestartApp") -- exePath := resolvePath(Env.AppName) -+ exePath, err := os.Executable() -+ if err != nil { -+ exePath = filepath.Join(Env.BasePath, Env.AppName) -+ } - - cmd := exec.Command(exePath) - SetCmdWindowHidden(cmd) -@@ -116,6 +120,7 @@ - AppName: Env.AppName, - AppVersion: Env.AppVersion, - BasePath: Env.BasePath, -+ ConfigPath: Env.ConfigPath, - OS: Env.OS, - ARCH: Env.ARCH, - IsPrivileged: Env.IsPrivileged, ---- a/bridge/types.go -+++ b/bridge/types.go -@@ -21,6 +21,7 @@ - AppName string `json:"appName"` - AppVersion string `json:"appVersion"` - BasePath string `json:"basePath"` -+ ConfigPath string `json:"configPath"` - OS string `json:"os"` - ARCH string `json:"arch"` - IsPrivileged bool `json:"isPrivileged"` ---- a/bridge/utils.go -+++ b/bridge/utils.go -@@ -21,7 +21,29 @@ - - var requestTransportCache sync.Map - -+func GetConfigPath() string { -+ if Env.OS == "linux" { -+ if xdgConfigHome := os.Getenv("XDG_CONFIG_HOME"); xdgConfigHome != "" { -+ return filepath.Join(xdgConfigHome, "GUI.for.SingBox") -+ } -+ if userConfigDir, err := os.UserConfigDir(); err == nil { -+ return filepath.Join(userConfigDir, "GUI.for.SingBox") -+ } -+ } -+ -+ return Env.BasePath -+} -+ - func resolvePath(path string) string { -+ if Env.OS == "linux" && !filepath.IsAbs(path) { -+ cleanPath := filepath.ToSlash(filepath.Clean(path)) -+ if cleanPath == "data" { -+ path = filepath.Join(GetConfigPath(), "data") -+ } else if strings.HasPrefix(cleanPath, "data/") { -+ path = filepath.Join(GetConfigPath(), cleanPath) -+ } -+ } -+ - if !filepath.IsAbs(path) { - path = filepath.Join(Env.BasePath, path) - }