Compare commits

...

4 Commits

Author SHA1 Message Date
Krishan 926191afd6 update key from name to version as required by v2 tauri 2026-05-31 19:16:57 +10:00
Krishan cbe0df86cc add a dialog 2026-05-30 22:27:55 +10:00
Krishan 2aba2f4a45 rerun ci 2026-05-30 21:39:31 +10:00
Krishan d39ba6d30f add tauri updater check 2026-05-30 21:01:29 +10:00
4 changed files with 45 additions and 17 deletions
+1 -1
View File
@@ -36,4 +36,4 @@ To build the app locally, run:
* `npm run tauri build` * `npm run tauri build`
To start local dev server, run: To start local dev server, run:
* `npm run tauri dev` * `npm run tauri dev`
+1 -1
View File
@@ -71,7 +71,7 @@ async function createTauriRelease() {
await Promise.allSettled(promises); await Promise.allSettled(promises);
const releaseData = { const releaseData = {
name: latestTag.name, version: latestTag.name,
notes: `https://github.com/${repoMetaData.owner}/${repoMetaData.repo}/releases/tag/${latestTag.name}`, notes: `https://github.com/${repoMetaData.owner}/${repoMetaData.repo}/releases/tag/${latestTag.name}`,
pub_date: new Date().toISOString(), pub_date: new Date().toISOString(),
platforms: {}, platforms: {},
+15 -15
View File
@@ -12,23 +12,23 @@ edition = "2021"
rust-version = "1.61" rust-version = "1.61"
[build-dependencies] [build-dependencies]
tauri-build = { version = "2", features = [] } tauri-build = { version = "2.6.2", features = [] }
[dependencies] [dependencies]
serde_json = "1.0.109" serde_json = "1.0.109"
serde = { version = "1.0.193", features = ["derive"] } serde = { version = "1.0.193", features = ["derive"] }
tauri = { version = "2", features = [ "devtools"] } tauri = { version = "2.11.2", features = [ "devtools"] }
tauri-plugin-localhost = "2" tauri-plugin-localhost = "2.3.2"
tauri-plugin-window-state = "2" tauri-plugin-window-state = "2.4.1"
tauri-plugin-clipboard-manager = "2" tauri-plugin-clipboard-manager = "2.3.2"
tauri-plugin-notification = "2" tauri-plugin-notification = "2.3.3"
tauri-plugin-fs = "2" tauri-plugin-fs = "2.5.1"
tauri-plugin-shell = "2" tauri-plugin-shell = "2.3.5"
tauri-plugin-http = "2" tauri-plugin-http = "2.5.9"
tauri-plugin-process = "2" tauri-plugin-process = "2.3.1"
tauri-plugin-os = "2" tauri-plugin-os = "2.3.2"
tauri-plugin-dialog = "2" tauri-plugin-dialog = "2.7.1"
tauri-plugin-opener = "2" tauri-plugin-opener = "2.5.4"
[features] [features]
# by default Tauri runs in production mode # by default Tauri runs in production mode
@@ -39,8 +39,8 @@ default = [ "custom-protocol" ]
custom-protocol = [ "tauri/custom-protocol" ] custom-protocol = [ "tauri/custom-protocol" ]
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies] [target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
tauri-plugin-global-shortcut = "2" tauri-plugin-global-shortcut = "2.3.2"
tauri-plugin-updater = "2" tauri-plugin-updater = { version = "2.10.1", features = ["rustls-tls"] }
[lib] [lib]
name = "app_lib" name = "app_lib"
+28
View File
@@ -7,6 +7,8 @@
use tauri::{webview::{NewWindowResponse, WebviewWindowBuilder}, WebviewUrl}; use tauri::{webview::{NewWindowResponse, WebviewWindowBuilder}, WebviewUrl};
use tauri_plugin_opener::OpenerExt; use tauri_plugin_opener::OpenerExt;
use tauri_plugin_updater::UpdaterExt;
use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind};
pub fn run() { pub fn run() {
let port: u16 = 44548; let port: u16 = 44548;
@@ -19,10 +21,36 @@ pub fn run() {
// } // }
builder builder
.plugin(tauri_plugin_updater::Builder::new().build())
.plugin(tauri_plugin_dialog::init())
.plugin(tauri_plugin_localhost::Builder::new(port).build()) .plugin(tauri_plugin_localhost::Builder::new(port).build())
.plugin(tauri_plugin_window_state::Builder::default().build()) .plugin(tauri_plugin_window_state::Builder::default().build())
.plugin(tauri_plugin_opener::init()) .plugin(tauri_plugin_opener::init())
.setup(move |app| { .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 version = update.version.clone();
let should_update = handle
.dialog()
.message(format!(
"Version {} is available.\n\nWould you like to update now?",
version
))
.title("Update Available")
.kind(MessageDialogKind::Info)
.buttons(MessageDialogButtons::YesNo)
.blocking_show();
if should_update {
if update.download_and_install(|_, _| {}, || {}).await.is_ok() {
handle.restart();
}
}
}
});
// Dev: use devUrl from tauri.conf.json (http://localhost:8080) to support HMR // Dev: use devUrl from tauri.conf.json (http://localhost:8080) to support HMR
#[cfg(debug_assertions)] #[cfg(debug_assertions)]
let window_url = WebviewUrl::App(Default::default()); let window_url = WebviewUrl::App(Default::default());