Merge branch 'feature/fallback_targets' of github.com:kandrelczyk/plugins-workspace into feature/fallback_targets

pull/2624/head
Krzysztof Andrelczyk 1 week ago
commit 513376b4a2

159
Cargo.lock generated

@ -213,7 +213,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-barcode-scanner", "tauri-plugin-barcode-scanner",
"tauri-plugin-biometric", "tauri-plugin-biometric",
"tauri-plugin-cli", "tauri-plugin-cli",
@ -245,7 +245,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-updater", "tauri-plugin-updater",
"time", "time",
"tiny_http", "tiny_http",
@ -258,7 +258,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-updater", "tauri-plugin-updater",
"tiny_http", "tiny_http",
] ]
@ -270,7 +270,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-store", "tauri-plugin-store",
] ]
@ -1428,7 +1428,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-deep-link", "tauri-plugin-deep-link",
"tauri-plugin-log", "tauri-plugin-log",
"tauri-plugin-single-instance", "tauri-plugin-single-instance",
@ -3615,9 +3615,9 @@ dependencies = [
[[package]] [[package]]
name = "muda" name = "muda"
version = "0.16.1" version = "0.17.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4de14a9b5d569ca68d7c891d613b390cf5ab4f851c77aaa2f9e435555d3d9492" checksum = "58b89bf91c19bf036347f1ab85a81c560f08c0667c8601bece664d860a600988"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"dpi", "dpi",
@ -5729,7 +5729,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-cli", "tauri-plugin-cli",
"tauri-plugin-single-instance", "tauri-plugin-single-instance",
] ]
@ -6348,16 +6348,15 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1"
[[package]] [[package]]
name = "tauri" name = "tauri"
version = "2.6.0" version = "2.6.2"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1"
checksum = "2f7a0f4019c80391d143ee26cd7cd1ed271ac241d3087d333f99f3269ba90812"
dependencies = [ dependencies = [
"anyhow", "anyhow",
"bytes", "bytes",
"dirs 6.0.0", "dirs 6.0.0",
"dunce", "dunce",
"embed_plist", "embed_plist",
"getrandom 0.2.15", "getrandom 0.3.2",
"glob", "glob",
"gtk", "gtk",
"heck 0.5.0", "heck 0.5.0",
@ -6383,11 +6382,11 @@ dependencies = [
"serialize-to-javascript", "serialize-to-javascript",
"specta", "specta",
"swift-rs", "swift-rs",
"tauri-build", "tauri-build 2.3.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)",
"tauri-macros", "tauri-macros",
"tauri-runtime", "tauri-runtime",
"tauri-runtime-wry", "tauri-runtime-wry",
"tauri-utils", "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)",
"thiserror 2.0.12", "thiserror 2.0.12",
"tokio", "tokio",
"tray-icon", "tray-icon",
@ -6417,8 +6416,29 @@ dependencies = [
"semver", "semver",
"serde", "serde",
"serde_json", "serde_json",
"tauri-codegen", "tauri-codegen 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-utils", "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", "tauri-winres",
"toml", "toml",
"walkdir", "walkdir",
@ -6442,7 +6462,7 @@ dependencies = [
"serde_json", "serde_json",
"sha2", "sha2",
"syn 2.0.100", "syn 2.0.100",
"tauri-utils", "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror 2.0.12", "thiserror 2.0.12",
"time", "time",
"url", "url",
@ -6451,17 +6471,41 @@ dependencies = [
] ]
[[package]] [[package]]
name = "tauri-macros" name = "tauri-codegen"
version = "2.3.0" version = "2.3.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1"
checksum = "1f59e1d1fa9651212dcb890a0c66226d819b716490b0cf43c078514da3591705" 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 = [ dependencies = [
"heck 0.5.0", "heck 0.5.0",
"proc-macro2", "proc-macro2",
"quote", "quote",
"syn 2.0.100", "syn 2.0.100",
"tauri-codegen", "tauri-codegen 2.3.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)",
"tauri-utils", "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)",
] ]
[[package]] [[package]]
@ -6476,7 +6520,7 @@ dependencies = [
"schemars", "schemars",
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils", "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"toml", "toml",
"walkdir", "walkdir",
] ]
@ -6554,7 +6598,7 @@ dependencies = [
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-utils", "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror 2.0.12", "thiserror 2.0.12",
"tracing", "tracing",
"url", "url",
@ -6594,7 +6638,7 @@ dependencies = [
"serde_repr", "serde_repr",
"tauri", "tauri",
"tauri-plugin", "tauri-plugin",
"tauri-utils", "tauri-utils 2.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
"thiserror 2.0.12", "thiserror 2.0.12",
"toml", "toml",
"url", "url",
@ -6915,7 +6959,7 @@ dependencies = [
"tokio", "tokio",
"url", "url",
"windows-sys 0.60.2", "windows-sys 0.60.2",
"zip 4.0.0", "zip 4.2.0",
] ]
[[package]] [[package]]
@ -6969,8 +7013,7 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime" name = "tauri-runtime"
version = "2.7.0" version = "2.7.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1"
checksum = "9e7bb73d1bceac06c20b3f755b2c8a2cb13b20b50083084a8cf3700daf397ba4"
dependencies = [ dependencies = [
"cookie", "cookie",
"dpi", "dpi",
@ -6982,7 +7025,7 @@ dependencies = [
"raw-window-handle", "raw-window-handle",
"serde", "serde",
"serde_json", "serde_json",
"tauri-utils", "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)",
"thiserror 2.0.12", "thiserror 2.0.12",
"url", "url",
"windows 0.61.1", "windows 0.61.1",
@ -6990,9 +7033,8 @@ dependencies = [
[[package]] [[package]]
name = "tauri-runtime-wry" name = "tauri-runtime-wry"
version = "2.7.0" version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1#232265c70e1c213bbb3f84b5541ddc07d330fce1"
checksum = "fe52ed0ef40fd7ad51a620ecb3018e32eba3040bb95025216a962a37f6f050c5"
dependencies = [ dependencies = [
"gtk", "gtk",
"http", "http",
@ -7007,7 +7049,7 @@ dependencies = [
"softbuffer", "softbuffer",
"tao", "tao",
"tauri-runtime", "tauri-runtime",
"tauri-utils", "tauri-utils 2.5.0 (git+https://github.com/tauri-apps/tauri?rev=232265c70e1c213bbb3f84b5541ddc07d330fce1)",
"url", "url",
"webkit2gtk", "webkit2gtk",
"webview2-com", "webview2-com",
@ -7055,6 +7097,45 @@ dependencies = [
"walkdir", "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]] [[package]]
name = "tauri-winres" name = "tauri-winres"
version = "0.3.0" version = "0.3.0"
@ -7462,9 +7543,9 @@ dependencies = [
[[package]] [[package]]
name = "tray-icon" name = "tray-icon"
version = "0.20.0" version = "0.21.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d433764348e7084bad2c5ea22c96c71b61b17afe3a11645710f533bd72b6a2b5" checksum = "2da75ec677957aa21f6e0b361df0daab972f13a5bee3606de0638fd4ee1c666a"
dependencies = [ dependencies = [
"crossbeam-channel", "crossbeam-channel",
"dirs 6.0.0", "dirs 6.0.0",
@ -7653,7 +7734,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-updater", "tauri-plugin-updater",
"time", "time",
"tiny_http", "tiny_http",
@ -8069,7 +8150,7 @@ dependencies = [
"serde", "serde",
"serde_json", "serde_json",
"tauri", "tauri",
"tauri-build", "tauri-build 2.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
"tauri-plugin-websocket", "tauri-plugin-websocket",
"tokio", "tokio",
"tokio-tungstenite", "tokio-tungstenite",
@ -9068,9 +9149,9 @@ dependencies = [
[[package]] [[package]]
name = "zip" name = "zip"
version = "4.0.0" version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd" checksum = "95ab361742de920c5535880f89bbd611ee62002bf11341d16a5f057bb8ba6899"
dependencies = [ dependencies = [
"arbitrary", "arbitrary",
"crc32fast", "crc32fast",

@ -39,3 +39,6 @@ codegen-units = 1
lto = true lto = true
incremental = false incremental = false
opt-level = "s" opt-level = "s"
[patch.crates-io]
tauri = { git = "https://github.com/tauri-apps/tauri", rev = "232265c70e1c213bbb3f84b5541ddc07d330fce1" }

@ -30,9 +30,6 @@ pub enum Error {
/// Operating system is not supported. /// Operating system is not supported.
#[error("Unsupported OS, expected one of `linux`, `darwin` or `windows`.")] #[error("Unsupported OS, expected one of `linux`, `darwin` or `windows`.")]
UnsupportedOs, 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 /// Failed to determine updater package extract path
#[error("Failed to determine updater package extract path.")] #[error("Failed to determine updater package extract path.")]
FailedToDetermineExtractPath, FailedToDetermineExtractPath,

@ -28,8 +28,8 @@ use semver::Version;
use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize}; use serde::{de::Error as DeError, Deserialize, Deserializer, Serialize};
use tauri::{ use tauri::{
utils::{ utils::{
config::{get_current_bundle_type, PackageType}, config::BundleType,
platform::current_exe, platform::{bundle_type, current_exe},
}, },
AppHandle, Resource, Runtime, AppHandle, Resource, Runtime,
}; };
@ -43,7 +43,7 @@ use crate::{
const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),); const UPDATER_USER_AGENT: &str = concat!(env!("CARGO_PKG_NAME"), "/", env!("CARGO_PKG_VERSION"),);
#[derive(Clone)] #[derive(Copy, Clone)]
pub enum Installer { pub enum Installer {
AppImage, AppImage,
Deb, Deb,
@ -387,15 +387,16 @@ pub struct Updater {
} }
impl Updater { impl Updater {
fn get_updater_installer(&self) -> Result<Option<Installer>> { fn get_updater_installer(&self) -> Option<Installer> {
match get_current_bundle_type() { bundle_type().and_then(|t| match t {
PackageType::Deb => Ok(Some(Installer::Deb)), BundleType::Deb => Some(Installer::Deb),
PackageType::Rpm => Ok(Some(Installer::Rpm)), BundleType::Rpm => Some(Installer::Rpm),
PackageType::AppImage => Ok(Some(Installer::AppImage)), BundleType::AppImage => Some(Installer::AppImage),
PackageType::Msi => Ok(Some(Installer::Msi)), BundleType::Msi => Some(Installer::Msi),
PackageType::Nsis => Ok(Some(Installer::Nsis)), BundleType::Nsis => Some(Installer::Nsis),
_ => Err(Error::UnknownInstaller), BundleType::App => Some(Installer::App),
} BundleType::Dmg => None,
})
} }
pub async fn check(&self) -> Result<Option<Update>> { pub async fn check(&self) -> Result<Option<Update>> {
@ -522,7 +523,7 @@ impl Updater {
None => release.version > self.current_version, None => release.version > self.current_version,
}; };
let installer = self.get_updater_installer()?; let installer = self.get_updater_installer();
let update = if should_update { let update = if should_update {
Some(Update { Some(Update {
@ -536,12 +537,10 @@ impl Updater {
version: release.version.to_string(), version: release.version.to_string(),
date: release.pub_date, date: release.pub_date,
download_url: release download_url: release
.download_url(&self.json_target, installer.clone())? .download_url(&self.json_target, installer)?
.to_owned(), .to_owned(),
body: release.notes.clone(), body: release.notes.clone(),
signature: release signature: release.signature(&self.json_target, installer)?.to_owned(),
.signature(&self.json_target, installer.clone())?
.to_owned(),
installer, installer,
raw_json: raw_json.unwrap(), raw_json: raw_json.unwrap(),
timeout: None, timeout: None,
@ -1144,7 +1143,7 @@ impl Update {
if let Some(mut stdin) = child.stdin.take() { if let Some(mut stdin) = child.stdin.take() {
// Write password to stdin // Write password to stdin
writeln!(stdin, "{}", password)?; writeln!(stdin, "{password}")?;
} }
let status = child.wait()?; let status = child.wait()?;

@ -171,15 +171,33 @@ fn test_cases(
} }
#[cfg(target_os = "macos")] #[cfg(target_os = "macos")]
fn bundle_paths( fn test_cases(
root_dir: &Path, root_dir: &Path,
_version: &str, _version: &str,
v1compatible: bool, target: String,
) -> Vec<(BundleTarget, PathBuf)> { ) -> Vec<(BundleTarget, PathBuf, Option<String>, Vec<i32>)> {
vec![( vec![
BundleTarget::App, (
root_dir.join("target/debug/bundle/macos/app-updater.app"), 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")] #[cfg(target_os = "ios")]

Loading…
Cancel
Save