feat(updater): add never option to startup prompt

Assisted-by: vscode-copilot-chat:copilot:gpt-6-luna codegraph
Signed-off-by: ❤是纱雾酱哟~ <49941141+Dragon1573@users.noreply.github.com>
This commit is contained in:
❤是纱雾酱哟~
2026-09-27 20:09:21 +08:00
parent 5d7dc3aed9
commit 6a2df5c8f0
15 changed files with 67 additions and 11 deletions
+9
View File
@@ -1,3 +1,12 @@
## v2.5.7
<details>
<summary><strong> ✨ 新增功能 </strong></summary>
- 新增「永不」选项,可关闭自动检查更新并清除已下载的更新包
</details>
## v2.5.6
<details>
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: يتطلب تثبيت خدمة Clash Verge صلاحيات المسؤول.
adminUninstallPrompt: يتطلب إلغاء تثبيت خدمة Clash Verge صلاحيات المسؤول.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: Für die Installation des Clash-Verge-Dienstes sind Administratorrechte erforderlich.
adminUninstallPrompt: Für die Deinstallation des Clash-Verge-Dienstes sind Administratorrechte erforderlich.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: Installing the Clash Verge service requires administrator privileges.
adminUninstallPrompt: Uninstalling the Clash Verge service requires administrator privileges.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: Instalar el servicio de Clash Verge requiere privilegios de administrador.
adminUninstallPrompt: Desinstalar el servicio de Clash Verge requiere privilegios de administrador.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: نصب سرویس Clash Verge به دسترسی مدیر نیاز دارد.
adminUninstallPrompt: حذف سرویس Clash Verge به دسترسی مدیر نیاز دارد.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: Menginstal layanan Clash Verge memerlukan hak administrator.
adminUninstallPrompt: Menghapus instalasi layanan Clash Verge memerlukan hak administrator.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: Clash Verge サービスのインストールには管理者権限が必要です。
adminUninstallPrompt: Clash Verge サービスのアンインストールには管理者権限が必要です。
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: Clash Verge 서비스 설치에는 관리자 권한이 필요합니다.
adminUninstallPrompt: Clash Verge 서비스 제거에는 관리자 권한이 필요합니다.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: Новая версия (v{version}) скачана и готова к установке.
installNow: Установить сейчас
later: Позже
never: Никогда
service:
adminInstallPrompt: Для установки службы Clash Verge требуются права администратора.
adminUninstallPrompt: Для удаления службы Clash Verge требуются права администратора.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: Yeni bir sürüm (v{version}) indirildi ve kurulmaya hazır.
installNow: Şimdi Kur
later: Daha Sonra
never: Asla
service:
adminInstallPrompt: Clash Verge hizmetini kurmak için yönetici ayrıcalıkları gerekir.
adminUninstallPrompt: Clash Verge hizmetini kaldırmak için yönetici ayrıcalıkları gerekir.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: A new version (v{version}) has been downloaded and is ready to install.
installNow: Install Now
later: Later
never: Never
service:
adminInstallPrompt: Clash Verge хезмәтен урнаштыру өчен администратор хокуклары кирәк.
adminUninstallPrompt: Clash Verge хезмәтен бетерү өчен администратор хокуклары кирәк.
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: 新版本 (v{version}) 已下载完成,是否立即安装?
installNow: 立即安装
later: 稍后
never: 永不
service:
adminInstallPrompt: 安装 Clash Verge 服务需要管理员权限
adminUninstallPrompt: 卸载 Clash Verge 服务需要管理员权限
+1
View File
@@ -34,6 +34,7 @@ notifications:
body: 新版本(v{version})已下載完成,是否立即安裝?
installNow: 立即安裝
later: 稍後
never: 永不
service:
adminInstallPrompt: 安裝 Clash Verge 服務需要管理員權限
adminUninstallPrompt: 解除安裝 Clash Verge 服務需要管理員權限
+45 -11
View File
@@ -1,4 +1,8 @@
use crate::{config::Config, singleton, utils::dirs};
use crate::{
config::{Config, IVerge},
singleton,
utils::dirs,
};
use anyhow::{Context as _, Result};
use chrono::Utc;
use clash_verge_logging::{Type, logging};
@@ -179,10 +183,24 @@ impl SilentUpdater {
current_version
);
// Preserve the cache when skipped so the next launch asks again.
if !Self::ask_user_to_install(app_handle, cached_version).await {
logging!(info, Type::System, "User skipped update install, starting normally");
return false;
match Self::ask_user_to_install(app_handle, cached_version).await {
StartupUpdateChoice::Install => {}
StartupUpdateChoice::Later => {
logging!(info, Type::System, "User skipped update install, starting normally");
return false;
}
StartupUpdateChoice::Never => {
let patch = IVerge {
auto_check_update: Some(false),
..Default::default()
};
if let Err(e) = crate::feat::patch_verge(&patch, false).await {
logging!(warn, Type::System, "Failed to disable automatic update checks: {e:#}");
}
Self::delete_cache();
logging!(info, Type::System, "User disabled automatic update checks");
return false;
}
}
let bytes = match Self::read_cache_bytes() {
@@ -304,13 +322,14 @@ impl SilentUpdater {
}
impl SilentUpdater {
async fn ask_user_to_install(app_handle: &tauri::AppHandle, version: &str) -> bool {
use tauri_plugin_dialog::{DialogExt as _, MessageDialogButtons, MessageDialogKind};
async fn ask_user_to_install(app_handle: &tauri::AppHandle, version: &str) -> StartupUpdateChoice {
use tauri_plugin_dialog::{DialogExt as _, MessageDialogButtons, MessageDialogKind, MessageDialogResult};
let title = clash_verge_i18n::t!("notifications.updateReady.title");
let body = clash_verge_i18n::t!("notifications.updateReady.body").replace("{version}", version);
let install_now = clash_verge_i18n::t!("notifications.updateReady.installNow").into_owned();
let later = clash_verge_i18n::t!("notifications.updateReady.later").into_owned();
let never = clash_verge_i18n::t!("notifications.updateReady.never").into_owned();
let (tx, rx) = tokio::sync::oneshot::channel();
@@ -318,16 +337,31 @@ impl SilentUpdater {
.dialog()
.message(body)
.title(title)
.buttons(MessageDialogButtons::OkCancelCustom(install_now, later))
.buttons(MessageDialogButtons::YesNoCancelCustom(
install_now.clone(),
later.clone(),
never.clone(),
))
.kind(MessageDialogKind::Info)
.show(move |confirmed| {
let _ = tx.send(confirmed);
.show_with_result(move |result| {
let _ = tx.send(result);
});
rx.await.unwrap_or(false)
match rx.await.unwrap_or(MessageDialogResult::Cancel) {
MessageDialogResult::Custom(label) if label == install_now => StartupUpdateChoice::Install,
MessageDialogResult::Custom(label) if label == later => StartupUpdateChoice::Later,
MessageDialogResult::Custom(label) if label == never => StartupUpdateChoice::Never,
_ => StartupUpdateChoice::Later,
}
}
}
enum StartupUpdateChoice {
Install,
Later,
Never,
}
impl SilentUpdater {
/// Uses injected HTML so the splash has no bundled-file dependency.
fn show_update_splash(app_handle: &tauri::AppHandle, version: &str) {