diff --git a/src-tauri/src/lib.rs b/src-tauri/src/lib.rs index d5e46fd..a68f850 100644 --- a/src-tauri/src/lib.rs +++ b/src-tauri/src/lib.rs @@ -397,6 +397,19 @@ fn is_desktop() -> bool { true } +#[cfg(desktop)] +#[tauri::command] +fn can_auto_update() -> bool { + #[cfg(target_os = "linux")] + { + false + } + #[cfg(not(target_os = "linux"))] + { + true + } +} + #[cfg(not(desktop))] #[tauri::command] fn is_desktop() -> bool { @@ -531,6 +544,7 @@ pub fn run() { app_updates::install_update, browse, browse_types, + can_auto_update, copy_to_clipboard, is_desktop, open, diff --git a/src/app.rs b/src/app.rs index 0585956..99f49d5 100644 --- a/src/app.rs +++ b/src/app.rs @@ -760,6 +760,11 @@ async fn get_version(writer: WriteSignal) { writer.update(|v| *v = ver); } +async fn get_can_auto_update(writer: WriteSignal) { + let can_auto_update = invoke::("can_auto_update", &()).await; + writer.update(|v| *v = can_auto_update); +} + const GITHUB_BASE_URL: &str = "https://github.com/hrzlgnm/mdns-browser"; /// Component for info about the app @@ -767,7 +772,9 @@ const GITHUB_BASE_URL: &str = "https://github.com/hrzlgnm/mdns-browser"; pub fn About() -> impl IntoView { let (version, set_version) = create_signal(String::new()); let (update, set_update) = create_signal(None); + let (can_auto_update, set_can_auto_update) = create_signal(false); create_local_resource(move || set_version, get_version); + create_local_resource(move || set_can_auto_update, get_can_auto_update); let fetch_update_action = create_action(move |_: &()| async move { let update = fetch_update().await; @@ -854,27 +861,34 @@ pub fn About() -> impl IntoView { "Releases" - "Check for updates" - - } + view! {
} } > - + } + } > - "Download and Install " - {{ installable_version }} - + +