fix(update): non-blocking desktop update with progress bar (1.0.7)
Release / Create release (push) Successful in 13s
CI / Format and clippy (push) Successful in 28s
CI / Tests (Linux) (push) Successful in 29s
CI / Dependency audit (push) Successful in 14s
Release / CLI (linux-aarch64) (push) Successful in 53s
Release / CLI (linux-x86_64) (push) Successful in 1m22s
CI / Check desktop app (Linux) (push) Successful in 1m19s
Release / Desktop app (linux-aarch64) (push) Successful in 4m27s
Release / Desktop app (linux-x86_64) (push) Successful in 4m58s
Release / Desktop app (windows) (push) Successful in 3m27s
Release / Create release (push) Successful in 13s
CI / Format and clippy (push) Successful in 28s
CI / Tests (Linux) (push) Successful in 29s
CI / Dependency audit (push) Successful in 14s
Release / CLI (linux-aarch64) (push) Successful in 53s
Release / CLI (linux-x86_64) (push) Successful in 1m22s
CI / Check desktop app (Linux) (push) Successful in 1m19s
Release / Desktop app (linux-aarch64) (push) Successful in 4m27s
Release / Desktop app (linux-x86_64) (push) Successful in 4m58s
Release / Desktop app (windows) (push) Successful in 3m27s
Update commands ran on the UI thread and froze the window; they now run in the background, with a real download percentage bar. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fd7435cc68
commit
1bbb5f934c
12 files changed
+104
-22
No files matched your search
Generated
+2
-2
@@ -2538,7 +2538,7 @@ checksum = "cf54715a573b99ac80df0bc206da022bcd442c974952c7b9720069370852e21f"
|
||||
|
||||
[[package]]
|
||||
name = "sabia-core"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"flate2",
|
||||
@@ -2555,7 +2555,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sabia-gui"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
dependencies = [
|
||||
"libc",
|
||||
"sabia-core",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
[package]
|
||||
name = "sabia-gui"
|
||||
description = "Sabiá: graphical Wi-Fi security auditing interface"
|
||||
version = "1.0.6"
|
||||
version = "1.0.7"
|
||||
edition = "2021"
|
||||
license = "MIT OR Apache-2.0"
|
||||
authors = ["Sabiá contributors"]
|
||||
|
||||
@@ -496,25 +496,44 @@ fn start_scan_opts(
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn update_check(state: tauri::State<'_, State>) -> Result<serde_json::Value, String> {
|
||||
let status = state.0.update_check().map_err(|e| e.to_string())?;
|
||||
serde_json::to_value(status).map_err(|e| e.to_string())
|
||||
async fn update_check(state: tauri::State<'_, State>) -> Result<serde_json::Value, String> {
|
||||
let eng = state.0.clone();
|
||||
tauri::async_runtime::spawn_blocking(move || {
|
||||
let status = eng.update_check().map_err(|e| e.to_string())?;
|
||||
serde_json::to_value(status).map_err(|e| e.to_string())
|
||||
})
|
||||
.await
|
||||
.map_err(|e| e.to_string())?
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
fn update_apply(app: tauri::AppHandle, state: tauri::State<'_, State>) -> Result<String, String> {
|
||||
async fn update_apply(
|
||||
app: tauri::AppHandle,
|
||||
state: tauri::State<'_, State>,
|
||||
) -> Result<String, String> {
|
||||
use tauri::Emitter;
|
||||
#[cfg(any(target_os = "linux", target_os = "macos"))]
|
||||
let exe = elevated_exe().unwrap_or_else(|_| std::env::current_exe().unwrap_or_default());
|
||||
#[cfg(not(any(target_os = "linux", target_os = "macos")))]
|
||||
let exe = std::env::current_exe().unwrap_or_default();
|
||||
|
||||
state
|
||||
.0
|
||||
.update_apply_desktop(&exe, move |phase| {
|
||||
let _ = app.emit("update-progress", serde_json::json!({ "phase": phase }));
|
||||
// Blocking download/install must not run on the UI thread, or the window freezes.
|
||||
let eng = state.0.clone();
|
||||
tauri::async_runtime::spawn_blocking(move || {
|
||||
eng.update_apply_desktop(&exe, move |phase| {
|
||||
let (name, pct) = match phase.split_once(':') {
|
||||
Some((n, p)) => (n, p.parse::<u8>().ok()),
|
||||
None => (phase, None),
|
||||
};
|
||||
let _ = app.emit(
|
||||
"update-progress",
|
||||
serde_json::json!({ "phase": name, "percent": pct }),
|
||||
);
|
||||
})
|
||||
.map_err(|e| e.to_string())
|
||||
})
|
||||
.await
|
||||
.map_err(|e| e.to_string())?
|
||||
}
|
||||
|
||||
/// `true` when the process already has sufficient privileges for all
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"$schema": "https://schema.tauri.app/config/2",
|
||||
"productName": "Sabiá",
|
||||
"version": "1.0.6",
|
||||
"version": "1.0.7",
|
||||
"identifier": "dev.sabia.app",
|
||||
"build": {
|
||||
"frontendDist": "../ui"
|
||||
|
||||
Reference in new issue
Block a user