From d39ba6d30f1f252b592728986967cf69d02f119d Mon Sep 17 00:00:00 2001 From: Krishan <33421343+kfiven@users.noreply.github.com> Date: Sat, 30 May 2026 21:01:29 +1000 Subject: [PATCH] add tauri updater check --- src-tauri/Cargo.toml | 30 +++++++++++++++--------------- src-tauri/src/lib.rs | 9 +++++++++ 2 files changed, 24 insertions(+), 15 deletions(-) diff --git a/src-tauri/Cargo.toml b/src-tauri/Cargo.toml index c7f0698..790fda0 100644 --- a/src-tauri/Cargo.toml +++ b/src-tauri/Cargo.toml @@ -12,23 +12,23 @@ edition = "2021" rust-version = "1.61" [build-dependencies] -tauri-build = { version = "2", features = [] } +tauri-build = { version = "2.6.2", features = [] } [dependencies] serde_json = "1.0.109" serde = { version = "1.0.193", features = ["derive"] } -tauri = { version = "2", features = [ "devtools"] } -tauri-plugin-localhost = "2" -tauri-plugin-window-state = "2" -tauri-plugin-clipboard-manager = "2" -tauri-plugin-notification = "2" -tauri-plugin-fs = "2" -tauri-plugin-shell = "2" -tauri-plugin-http = "2" -tauri-plugin-process = "2" -tauri-plugin-os = "2" -tauri-plugin-dialog = "2" -tauri-plugin-opener = "2" +tauri = { version = "2.11.2", features = [ "devtools"] } +tauri-plugin-localhost = "2.3.2" +tauri-plugin-window-state = "2.4.1" +tauri-plugin-clipboard-manager = "2.3.2" +tauri-plugin-notification = "2.3.3" +tauri-plugin-fs = "2.5.1" +tauri-plugin-shell = "2.3.5" +tauri-plugin-http = "2.5.9" +tauri-plugin-process = "2.3.1" +tauri-plugin-os = "2.3.2" +tauri-plugin-dialog = "2.7.1" +tauri-plugin-opener = "2.5.4" [features] # by default Tauri runs in production mode @@ -39,8 +39,8 @@ default = [ "custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ] [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] -tauri-plugin-global-shortcut = "2" -tauri-plugin-updater = "2" +tauri-plugin-global-shortcut = "2.3.2" +tauri-plugin-updater = { version = "2.10.1", features = ["rustls-tls"] } [lib] name = "app_lib" diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index b0aab97..3dd9ff3 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -7,6 +7,7 @@ use tauri::{webview::{NewWindowResponse, WebviewWindowBuilder}, WebviewUrl}; use tauri_plugin_opener::OpenerExt; +use tauri_plugin_updater::UpdaterExt; pub fn run() { let port: u16 = 44548; @@ -19,10 +20,18 @@ pub fn run() { // } builder + .plugin(tauri_plugin_updater::Builder::new().build()) .plugin(tauri_plugin_localhost::Builder::new(port).build()) .plugin(tauri_plugin_window_state::Builder::default().build()) .plugin(tauri_plugin_opener::init()) .setup(move |app| { + let handle = app.handle().clone(); + tauri::async_runtime::spawn(async move { + if let Ok(Some(update)) = handle.updater().unwrap().check().await { + let _ = update.download_and_install(|_, _| {}, || {}).await; + } + }); + // Dev: use devUrl from tauri.conf.json (http://localhost:8080) to support HMR #[cfg(debug_assertions)] let window_url = WebviewUrl::App(Default::default());