diff --git a/Cargo.lock b/Cargo.lock index da9b2bcf..eff0a2be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -6457,7 +6457,7 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tauri" -version = "2.3.1" +version = "2.4.1" dependencies = [ "anyhow", "bytes", @@ -6490,11 +6490,11 @@ dependencies = [ "serialize-to-javascript", "specta", "swift-rs", - "tauri-build 2.0.6", + "tauri-build 2.1.1", "tauri-macros", "tauri-runtime", "tauri-runtime-wry", - "tauri-utils 2.2.0", + "tauri-utils 2.3.1", "thiserror 2.0.9", "tokio", "tray-icon", @@ -6533,7 +6533,7 @@ dependencies = [ [[package]] name = "tauri-build" -version = "2.0.6" +version = "2.1.1" dependencies = [ "anyhow", "cargo_toml 0.22.1", @@ -6545,7 +6545,7 @@ dependencies = [ "semver", "serde", "serde_json", - "tauri-utils 2.2.0", + "tauri-utils 2.3.1", "tauri-winres 0.3.0", "toml 0.8.19", "walkdir", @@ -6579,7 +6579,7 @@ dependencies = [ [[package]] name = "tauri-codegen" -version = "2.0.5" +version = "2.1.1" dependencies = [ "base64 0.22.1", "brotli", @@ -6594,7 +6594,7 @@ dependencies = [ "serde_json", "sha2", "syn 2.0.90", - "tauri-utils 2.2.0", + "tauri-utils 2.3.1", "thiserror 2.0.9", "time", "url", @@ -6604,14 +6604,14 @@ dependencies = [ [[package]] name = "tauri-macros" -version = "2.0.5" +version = "2.1.1" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.90", - "tauri-codegen 2.0.5", - "tauri-utils 2.2.0", + "tauri-codegen 2.1.1", + "tauri-utils 2.3.1", ] [[package]] @@ -7115,7 +7115,7 @@ dependencies = [ [[package]] name = "tauri-runtime" -version = "2.4.0" +version = "2.5.1" dependencies = [ "cookie", "dpi", @@ -7125,7 +7125,7 @@ dependencies = [ "raw-window-handle", "serde", "serde_json", - "tauri-utils 2.2.0", + "tauri-utils 2.3.1", "thiserror 2.0.9", "url", "windows 0.60.0", @@ -7133,7 +7133,7 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "2.4.1" +version = "2.5.1" dependencies = [ "gtk", "http", @@ -7148,7 +7148,7 @@ dependencies = [ "softbuffer", "tao", "tauri-runtime", - "tauri-utils 2.2.0", + "tauri-utils 2.3.1", "url", "webkit2gtk", "webview2-com", @@ -7197,7 +7197,7 @@ dependencies = [ [[package]] name = "tauri-utils" -version = "2.2.0" +version = "2.3.1" dependencies = [ "aes-gcm", "anyhow", diff --git a/plugins/updater/src/lib.rs b/plugins/updater/src/lib.rs index 75b014bc..b83975ce 100644 --- a/plugins/updater/src/lib.rs +++ b/plugins/updater/src/lib.rs @@ -29,6 +29,12 @@ pub use config::Config; pub use error::{Error, Result}; pub use updater::*; +/// Variable holding the type of bundle the executable is stored in. This is modified by binary +/// patching during build +#[unsafe(no_mangle)] +#[link_section = ".data.ta"] +pub static __TAURI_BUNDLE_TYPE: &str = "UNK_BUNDLE"; + /// Extensions to [`tauri::App`], [`tauri::AppHandle`], [`tauri::WebviewWindow`], [`tauri::Webview`] and [`tauri::Window`] to access the updater APIs. pub trait UpdaterExt { /// Gets the updater builder to build and updater diff --git a/plugins/updater/src/updater.rs b/plugins/updater/src/updater.rs index d5febe1c..a5bed77b 100644 --- a/plugins/updater/src/updater.rs +++ b/plugins/updater/src/updater.rs @@ -29,7 +29,7 @@ use url::Url; use crate::{ error::{Error, Result}, - Config, + Config, __TAURI_BUNDLE_TYPE, }; const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); @@ -363,7 +363,7 @@ pub struct Updater { impl Updater { fn get_updater_installer(&self) -> Result> { - match tauri::__TAURI_BUNDLE_TYPE { + match __TAURI_BUNDLE_TYPE { "DEB_BUNDLE" => Ok(Some(Installer::Deb)), "RPM_BUNDLE" => Ok(Some(Installer::Rpm)), "APP_BUNDLE" => Ok(Some(Installer::AppImage)), diff --git a/plugins/updater/tests/app-updater/src/main.rs b/plugins/updater/tests/app-updater/src/main.rs index d3defc1e..c20bdcf3 100644 --- a/plugins/updater/tests/app-updater/src/main.rs +++ b/plugins/updater/tests/app-updater/src/main.rs @@ -9,7 +9,6 @@ use tauri_plugin_updater::UpdaterExt; fn main() { #[allow(unused_mut)] let mut context = tauri::generate_context!(); - println!("{}", tauri::__TAURI_BUNDLE_TYPE); tauri::Builder::default() .plugin(tauri_plugin_updater::Builder::new().build()) .setup(|app| { diff --git a/plugins/updater/tests/app-updater/tauri.conf.json b/plugins/updater/tests/app-updater/tauri.conf.json index f2c6df21..fc70993e 100644 --- a/plugins/updater/tests/app-updater/tauri.conf.json +++ b/plugins/updater/tests/app-updater/tauri.conf.json @@ -2,6 +2,7 @@ "identifier": "com.tauri.updater", "plugins": { "updater": { + "dangerousInsecureTransportProtocol": true, "endpoints": ["http://localhost:3007"], "pubkey": "dW50cnVzdGVkIGNvbW1lbnQ6IG1pbmlzaWduIHB1YmxpYyBrZXk6IEUwNDRGMjkwRjg2MDhCRDAKUldUUWkyRDRrUEpFNEQ4SmdwcU5PaXl6R2ZRUUNvUnhIaVkwVUltV0NMaEx6VTkrWVhpT0ZqeEEK", "windows": { diff --git a/plugins/updater/tests/app-updater/tests/update.rs b/plugins/updater/tests/app-updater/tests/update.rs index a36ae90e..ac8f1b1f 100644 --- a/plugins/updater/tests/app-updater/tests/update.rs +++ b/plugins/updater/tests/app-updater/tests/update.rs @@ -78,7 +78,6 @@ fn build_app(cwd: &Path, config: &Config, bundle_updater: bool, target: BundleTa } } - #[derive(Copy, Clone)] enum BundleTarget { AppImage, @@ -119,7 +118,6 @@ fn target_to_platforms( update_platform: Option, signature: String, ) -> HashMap { - let mut platforms = HashMap::new(); if let Some(platform) = update_platform { println!("TARGET: {}", platform.clone()); @@ -207,7 +205,7 @@ fn bundle_path(root_dir: &Path, _version: &str, v1compatible: bool) -> PathBuf { fn test_cases( root_dir: &Path, version: &str, - target: String + target: String, ) -> Vec<(BundleTarget, PathBuf, Option, Vec)> { vec![ ( @@ -216,7 +214,7 @@ fn test_cases( "target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe" )), Some(target.clone()), - vec![UPDATED_EXIT_CODE] + vec![UPDATED_EXIT_CODE], ), ( BundleTarget::Nsis, @@ -224,7 +222,7 @@ fn test_cases( "target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe" )), Some(format!("{target}-{}", BundleTarget::Nsis.name())), - vec![UPDATED_EXIT_CODE] + vec![UPDATED_EXIT_CODE], ), ( BundleTarget::Nsis, @@ -232,7 +230,7 @@ fn test_cases( "target/debug/bundle/nsis/app-updater_{version}_x64-setup.exe" )), None, - vec![ERROR_EXIT_CODE] + vec![ERROR_EXIT_CODE], ), ( BundleTarget::Msi, @@ -240,7 +238,7 @@ fn test_cases( "target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi" )), Some(target.clone()), - vec![UPDATED_EXIT_CODE] + vec![UPDATED_EXIT_CODE], ), ( BundleTarget::Msi, @@ -248,7 +246,7 @@ fn test_cases( "target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi" )), Some(format!("{target}-{}", BundleTarget::Msi.name())), - vec![UPDATED_EXIT_CODE] + vec![UPDATED_EXIT_CODE], ), ( BundleTarget::Msi, @@ -256,8 +254,8 @@ fn test_cases( "target/debug/bundle/msi/app-updater_{version}_x64_en-US.msi" )), None, - vec![ERROR_EXIT_CODE] - ) + vec![ERROR_EXIT_CODE], + ), ] } @@ -287,7 +285,6 @@ fn update_app() { Updater::String(V1Compatible::V1Compatible) ); - let updater_zip_ext = if v1_compatible { if cfg!(windows) { Some("zip")