add tauri updater check

This commit is contained in:
Krishan
2026-05-30 21:01:29 +10:00
parent 8b7bced138
commit d39ba6d30f
2 changed files with 24 additions and 15 deletions
+15 -15
View File
@@ -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"
+9
View File
@@ -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());