diff --git a/README.md b/README.md index 1b53ec9..e704993 100644 --- a/README.md +++ b/README.md @@ -102,7 +102,8 @@ Grab `usage-monitor.exe` from the Put it in a folder of its own that you can write to (e.g. `%LOCALAPPDATA%\UsageMonitor\`) and run it. The app is portable: it keeps `settings.json` next to the exe, so moving the folder keeps your settings. It -self-updates from the same Releases feed. +updates itself from the same Releases feed: when a check finds a new +release, it installs it and restarts on its own, with no click needed. **First-run note:** the binary is unsigned, so SmartScreen will show "Windows protected your PC". Click **More info** → **Run anyway**. Code @@ -117,7 +118,7 @@ pick one: - `usage-monitor_X.Y.Z_amd64.AppImage`: make it executable (`chmod +x`) and run it. Like the Windows exe it is portable and keeps `settings.json` next to the AppImage file, so give it a folder you can - write to. The AppImage self-updates in place. If you turned on "Start + write to. The AppImage updates itself in place, the same way. If you turned on "Start at login" in v0.6.0 or earlier and the AppImage path contains a space, turn it off and on again once: those releases wrote the path unquoted, so the app never started at login. diff --git a/src/runtime.rs b/src/runtime.rs index 4637566..cefc85a 100644 --- a/src/runtime.rs +++ b/src/runtime.rs @@ -657,8 +657,9 @@ impl Runtime { /// Blocking body of [`Self::check_for_updates`]. Only a check that got /// an answer is stamped as the last check; a failed one leaves the - /// stamp alone and has the scheduler retry sooner. - fn run_update_check(&self) { + /// stamp alone and has the scheduler retry sooner. A release found where + /// the app can replace itself is installed straight away. + fn run_update_check(self: &Arc) { let proxy = update::proxy_url(net::env_proxy().as_ref(), self.http.system_proxy()); let outcome = update::check(&self.ui.app, proxy); let succeeded = outcome.is_ok(); @@ -700,6 +701,13 @@ impl Runtime { succeeded, }); self.refresh_shell(false); + let auto_apply = self.with_state(|s| { + s.update_status == UpdateStatus::Available && s.update_channel.can_apply() + }); + if auto_apply { + log::info!("update found; installing it without waiting for a click"); + self.apply_update(); + } } /// Download and install the release the last check found on a worker