feat: 优化客户端配置和跨平台支持
This commit is contained in:
@@ -44,6 +44,7 @@ bash ./scripts/package-sdk.sh --source-dir ./out/linux/bin --output-dir ./dist/U
|
||||
==============
|
||||
|
||||
config/app_config.json 是部署配置源文件。Launcher / Updater / MainApp 启动时会把它同步到当前用户的 QSettings 配置区;Windows 下对应注册表,Linux 下对应用户配置文件。后续运行配置优先从 QSettings 读取。
|
||||
config/server_config.json 是编译期服务端地址配置源文件。它通过 config/server_config.qrc 编进 Launcher / Updater / MainApp,不写入 app_config.json,也不写入注册表。修改 api_base_url 后必须重新编译客户端程序才会生效。
|
||||
如果 config/app_config.json 内容被修改,下一次启动时会按解析后的 JSON 内容 SHA256 判断变化并重新导入注册表。
|
||||
非空 app_config.json 成功导入注册表后会自动清空为 {},文件保留不删除,方便下次直接粘贴管理后台生成的新配置。
|
||||
Windows 注册表位置:HKEY_CURRENT_USER\Software\Marsco\UpdateClientSDK\installations\<安装目录SHA256>\config。
|
||||
@@ -55,10 +56,11 @@ Linux 配置位置由 Qt QSettings 决定,通常在当前用户 home 目录的
|
||||
接入新软件时通常需要修改:
|
||||
|
||||
1. app_id、app_name、channel、current_version。
|
||||
2. api_base_url、client_token、license_key、launch_token。
|
||||
3. main_executable:团队业务主程序文件名。
|
||||
4. launcher_executable、updater_executable、bootstrap_executable。
|
||||
5. health_check_timeout_ms:升级后等待业务程序健康确认的毫秒数,最小 1000。
|
||||
2. client_token、license_key、launch_token。
|
||||
3. config/server_config.json 里的 api_base_url。
|
||||
4. main_executable:团队业务主程序文件名。
|
||||
5. launcher_executable、updater_executable、bootstrap_executable。
|
||||
6. health_check_timeout_ms:升级后等待业务程序健康确认的毫秒数,最小 1000。
|
||||
|
||||
Windows 完整格式参考 update-client/config/app_config.example.json;Linux 完整格式参考 update-client/config/app_config.linux.example.json。
|
||||
运行时生成的 client_identity.dat、local_state.json 等文件不得打入通用 SDK 模板。app_config.json 可以作为部署模板,但不要把某台机器运行后产生的临时状态混进去。
|
||||
@@ -67,7 +69,7 @@ Windows 发布打包:
|
||||
|
||||
1. 使用 Release 配置编译全部客户端程序。
|
||||
2. 先完成当前版本在线校验,确认 out/bin/update/manifest_cache 中存在对应的签名 Manifest。
|
||||
3. 准备一份实际 app_config.json,确认其中包含正确的 License Key、当前版本和业务程序名。
|
||||
3. 准备一份实际 app_config.json,确认其中包含正确的 License Key、当前版本和业务程序名;确认客户端程序已用正确的 config/server_config.json 编译。
|
||||
4. 在 PowerShell 执行:
|
||||
powershell -ExecutionPolicy Bypass -File .\scripts\package-client.ps1 -ConfigFile .\config\app_config.json
|
||||
5. 输出位于 dist/UpdateClient 和 dist/UpdateClient.zip。
|
||||
|
||||
Reference in New Issue
Block a user