commit 845af84d3cf9541e14b1bb17129a425fbaace046
parent 796650fe83913bcba59defdf82058f2c032dc0d6
Author: Joris Hartog <jorishartog@hotmail.com>
Date: Sun, 13 Sep 2026 00:00:27 +0200
fix(desktop): allow updater commands from local UI
Diffstat:
5 files changed, 41 insertions(+), 2 deletions(-)
diff --git a/src-tauri/build.rs b/src-tauri/build.rs
@@ -1,3 +1,7 @@
fn main() {
- tauri_build::build();
+ const COMMANDS: &[&str] = &["check_desktop_update", "install_desktop_update"];
+
+ let attributes = tauri_build::Attributes::new()
+ .app_manifest(tauri_build::AppManifest::new().commands(COMMANDS));
+ tauri_build::try_build(attributes).expect("failed to run tauri build script");
}
diff --git a/src-tauri/capabilities/default.json b/src-tauri/capabilities/default.json
@@ -1,7 +1,7 @@
{
"$schema": "../gen/schemas/desktop-schema.json",
"identifier": "default",
- "description": "Allow the main window to start the bundled iuna sidecar.",
+ "description": "Allow the main window and local management UI to run the bundled sidecar and desktop updater.",
"windows": [
"main"
],
@@ -12,6 +12,8 @@
},
"permissions": [
"core:default",
+ "allow-check-desktop-update",
+ "allow-install-desktop-update",
"shell:allow-open",
{
"identifier": "shell:allow-execute",
diff --git a/src-tauri/permissions/autogenerated/check_desktop_update.toml b/src-tauri/permissions/autogenerated/check_desktop_update.toml
@@ -0,0 +1,11 @@
+# Automatically generated - DO NOT EDIT!
+
+[[permission]]
+identifier = "allow-check-desktop-update"
+description = "Enables the check_desktop_update command without any pre-configured scope."
+commands.allow = ["check_desktop_update"]
+
+[[permission]]
+identifier = "deny-check-desktop-update"
+description = "Denies the check_desktop_update command without any pre-configured scope."
+commands.deny = ["check_desktop_update"]
diff --git a/src-tauri/permissions/autogenerated/install_desktop_update.toml b/src-tauri/permissions/autogenerated/install_desktop_update.toml
@@ -0,0 +1,11 @@
+# Automatically generated - DO NOT EDIT!
+
+[[permission]]
+identifier = "allow-install-desktop-update"
+description = "Enables the install_desktop_update command without any pre-configured scope."
+commands.allow = ["install_desktop_update"]
+
+[[permission]]
+identifier = "deny-install-desktop-update"
+description = "Denies the install_desktop_update command without any pre-configured scope."
+commands.deny = ["install_desktop_update"]
diff --git a/src/main_tests.rs b/src/main_tests.rs
@@ -225,9 +225,20 @@ fn transaction_filters_default_to_every_transaction_type() {
fn management_ui_uses_the_native_desktop_updater_when_available() {
let html = include_str!("adapters/http/index_html.rs");
let javascript = include_str!("../www/assets/iuna-ui.js");
+ let tauri_build = include_str!("../src-tauri/build.rs");
+ let capability = include_str!("../src-tauri/capabilities/default.json");
+ let check_permission =
+ include_str!("../src-tauri/permissions/autogenerated/check_desktop_update.toml");
+ let install_permission =
+ include_str!("../src-tauri/permissions/autogenerated/install_desktop_update.toml");
assert!(javascript.contains("invoke(\"check_desktop_update\")"));
assert!(javascript.contains("invoke(\"install_desktop_update\")"));
+ assert!(tauri_build.contains("\"check_desktop_update\", \"install_desktop_update\""));
+ assert!(capability.contains("\"allow-check-desktop-update\""));
+ assert!(capability.contains("\"allow-install-desktop-update\""));
+ assert!(check_permission.contains("commands.allow = [\"check_desktop_update\"]"));
+ assert!(install_permission.contains("commands.allow = [\"install_desktop_update\"]"));
assert!(html.contains("Install and restart"));
assert!(!javascript.contains("window.confirm"));
}