fix(remote): VNC 升级支持最新版 TightVNC——修 ReadVncServerConfig 的 ConnectToRdp 误读 ExtraPorts、补 WriteVncServerConfig 漏写的 LogLevel(读/写均达 37 项全集)、InstallVncServer 从固定密码空壳实现为真安装(校验 exe→写最新版全集配置+随机密码→注册服务, 装而不启/运行中重启, 返回明文密码); 锁定最新版默认值与安装异常路径的单测

This commit is contained in:
w11
2026-09-23 19:39:08 +08:00
parent 181150b7a1
commit 38e44f7b4a
4 changed files with 90 additions and 50 deletions
+5 -2
View File
@@ -31,7 +31,10 @@ pass, err := remote.GetVncPassword()
cfg := remote.VncServerDefaultConfig(true /* 随机密码 */) // VncServerConfig
err = remote.WriteVncServerConfig(cfg)
cfg, err = remote.ReadVncServerConfig()
_, msg, err := remote.InstallVncServer() // 安装服务(需管理员权限)
// 绿色安装最新版 TightVNC:校验 exe → 写注册表全集(随机密码, 需管理员权限) →
// 注册系统服务(装而不启, 远程时再 VncStart; 已运行则重启加载新配置)。
// 返回生成的明文密码供调用方上报/展示。
pass, err := remote.InstallVncServer(`D:\app\tvnc\tvnserver.exe`)
err = remote.VncInit() // 初始化/修复配置
err = remote.VncStart() // VncStop / VncRestart
err = remote.VncInstall() // VncUninstall
@@ -55,6 +58,6 @@ err = remote.EnableSoftwareSASGeneration()
- `GetServiceStatus` 系列对未安装服务返回 -1 而非错误;`GetRdpServiceStatus` /
`GetVncServiceStatus` 走 `kardianos/service`,未安装返回 error。
- `InstallVncServer` / `VncInit` / CAD 开关需要管理员权限,失败信息见返回 msg 或 error。
- `InstallVncServer` / `VncInit` / CAD 开关需要管理员权限,失败信息见返回 error;安装配置对齐最新版 TightVNC(2.8.x) 注册表 37 项全集。
- VNC 密码格式与 TightVNC 兼容(`KarpelesLab/vncpasswd` 实现),加解密为确定性
变换,注意密文落盘位置的访问控制。