mirror of
https://github.com/Syngnat/GoNavi.git
synced 2026-08-10 00:33:28 +08:00
- 将便携版更新资产切换为普通 ZIP,并兼容复用已下载包 - 解压后映射版本化目标文件名,保留旧版 EXE 更新兼容 - 将内嵌 PowerShell 更新脚本策略收紧为 RemoteSigned - 补充 ZIP、目标路径与启动参数回归测试
29 lines
747 B
Go
29 lines
747 B
Go
package app
|
|
|
|
import (
|
|
_ "embed"
|
|
"strings"
|
|
)
|
|
|
|
//go:embed windows_update.ps1
|
|
var windowsUpdatePowerShellScript string
|
|
|
|
// The updater writes these embedded scripts locally, so RemoteSigned runs them without disabling policy checks.
|
|
const windowsUpdatePowerShellExecutionPolicy = "RemoteSigned"
|
|
|
|
type windowsUpdateLaunchContext struct {
|
|
SourcePath string
|
|
TargetPath string
|
|
CurrentTargetPath string
|
|
StagedDir string
|
|
LogPath string
|
|
MaintenanceEventName string
|
|
HandoffEventName string
|
|
PID int
|
|
}
|
|
|
|
func buildWindowsPowerShellScript() string {
|
|
normalized := strings.ReplaceAll(windowsUpdatePowerShellScript, "\r\n", "\n")
|
|
return strings.ReplaceAll(normalized, "\n", "\r\n")
|
|
}
|