Compare commits
4 Commits
main
...
test-updater
| Author | SHA1 | Date | |
|---|---|---|---|
| 926191afd6 | |||
| cbe0df86cc | |||
| 2aba2f4a45 | |||
| d39ba6d30f |
@@ -36,4 +36,4 @@ To build the app locally, run:
|
||||
* `npm run tauri build`
|
||||
|
||||
To start local dev server, run:
|
||||
* `npm run tauri dev`
|
||||
* `npm run tauri dev`
|
||||
+1
-1
@@ -71,7 +71,7 @@ async function createTauriRelease() {
|
||||
await Promise.allSettled(promises);
|
||||
|
||||
const releaseData = {
|
||||
name: latestTag.name,
|
||||
version: latestTag.name,
|
||||
notes: `https://github.com/${repoMetaData.owner}/${repoMetaData.repo}/releases/tag/${latestTag.name}`,
|
||||
pub_date: new Date().toISOString(),
|
||||
platforms: {},
|
||||
|
||||
+15
-15
@@ -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"
|
||||
|
||||
@@ -7,6 +7,8 @@
|
||||
|
||||
use tauri::{webview::{NewWindowResponse, WebviewWindowBuilder}, WebviewUrl};
|
||||
use tauri_plugin_opener::OpenerExt;
|
||||
use tauri_plugin_updater::UpdaterExt;
|
||||
use tauri_plugin_dialog::{DialogExt, MessageDialogButtons, MessageDialogKind};
|
||||
|
||||
pub fn run() {
|
||||
let port: u16 = 44548;
|
||||
@@ -19,10 +21,36 @@ pub fn run() {
|
||||
// }
|
||||
|
||||
builder
|
||||
.plugin(tauri_plugin_updater::Builder::new().build())
|
||||
.plugin(tauri_plugin_dialog::init())
|
||||
.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 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
|
||||
#[cfg(debug_assertions)]
|
||||
let window_url = WebviewUrl::App(Default::default());
|
||||
|
||||
Reference in New Issue
Block a user