diff --git a/Cargo.lock b/Cargo.lock index 23f4bb0b..c76e8ff7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -213,7 +213,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-barcode-scanner", "tauri-plugin-biometric", "tauri-plugin-cli", @@ -245,7 +245,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-updater", "time", "tiny_http", @@ -258,7 +258,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-updater", "tiny_http", ] @@ -270,7 +270,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-store", ] @@ -1428,7 +1428,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-deep-link", "tauri-plugin-log", "tauri-plugin-single-instance", @@ -3615,9 +3615,9 @@ dependencies = [ [[package]] name = "muda" -version = "0.16.1" +version = "0.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4de14a9b5d569ca68d7c891d613b390cf5ab4f851c77aaa2f9e435555d3d9492" +checksum = "58b89bf91c19bf036347f1ab85a81c560f08c0667c8601bece664d860a600988" dependencies = [ "crossbeam-channel", "dpi", @@ -5729,7 +5729,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-cli", "tauri-plugin-single-instance", ] @@ -6348,16 +6348,15 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "2.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f7a0f4019c80391d143ee26cd7cd1ed271ac241d3087d333f99f3269ba90812" +version = "2.6.2" +source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1" dependencies = [ "anyhow", "bytes", "dirs 6.0.0", "dunce", "embed_plist", - "getrandom 0.2.15", + "getrandom 0.3.2", "glob", "gtk", "heck 0.5.0", @@ -6383,11 +6382,11 @@ dependencies = [ "serialize-to-javascript", "specta", "swift-rs", - "tauri-build", + "tauri-build 2.3.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", "tauri-macros", "tauri-runtime", "tauri-runtime-wry", - "tauri-utils", + "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", "thiserror 2.0.12", "tokio", "tray-icon", @@ -6417,8 +6416,29 @@ dependencies = [ "semver", "serde", "serde_json", - "tauri-codegen", - "tauri-utils", + "tauri-codegen 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", + "tauri-winres", + "toml", + "walkdir", +] + +[[package]] +name = "tauri-build" +version = "2.3.0" +source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1" +dependencies = [ + "anyhow", + "cargo_toml", + "dirs 6.0.0", + "glob", + "heck 0.5.0", + "json-patch", + "schemars", + "semver", + "serde", + "serde_json", + "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", "tauri-winres", "toml", "walkdir", @@ -6442,7 +6462,7 @@ dependencies = [ "serde_json", "sha2", "syn 2.0.100", - "tauri-utils", + "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.12", "time", "url", @@ -6451,17 +6471,41 @@ dependencies = [ ] [[package]] -name = "tauri-macros" +name = "tauri-codegen" version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f59e1d1fa9651212dcb890a0c66226d819b716490b0cf43c078514da3591705" +source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1" +dependencies = [ + "base64 0.22.1", + "ico", + "json-patch", + "plist", + "png", + "proc-macro2", + "quote", + "semver", + "serde", + "serde_json", + "sha2", + "syn 2.0.100", + "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", + "thiserror 2.0.12", + "time", + "url", + "uuid", + "walkdir", +] + +[[package]] +name = "tauri-macros" +version = "2.3.1" +source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.100", - "tauri-codegen", - "tauri-utils", + "tauri-codegen 2.3.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", + "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", ] [[package]] @@ -6476,7 +6520,7 @@ dependencies = [ "schemars", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "toml", "walkdir", ] @@ -6554,7 +6598,7 @@ dependencies = [ "serde_json", "tauri", "tauri-plugin", - "tauri-utils", + "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.12", "tracing", "url", @@ -6594,7 +6638,7 @@ dependencies = [ "serde_repr", "tauri", "tauri-plugin", - "tauri-utils", + "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)", "thiserror 2.0.12", "toml", "url", @@ -6915,7 +6959,7 @@ dependencies = [ "tokio", "url", "windows-sys 0.60.2", - "zip 4.0.0", + "zip 4.2.0", ] [[package]] @@ -6969,8 +7013,7 @@ dependencies = [ [[package]] name = "tauri-runtime" version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e7bb73d1bceac06c20b3f755b2c8a2cb13b20b50083084a8cf3700daf397ba4" +source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1" dependencies = [ "cookie", "dpi", @@ -6982,7 +7025,7 @@ dependencies = [ "raw-window-handle", "serde", "serde_json", - "tauri-utils", + "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", "thiserror 2.0.12", "url", "windows 0.61.1", @@ -6990,9 +7033,8 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe52ed0ef40fd7ad51a620ecb3018e32eba3040bb95025216a962a37f6f050c5" +version = "2.7.1" +source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1" dependencies = [ "gtk", "http", @@ -7007,7 +7049,7 @@ dependencies = [ "softbuffer", "tao", "tauri-runtime", - "tauri-utils", + "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)", "url", "webkit2gtk", "webview2-com", @@ -7055,6 +7097,45 @@ dependencies = [ "walkdir", ] +[[package]] +name = "tauri-utils" +version = "2.5.0" +source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1" +dependencies = [ + "aes-gcm", + "anyhow", + "cargo_metadata", + "ctor", + "dunce", + "getrandom 0.3.2", + "glob", + "html5ever", + "http", + "infer", + "json-patch", + "kuchikiki", + "log", + "memchr", + "phf 0.11.3", + "proc-macro2", + "quote", + "regex", + "schemars", + "semver", + "serde", + "serde-untagged", + "serde_json", + "serde_with", + "serialize-to-javascript", + "swift-rs", + "thiserror 2.0.12", + "toml", + "url", + "urlpattern", + "uuid", + "walkdir", +] + [[package]] name = "tauri-winres" version = "0.3.0" @@ -7462,9 +7543,9 @@ dependencies = [ [[package]] name = "tray-icon" -version = "0.20.0" +version = "0.21.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d433764348e7084bad2c5ea22c96c71b61b17afe3a11645710f533bd72b6a2b5" +checksum = "2da75ec677957aa21f6e0b361df0daab972f13a5bee3606de0638fd4ee1c666a" dependencies = [ "crossbeam-channel", "dirs 6.0.0", @@ -7653,7 +7734,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-updater", "time", "tiny_http", @@ -8069,7 +8150,7 @@ dependencies = [ "serde", "serde_json", "tauri", - "tauri-build", + "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)", "tauri-plugin-websocket", "tokio", "tokio-tungstenite", @@ -9068,9 +9149,9 @@ dependencies = [ [[package]] name = "zip" -version = "4.0.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd" +checksum = "95ab361742de920c5535880f89bbd611ee62002bf11341d16a5f057bb8ba6899" dependencies = [ "arbitrary", "crc32fast", diff --git a/Cargo.toml b/Cargo.toml index cfa616ca..b92610bf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -39,3 +39,6 @@ codegen-units = 1 lto = true incremental = false opt-level = "s" + +[patch.crates-io] +tauri = { git = "https://github.com/tauri-apps/tauri", rev = "232265c70e1c213bbb3f84b5541ddc07d330fce1" } diff --git a/plugins/updater/src/error.rs b/plugins/updater/src/error.rs index aeaef63d..b3cacc95 100644 --- a/plugins/updater/src/error.rs +++ b/plugins/updater/src/error.rs @@ -30,9 +30,6 @@ pub enum Error { /// Operating system is not supported. #[error("Unsupported OS, expected one of `linux`, `darwin` or `windows`.")] UnsupportedOs, - /// Can't determine which type of installer was used for the app - #[error("Couldn't determinet installation method")] - UnknownInstaller, /// Failed to determine updater package extract path #[error("Failed to determine updater package extract path.")] FailedToDetermineExtractPath, diff --git a/plugins/updater/src/updater.rs b/plugins/updater/src/updater.rs index beb3867b..12a305b2 100644 --- a/plugins/updater/src/updater.rs +++ b/plugins/updater/src/updater.rs @@ -28,8 +28,8 @@ use semver::Version; use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize}; use tauri::{ utils::{ - config::{get_current_bundle_type, PackageType}, - platform::current_exe, + config::BundleType, + platform::{bundle_type, current_exe}, }, AppHandle, Resource, Runtime, }; @@ -43,7 +43,7 @@ use crate::{ const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); -#[derive(Clone)] +#[derive(Copy, Clone)] pub enum Installer { AppImage, Deb, @@ -387,15 +387,16 @@ pub struct Updater { } impl Updater { - fn get_updater_installer(&self) -> Result> { - match get_current_bundle_type() { - PackageType::Deb => Ok(Some(Installer::Deb)), - PackageType::Rpm => Ok(Some(Installer::Rpm)), - PackageType::AppImage => Ok(Some(Installer::AppImage)), - PackageType::Msi => Ok(Some(Installer::Msi)), - PackageType::Nsis => Ok(Some(Installer::Nsis)), - _ => Err(Error::UnknownInstaller), - } + fn get_updater_installer(&self) -> Option { + bundle_type().and_then(|t| match t { + BundleType::Deb => Some(Installer::Deb), + BundleType::Rpm => Some(Installer::Rpm), + BundleType::AppImage => Some(Installer::AppImage), + BundleType::Msi => Some(Installer::Msi), + BundleType::Nsis => Some(Installer::Nsis), + BundleType::App => Some(Installer::App), + BundleType::Dmg => None, + }) } pub async fn check(&self) -> Result> { @@ -522,7 +523,7 @@ impl Updater { None => release.version > self.current_version, }; - let installer = self.get_updater_installer()?; + let installer = self.get_updater_installer(); let update = if should_update { Some(Update { @@ -536,12 +537,10 @@ impl Updater { version: release.version.to_string(), date: release.pub_date, download_url: release - .download_url(&self.json_target, installer.clone())? + .download_url(&self.json_target, installer)? .to_owned(), body: release.notes.clone(), - signature: release - .signature(&self.json_target, installer.clone())? - .to_owned(), + signature: release.signature(&self.json_target, installer)?.to_owned(), installer, raw_json: raw_json.unwrap(), timeout: None, @@ -1144,7 +1143,7 @@ impl Update { if let Some(mut stdin) = child.stdin.take() { // Write password to stdin - writeln!(stdin, "{}", password)?; + writeln!(stdin, "{password}")?; } let status = child.wait()?; diff --git a/plugins/updater/tests/app-updater/tests/update.rs b/plugins/updater/tests/app-updater/tests/update.rs index 4c331b1e..4ff4d416 100644 --- a/plugins/updater/tests/app-updater/tests/update.rs +++ b/plugins/updater/tests/app-updater/tests/update.rs @@ -171,15 +171,33 @@ fn test_cases( } #[cfg(target_os = "macos")] -fn bundle_paths( +fn test_cases( root_dir: &Path, _version: &str, - v1compatible: bool, -) -> Vec<(BundleTarget, PathBuf)> { - vec![( - BundleTarget::App, - root_dir.join("target/debug/bundle/macos/app-updater.app"), - )] + target: String, +) -> Vec<(BundleTarget, PathBuf, Option, Vec)> { + vec![ + ( + BundleTarget::App, + root_dir.join("target/debug/bundle/macos/app-updater.app"), + Some(target.clone()), + vec![UPDATED_EXIT_CODE, UP_TO_DATE_EXIT_CODE], + ), + // update with installer + ( + BundleTarget::App, + root_dir.join("target/debug/bundle/macos/app-updater.app"), + Some(format!("{target}-{}", BundleTarget::App.name())), + vec![UPDATED_EXIT_CODE, UP_TO_DATE_EXIT_CODE], + ), + // no update + ( + BundleTarget::App, + root_dir.join("target/debug/bundle/macos/app-updater.app"), + None, + vec![ERROR_EXIT_CODE], + ), + ] } #[cfg(target_os = "ios")]