diff --git a/core/init/hook/hook.go b/core/init/hook/hook.go index 77b2d9a..b43b03d 100644 --- a/core/init/hook/hook.go +++ b/core/init/hook/hook.go @@ -36,6 +36,13 @@ func Init() { // applyManagedSettings makes values declared by the NixOS module authoritative // over the panel's mutable settings database on every core startup. func applyManagedSettings(settingRepo repo.ISettingRepo) { + if version := ctl_conf.LoadWithoutPanic("MANAGED_VERSION"); version != "" { + if err := settingRepo.Update("SystemVersion", version); err != nil { + global.LOG.Fatalf("apply managed panel version failed, err: %v", err) + } + global.CONF.Base.Version = version + } + if port := ctl_conf.LoadWithoutPanic("MANAGED_PORT"); port != "" { if err := settingRepo.Update("ServerPort", port); err != nil { global.LOG.Fatalf("apply managed panel port failed, err: %v", err) diff --git a/nix/module.nix b/nix/module.nix index a3081ea..3cab7c1 100644 --- a/nix/module.nix +++ b/nix/module.nix @@ -89,8 +89,10 @@ EOF update_control_value ORIGINAL_PORT ${lib.escapeShellArg (toString cfg.port)} update_control_value ORIGINAL_ENTRANCE ${lib.escapeShellArg cfg.securityEntrance} + update_control_value ORIGINAL_VERSION ${lib.escapeShellArg (cfg.package.version or "unknown")} update_control_value MANAGED_PORT ${lib.escapeShellArg (toString cfg.port)} update_control_value MANAGED_ENTRANCE ${lib.escapeShellArg cfg.securityEntrance} + update_control_value MANAGED_VERSION ${lib.escapeShellArg (cfg.package.version or "unknown")} ''; commonServiceConfig = { diff --git a/nix/package.nix b/nix/package.nix index 280fadd..0bcce64 100644 --- a/nix/package.nix +++ b/nix/package.nix @@ -5,7 +5,7 @@ }: let - version = "2.0.0"; + version = "2.0.1"; frontend = buildNpmPackage { pname = "npanel-frontend";