fix(updater): 避免因 Updater 配置不完整导致应用启动中止\n\n- Updater 插件注册改为容错(失败仅告警,不影响应用启动)

This commit is contained in:
Jason
2025-09-09 10:28:34 +08:00
parent 9ff7516c51
commit a3582f54e9
2 changed files with 11 additions and 6 deletions

View File

@@ -225,8 +225,15 @@ pub fn run() {
.setup(|app| { .setup(|app| {
// 注册 Updater 插件(桌面端) // 注册 Updater 插件(桌面端)
#[cfg(desktop)] #[cfg(desktop)]
app.handle() {
.plugin(tauri_plugin_updater::Builder::new().build())?; if let Err(e) = app
.handle()
.plugin(tauri_plugin_updater::Builder::new().build())
{
// 若配置不完整(如缺少 pubkey跳过 Updater 而不中断应用
log::warn!("初始化 Updater 插件失败,已跳过:{}", e);
}
}
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
{ {
// 设置 macOS 标题栏背景色为主界面蓝色 // 设置 macOS 标题栏背景色为主界面蓝色

View File

@@ -42,10 +42,8 @@
, ,
"plugins": { "plugins": {
"updater": { "updater": {
"pubkey": "", "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IDRERTRCNEUxQUE3MDA4QTYKUldTbUNIQ3E0YlRrVFF2cnFVVE1jczlNZFlmemxXd0h6cTdibXRJWjBDSytQODdZOTYvR3d3d2oK",
"endpoints": [ "endpoints":["http://127.0.0.1:8080/latest.json"]
"https://example.com/releases/latest.json"
]
} }
} }
} }