Skip to content

Commit 1fa4d30

Browse files
feat(updater): support non zipped updater (#1174)
1 parent f39586b commit 1fa4d30

6 files changed

Lines changed: 208 additions & 173 deletions

File tree

.changes/updater-non-zip.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"updater": "patch"
3+
---
4+
5+
Add support for updating using non-zipped files on Windows and Linux.

Cargo.lock

Lines changed: 2 additions & 46 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

examples/api/src/views/Updater.svelte

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
isChecking = true;
1313
try {
1414
const update = await check();
15-
onMessage(`Should update: ${update.response.available}`);
16-
onMessage(update.response);
15+
onMessage(`Should update: ${update.available}`);
16+
onMessage(update);
1717
1818
newUpdate = update;
1919
} catch (e) {

plugins/updater/Cargo.toml

Lines changed: 18 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -25,27 +25,33 @@ tokio = "1"
2525
reqwest = { version = "0.12", default-features = false, features = [ "json", "stream" ] }
2626
url = { workspace = true }
2727
http = "1"
28-
dirs-next = "2"
2928
minisign-verify = "0.2"
3029
time = { version = "0.3", features = [ "parsing", "formatting" ] }
3130
base64 = "0.22"
3231
semver = { version = "1", features = [ "serde" ] }
3332
futures-util = "0.3"
3433
tempfile = "3"
35-
zip = "0.6"
34+
infer = "0.15"
35+
36+
[target.'cfg(target_os = "windows")'.dependencies]
37+
zip = { version = "0.6", optional = true }
38+
windows-sys = { version = "0.52.0", features = [
39+
"Win32_Foundation",
40+
"Win32_UI_WindowsAndMessaging",
41+
] }
3642

37-
[target."cfg(target_os = \"windows\")".dependencies]
38-
windows-sys = { version = "0.52.0", features = [ "Win32_Foundation", "Win32_UI_WindowsAndMessaging" ] }
43+
[target.'cfg(target_os = "linux")'.dependencies]
44+
dirs-next = "2"
45+
tar = { version = "0.4", optional = true }
46+
flate2 = { version = "1", optional = true }
3947

40-
[target."cfg(any(target_os = \"macos\", target_os = \"linux\"))".dependencies]
48+
[target.'cfg(target_os = "macos")'.dependencies]
4149
tar = "0.4"
4250
flate2 = "1"
4351

44-
[dev-dependencies]
45-
mockito = "0.31"
46-
4752
[features]
48-
default = [ "rustls-tls" ]
49-
native-tls = [ "reqwest/native-tls" ]
50-
native-tls-vendored = [ "reqwest/native-tls-vendored" ]
51-
rustls-tls = [ "reqwest/rustls-tls" ]
53+
default = ["rustls-tls", "zip"]
54+
zip = ["dep:zip", "dep:tar", "dep:flate2"]
55+
native-tls = ["reqwest/native-tls"]
56+
native-tls-vendored = ["reqwest/native-tls-vendored"]
57+
rustls-tls = ["reqwest/rustls-tls"]

plugins/updater/src/error.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ pub enum Error {
5454
/// UTF8 Errors in signature.
5555
#[error("The signature {0} could not be decoded, please check if it is a valid base64 string. The signature must be the contents of the `.sig` file generated by the Tauri bundler, as a string.")]
5656
SignatureUtf8(String),
57+
#[cfg(all(target_os = "windows", feature = "zip"))]
5758
/// `zip` errors.
5859
#[error(transparent)]
5960
Extract(#[from] zip::result::ZipError),
@@ -62,6 +63,8 @@ pub enum Error {
6263
TempDirNotOnSameMountPoint,
6364
#[error("binary for the current target not found in the archive")]
6465
BinaryNotFoundInArchive,
66+
#[error("invalid updater binary format")]
67+
InvalidUpdaterFormat,
6568
#[error(transparent)]
6669
Http(#[from] http::Error),
6770
#[error(transparent)]

0 commit comments

Comments
 (0)