feat: OTA 改为静默下载 + 安装需用户确认

- 下载落到数据目录 updates/ 暂存区(退出不丢失),校验后等待安装
- 启动自动检查:静默检查+下载,完成后弹「更新就绪」对话框,
  由用户选择 立即安装(重启) 或 下次启动安装
- main 在进入 UI 前检测暂存区并完成自替换(下次启动安装路径)
- 设置对话框:下载完成后进入「待安装」状态,提供两个安装时机按钮
- install_and_restart 拆分为 download_and_stage / load_staged / install_staged
This commit is contained in:
2026-09-29 00:22:35 +08:00
parent bf6d165854
commit bc49d1839c
5 changed files with 226 additions and 60 deletions
+11
View File
@@ -2,8 +2,19 @@ use gpui_kit::component::{Root, TitleBar};
use gpui_kit::*;
use mqttx_desktop::ui;
use mqttx_desktop::update;
fn main() {
// OTA 收尾:清理遗留文件;若暂存区有待安装的新版本(用户上次同意安装),
// 在进入 UI 前完成自替换并重启。
update::cleanup_old();
if let Some(staged) = update::load_staged()
&& update::install_staged(&staged).is_ok()
{
// 新进程已拉起,当前进程立即退出
std::process::exit(0);
}
application()
// AllAssets 嵌入全量 Lucide 图标;Assets 只含 default-icons.txt 的 101 个,
// 其余 IconName(MailOpen/SlidersHorizontal 等)运行时会渲染空白