misterdownloadmanager: The ultimate open-source, clean-room download manager written from scratch in pure Rust for Windows, Mac, and Linux
Rust bittorrent-clientdebriddownload-acceleratordownload-managerdownloadmanagereguifile-downloadergallery-dlidmidm-alternativeinternet-download-managerm3u8-downloadermagnetplaylist-downloaderreal-debridrusttorrent-clientvideo-downloaderyoutube-downloaderyt-dlp
Linux: Open folder no longer freezes the window when the file manager doesn't answer (Fixes #222) (#235)
Ahmed Nefzaoui60261c124e59
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex e30d734f..ffe0a2f4 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -510,6 +510,17 @@ Each release's notes on GitHub come from its section here (`## [X.Y.Z]`, see### Fixed+- **Open folder no longer freezes the window on Linux**+ ([#222](https://github.com/anefzaoui/misterdownloadmanager/issues/222)): Download complete's+ **Open folder** asks the desktop's file manager (over D-Bus) to show the file, and MDM waited+ for its answer on the window's own thread. A file manager slow to start, or one that never+ answered (seen on Pop!_OS), froze the window until the freeze report caught it. MDM now asks in+ the background and, when the file manager hasn't answered within 5 seconds, opens the folder+ instead. Every other program MDM starts from a window goes the same way: Test browser+ integration's **Set it up**, moving an extracted archive to the Trash (on a Mac the Finder may+ ask first), putting an update in place (**Installing the update...**, with Cancel greyed while+ it runs), opening pages and folders, reading the icon theme on Linux and, on a Mac, the accent+ colour (every 2 seconds with the Native theme) and the system's version for a bug report.- **A download too big for the drive is refused on a busy computer too**([#224](https://github.com/anefzaoui/misterdownloadmanager/issues/224)): before a downloadstarts, MDM checks the drive has room for it. It gave up checking after 5 seconds (a networkdiff --git a/ROADMAP.md b/ROADMAP.mdindex a9b1edb5..28b53951 100644--- a/ROADMAP.md+++ b/ROADMAP.md@@ -13,6 +13,11 @@ Everything below ships together, in one release, as version 0.3.0.### Done+- ✅ Open folder in Download complete no longer freezes the window on Linux when the file+ manager is slow to answer or never does: MDM asks in the background and opens the folder after+ 5 seconds without an answer; every other program a window starts (Set it up, the Trash, an+ update being put in place, pages and folders) no longer holds the window either+ ([#222](https://github.com/anefzaoui/misterdownloadmanager/issues/222))- ✅ A download too big for its drive is refused on a very busy computer too: the free-spacecheck's 5 seconds count from when it runs, not from when it was asked, and it asks only thefolder's own drive (shared network folders too) instead of listing every drive; and the hostdiff --git a/crates/app/Cargo.toml b/crates/app/Cargo.tomlindex 169a35ea..b109cf8b 100644--- a/crates/app/Cargo.toml+++ b/crates/app/Cargo.toml@@ -12,6 +12,13 @@ publish.workspace = truename = "misterdownloadmanager"path = "src/main.rs"+[features]+# Update now's end-to-end tests only, never in a release (see mdm-tools): a test key for a fake+# release (MDM_TEST_UPDATE_KEY), `/show update-now` (Update now in the window `/show updates`+# opens), and MDM_TEST_UPDATE_HOLD (seconds the update waits before it's put in place, to see and+# close the window meanwhile). tools/lab/update runs them.+test-update = ["mdm-tools/test-update"]+[dependencies]arboard.workspace = truebase64.workspace = truediff --git a/crates/app/src/app.rs b/crates/app/src/app.rsindex 0d7c1eda..2339c7be 100644--- a/crates/app/src/app.rs+++ b/crates/app/src/app.rs@@ -1673,6 +1673,14 @@ impl App {"find" => self.run(Cmd::Find, None, ctx),"scheduler" => self.run(Cmd::Scheduler, None, ctx),"about" => self.run(Cmd::About, None, ctx),+ // Update now's end-to-end tests (feature `test-update`, never in a release): Update+ // now pressed in the window `/show updates` opened (against MDM_UPDATE_FEED).+ #[cfg(feature = "test-update")]+ "update-now" => {+ if let Some(u) = &mut self.updates {+ u.press_update_now();+ }+ }// The main window into the tray, as closing it does (tests and #72's measurements)."tray" => self.hide_to_tray(ctx),// The main window minimized, not to the tray (tests of #162).@@ -4105,7 +4113,7 @@ impl App {self.sound(3);let sch = self.queues[q].schedule.clone();if let Some(path) = &sch.open_when_done {- let _ = open::that_detached(path);+ crate::launch::open(path);}self.when_done(sch.when_done());}@@ -4189,7 +4197,7 @@ impl App {Cmd::Browse(c) => {let dir = self.settings.category_dir(c, &self.downloads);let _ = std::fs::create_dir_all(&dir);- let _ = open::that_detached(dir);+ crate::launch::open(dir);}Cmd::DoubleClickOpen(open) => {self.settings.double_click_open = open;@@ -4275,7 +4283,7 @@ impl App {Cmd::OpenThemesFolder => {if let Some(dir) = crate::themefile::dir() {let _ = std::fs::create_dir_all(&dir);- let _ = open::that_detached(dir);+ crate::launch::open(dir);}}#[cfg(gpu)]@@ -4329,7 +4337,7 @@ impl App {.find(|i| i.id == id).and_then(|i| i.context.referer.clone());if let Some(page) = page {- let _ = open::that_detached(page);+ crate::launch::open(page);}self.properties(id);}diff --git a/crates/app/src/crashui.rs b/crates/app/src/crashui.rsindex 7909c4aa..c4971ebf 100644--- a/crates/app/src/crashui.rs+++ b/crates/app/src/crashui.rs@@ -587,7 +587,7 @@ impl ReportWindow {if send {if let Some(f) = &found {crate::copy_text(ui.ctx(), full.clone());- let _ = open::that_detached(&f.html_url);+ crate::launch::open(&f.html_url);// i18n: crash report window: after opening the existing issueself.told = Some(crate::i18n::t(@@ -606,7 +606,7 @@ impl ReportWindow {&made.text,"(The report was cut to fit here. The whole of it is in the .txt file in the folder that just opened: please drag it into this box.)",);- let _ = open::that_detached(url);+ crate::launch::open(url);crate::dialogs::show_in_folder(&made.path);// i18n: crash report window: after Send opened the browserself.told = Some(crate::i18n::t("The form opened in your browser. Drag the report's file (and the .dmp, if you chose to) into it, then submit.").to_owned());diff --git a/crates/app/src/debrid.rs b/crates/app/src/debrid.rsindex b8758be6..c1c2d20b 100644--- a/crates/app/src/debrid.rs+++ b/crates/app/src/debrid.rs@@ -185,7 +185,7 @@ impl SignIn {// The page opens in the browser, except in off-screen test runs and against the// lab's fake service (whose page is the real one's address).if !crate::offscreen() && std::env::var_os("MDM_DEBRID_LAB").is_none() {- let _ = open::that_detached(&code.page);+ crate::launch::open(&code.page);}loop {if me.stop.load(std::sync::atomic::Ordering::Relaxed) {diff --git a/crates/app/src/dialogs.rs b/crates/app/src/dialogs.rsindex 8543d1b4..b5cf4e1c 100644--- a/crates/app/src/dialogs.rs+++ b/crates/app/src/dialogs.rs@@ -2188,7 +2188,9 @@ pub fn told() -> Vec<(&'static str, String)> {}/// Open a downloaded file with its program, or say why not (moved or deleted since, no-/// program for it): it did nothing at all. True when it was handed to the system.+/// program for it): it did nothing at all. True when it was handed to the system. Waited for+/// (the `open` crate's launcher, at most 250 ms each on Windows and Linux), unlike+/// crate::launch's: whether it failed decides whether Download complete stays open.pub fn open_file(path: &Path) -> bool {let name = crate::i18n::isolate(&path.file_name().unwrap_or_default().to_string_lossy());let failed = if !path.exists() {@@ -2217,7 +2219,7 @@ pub fn show_in_folder(path: &Path) {use std::os::windows::process::CommandExt;if !path.exists() {if let Some(dir) = path.parent().filter(|d| d.is_dir()) {- let _ = open::that_detached(dir);+ crate::launch::open(dir);}return;}@@ -2244,7 +2246,7 @@ pub fn open_with(path: &Path) {}#[cfg(not(windows))]{- let _ = open::that_detached(path);+ crate::launch::open(path);}}diff --git a/crates/app/src/extension.rs b/crates/app/src/extension.rsindex fd299875..2e3d7a17 100644--- a/crates/app/src/extension.rs+++ b/crates/app/src/extension.rs@@ -7,6 +7,7 @@//! offer; `/show extension` brings it back.use std::path::PathBuf;+use std::sync::atomic::{AtomicBool, AtomicU64, Ordering};use std::time::Duration;use egui::{Pos2, Ui};@@ -38,6 +39,8 @@ pub struct Extension {registered: bool,/// When the status files were read last (once a second, not every frame).looked: std::time::Instant,+ /// Set it up's runs seen finished ([`set_up_finished`]).+ set_up_seen: u64,}/// Whether `row` (a browser as the window lists it) is among the browsers seen (as Options@@ -82,6 +85,7 @@ impl Extension {seen: seen_names(),registered: registered(),looked: std::time::Instant::now(),+ set_up_seen: 0,}}@@ -89,7 +93,8 @@ impl Extension {pub fn show(&mut self, ctx: &egui::Context) -> Outcome<()> {// The host marks the extension seen when a browser starts it: look again now and then// (each browser's own, as each adds it).- if self.looked.elapsed() >= Duration::from_secs(1) {+ if self.looked.elapsed() >= Duration::from_secs(1) || set_up_finished(&mut self.set_up_seen)+ {self.looked = std::time::Instant::now();self.connected = mdm_ipc::extension::seen();self.seen = seen_names();@@ -211,7 +216,7 @@ impl Extension {#[cfg(unix)]Some(program) => crate::unix::open_in(program, url),None => {- let _ = open::that_detached(url);+ crate::launch::open(url);}}}@@ -245,8 +250,7 @@ impl Extension {None,);if fix.clicked() {- set_up();- self.registered = registered();+ set_up(ui.ctx());}}let (line, color) = if !self.registered {@@ -339,19 +343,54 @@ pub fn registered() -> bool {return crate::unix::host_registered();}+/// Set it up's runs finished so far: a window that shows the checks reads them again when this+/// changes ([`set_up_finished`]).+static SET_UP_DONE: AtomicU64 = AtomicU64::new(0);+/// A Set it up is running (a second press waits for it).+static SETTING_UP: AtomicBool = AtomicBool::new(false);+/// How long the native host's `--register` has (it writes a few files, or registry keys).+const SET_UP_LIMIT: Duration = Duration::from_secs(20);+/// Register it now, for a copy installed without it (the setup's box unticked): the native-/// host's own `--register`, for this user, waited for (the checks read the result next).-pub fn set_up() {- #[cfg(unix)]- crate::unix::register_browsers_now();- #[cfg(windows)]- if let Ok(exe) = std::env::current_exe() {- let _ = std::process::Command::new(exe.with_file_name("misterdownloadmanager-nmhost.exe"))- .arg("--register")- .status();+/// host's own `--register`, for this user, on a thread of its own (a program waited for on the+/// window's thread freezes it for as long as the program takes, #222). The window repaints when+/// it's done, and [`set_up_finished`] tells the checks to read the result.+pub fn set_up(ctx: &egui::Context) {+ if SETTING_UP.swap(true, Ordering::AcqRel) {+ return;+ }+ let ctx = ctx.clone();+ let started = std::thread::Builder::new()+ .name("set-up".into())+ .spawn(move || {+ #[cfg(unix)]+ crate::unix::register_browsers_now(SET_UP_LIMIT);+ #[cfg(windows)]+ if let Ok(exe) = std::env::current_exe() {+ crate::launch::run_within(+ std::process::Command::new(+ exe.with_file_name("misterdownloadmanager-nmhost.exe"),+ )+ .arg("--register"),+ SET_UP_LIMIT,+ );+ }+ SETTING_UP.store(false, Ordering::Release);+ SET_UP_DONE.fetch_add(1, Ordering::AcqRel);+ ctx.request_repaint();+ });+ if started.is_err() {+ SETTING_UP.store(false, Ordering::Release);}}+/// Whether a Set it up finished since `seen` was last given here (it is then brought up to+/// date): the caller reads the checks again.+pub fn set_up_finished(seen: &mut u64) -> bool {+ let done = SET_UP_DONE.load(Ordering::Acquire);+ std::mem::replace(seen, done) != done+}+/// One line of Options → General → Test browser integration: what was checked, whether it/// holds, and the help page's section when it doesn't.pub struct Check {diff --git a/crates/app/src/extractq.rs b/crates/app/src/extractq.rsindex 7bd25957..d83a4591 100644--- a/crates/app/src/extractq.rs+++ b/crates/app/src/extractq.rs@@ -37,7 +37,10 @@ struct Job {referer: Option<String>,}-type Slot = Arc<Mutex<Option<Result<Report, Error>>>>;+/// An archive's outcome, from its thread: the report, and with "delete the archive" whether it+/// went to the Trash (moved there on that thread too: `gio trash`, `trash`, the Finder, which+/// may ask first, are programs the window's thread doesn't wait for, #222).+type Slot = Arc<Mutex<Option<(Result<Report, Error>, Option<bool>)>>>;struct Running {job: Job,@@ -191,10 +194,10 @@ impl Extracts {.running.as_ref().and_then(|r| r.result.lock().unwrap().take());- if let Some(result) = done+ if let Some((result, trashed)) = done&& let Some(run) = self.running.take(){- self.finish(run.job, result, items);+ self.finish(run.job, result, trashed, items);changed = true;}if self.running.is_none()@@ -209,7 +212,13 @@ impl Extracts {changed}- fn finish(&mut self, job: Job, result: Result<Report, Error>, items: &mut [Item]) {+ fn finish(+ &mut self,+ job: Job,+ result: Result<Report, Error>,+ trashed: Option<bool>,+ items: &mut [Item],+ ) {let name = job.archive.file_name()@@ -280,9 +289,7 @@ impl Extracts {),);}- if job.delete {- let present: Vec<PathBuf> = job.files.iter().filter(|f| f.exists()).cloned().collect();- let gone = to_trash(&present);+ if let Some(gone) = trashed {let text = match (gone, cfg!(windows)) {// i18n: in a download's log: the downloaded archive, after it was extracted(true, true) => crate::i18n::t("The archive was moved to the Recycle Bin"),@@ -408,11 +415,17 @@ fn start(job: Job, ctx: &egui::Context) -> Running {.spawn(move || {let r = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| run(&j, &stop))).unwrap_or_else(|_| Err(Error::Damaged("the decoder failed".into())));- *slot.lock().unwrap() = Some(r);+ // Extracted: the archive (and its volumes) to the Trash, when asked.+ let trashed = (r.is_ok() && j.delete).then(|| {+ let present: Vec<PathBuf> =+ j.files.iter().filter(|f| f.exists()).cloned().collect();+ to_trash(&present)+ });+ *slot.lock().unwrap() = Some((r, trashed));ctx.request_repaint();});if let Err(e) = spawned {- *result.lock().unwrap() = Some(Err(Error::Io(e)));+ *result.lock().unwrap() = Some((Err(Error::Io(e)), None));}Running {job,@@ -512,7 +525,7 @@ impl ToolDialog {],);if row[0].clicked() {- let _ = open::that_detached("https://www.7-zip.org/");+ crate::launch::open("https://www.7-zip.org/");}if row[1].clicked() || winui::escape_pressed(ui) || winui::enter_pressed(ui) {Outcome::Done(())diff --git a/crates/app/src/help.rs b/crates/app/src/help.rsindex 13089f53..1070a1e5 100644--- a/crates/app/src/help.rs+++ b/crates/app/src/help.rs@@ -72,7 +72,7 @@ pub fn page_url(doc: &str, lang: &str) -> String {/// person at the browser.pub fn open_page(doc: &str) {if !crate::offscreen() {- let _ = open::that_detached(page_url(doc, crate::i18n::code()));+ crate::launch::open(page_url(doc, crate::i18n::code()));}}@@ -81,7 +81,7 @@ pub fn open_page(doc: &str) {/// clicks come from scripts, not from a person at the browser.pub fn support() {if !crate::offscreen() {- let _ = open::that_detached(SPONSORS);+ crate::launch::open(SPONSORS);}}@@ -90,12 +90,19 @@ pub fn support() {/// language. The parameters are the form's field ids (all text fields: GitHub's page drops a/// dropdown's value from the address).pub fn report_problem() {- let enc = |s: &str| url::form_urlencoded::byte_serialize(s.as_bytes()).collect::<String>();- let url = report_fields().iter().fold(- format!("{REPO}/issues/new?template=bug.yml"),- |url, (k, v)| format!("{url}&{k}={}", enc(v)),- );- let _ = open::that_detached(url);+ // On a thread of its own: the fields ask the system (macOS: `sw_vers`), which the window's+ // thread doesn't wait for (#222).+ let _ = std::thread::Builder::new()+ .name("report-problem".into())+ .spawn(|| {+ let enc =+ |s: &str| url::form_urlencoded::byte_serialize(s.as_bytes()).collect::<String>();+ let url = report_fields().iter().fold(+ format!("{REPO}/issues/new?template=bug.yml"),+ |url, (k, v)| format!("{url}&{k}={}", enc(v)),+ );+ let _ = open::that_detached(url);+ });}/// The Bug report form's fields MDM fills in: (field id, value).@@ -261,6 +268,8 @@ pub struct Updates {job: Option<crate::update::Job>,/// What Update now came to, when it didn't close MDM.status: Option<UpdateStatus>,+ /// Update now pressed by a test (`/show update-now`, feature `test-update`).+ press: bool,}#[derive(Clone, Debug)]@@ -271,12 +280,19 @@ enum UpdateStatus {}impl Updates {+ /// Update now, as if pressed (`/show update-now`: Update now's end-to-end tests).+ #[cfg(feature = "test-update")]+ pub fn press_update_now(&mut self) {+ self.press = true;+ }+pub fn check(rt: &tokio::runtime::Handle, ctx: &egui::Context) -> Self {Updates {slot: Some(check(rt, ctx)),result: None,job: None,status: None,+ press: false,}}@@ -287,6 +303,7 @@ impl Updates {result: Some(Ok(Found::Newer(release))),job: None,status: None,+ press: false,}}@@ -303,11 +320,19 @@ impl Updates {self.slot = None;}let install = mdm_tools::update::Install::detect();- // The release file arrived (checked): put it in place.+ // The release file arrived (checked) and is in place (on the job's thread): MDM closes+ // once the new copy (or the installer) has started.if let Some(res) = self.job.as_ref().and_then(crate::update::Job::result) {self.job = None;- match res.and_then(|file| crate::update::apply(install, &file)) {- Ok(crate::update::Next::Restart) => return Outcome::Done(true),+ let started = res.and_then(|next| match next {+ crate::update::Next::Restart(mut cmd) => cmd+ .spawn()+ .map(|_| crate::update::Next::Restart(cmd))+ .map_err(|e| e.to_string()),+ opened => Ok(opened),+ });+ match started {+ Ok(crate::update::Next::Restart(_)) => return Outcome::Done(true),Ok(crate::update::Next::Opened) => self.status = Some(UpdateStatus::Opened),Err(e) => self.status = Some(UpdateStatus::Failed(e)),}@@ -459,16 +484,24 @@ impl Updates {vec2(status_right - 11.0, 21.0),);if let Some(job) = &self.job {- let fraction = job.progress.fraction();- let line = crate::i18n::fmt(- // i18n: Check for updates, while Update now downloads; {percent} like "42%"- crate::i18n::t("Downloading the update... {percent}"),- &[(- "percent",- &fraction- .map_or(String::new(), |f| crate::i18n::percent(f64::from(f), 0)),- )],- );+ let installing = job.installing();+ // Put in place: a bar that moves, no percent.+ let fraction = job.progress.fraction().filter(|_| !installing);+ let line = if installing {+ // i18n: Check for updates, after Update now downloaded it: unpacking and putting the new version in place+ crate::i18n::t("Installing the update...").to_owned()+ } else {+ crate::i18n::fmt(+ // i18n: Check for updates, while Update now downloads; {percent} like "42%"+ crate::i18n::t("Downloading the update... {percent}"),+ &[(+ "percent",+ &fraction.map_or(String::new(), |f| {+ crate::i18n::percent(f64::from(f), 0)+ }),+ )],+ )+ };winui::text(&p, status_rc.left(), status_rc.top() + 9.0, &line, ink);winui::progress_bar(&p,@@ -536,11 +569,15 @@ impl Updates {};// i18n: button: download and install the new version, then restartlet update = winui::button(ui, at, "Update now", kind, false, None);- if update.clicked() || (enter && idle) {+ if update.clicked()+ || (enter && idle)+ || (idle && std::mem::take(&mut self.press))+ {self.status = None;self.job = Some(crate::update::Job::start(rt,ui.ctx(),+ install,rel.assets.clone(),asset,));@@ -549,11 +586,18 @@ impl Updates {.clicked()|| enter{- let _ = open::that_detached(&rel.page);+ crate::launch::open(&rel.page);return Outcome::Done(false);}}- let kind = if download.is_some() || matches!(result, Some(Err(_))) {+ // Being put in place: nothing can stop that, so no Cancel (nor Esc) meanwhile.+ let installing = self+ .job+ .as_ref()+ .is_some_and(crate::update::Job::installing);+ let kind = if installing {+ ButtonKind::Disabled+ } else if download.is_some() || matches!(result, Some(Err(_))) {ButtonKind::Normal} else {ButtonKind::Default@@ -567,7 +611,9 @@ impl Updates {None,).clicked();- if close && self.job.is_some() {+ if installing {+ Outcome::Open+ } else if close && self.job.is_some() {// Cancel: the download stops, the window stays (Update now again, Later).self.job = None;Outcome::Open@@ -703,7 +749,7 @@ impl About {open_page("");}if winui::link(ui, &p, source.0, source.1, "Source code", "source") {- let _ = open::that_detached(REPO);+ crate::launch::open(REPO);}if winui::link(ui,@@ -713,7 +759,7 @@ impl About {"Licenses and credits","credits",) {- let _ = open::that_detached(format!("{REPO}/blob/main/ATTRIBUTION.md"));+ crate::launch::open(format!("{REPO}/blob/main/ATTRIBUTION.md"));}// Its own row under them: the creator's Sponsors page (Help → Support MDM).y += 22.0;diff --git a/crates/app/src/launch.rs b/crates/app/src/launch.rsnew file mode 100644index 00000000..95af00e3--- /dev/null+++ b/crates/app/src/launch.rs@@ -0,0 +1,211 @@+//! Other programs MDM starts and waits for, and the files and pages it hands to the system,+//! never waited for on the window's thread (#222): a frame that waits for a program freezes the+//! window for as long as that program takes, and a program can take forever (a file manager+//! that never answers over D-Bus froze the window until the freeze report caught it). So a+//! window starts them here, on a thread of their own, each with a time limit, and goes on.++use std::ffi::OsStr;+use std::io::Read;+use std::process::{Child, Command, ExitStatus, Output, Stdio};+use std::time::{Duration, Instant};++/// Run `cmd` quietly on a thread of its own, waiting at most `limit` for it; when it can't+/// start, fails or runs out of time (it is then ended), `fallback` runs, on that thread.+/// Returns at once.+// Windows' callers start their programs (Explorer) without waiting for them.+#[cfg_attr(windows, allow(dead_code))]+pub fn run_detached_with_fallback(+ mut cmd: Command,+ limit: Duration,+ fallback: impl FnOnce() + Send + 'static,+) {+ let name = program_name(&cmd);+ let started = std::thread::Builder::new()+ .name("launch".into())+ .spawn(move || {+ if !run_within(&mut cmd, limit) {+ fallback();+ }+ });+ if let Err(e) = started {+ tracing::warn!("{name}: no thread to run it on: {e}");+ }+}++/// Hand `target` (a file, a folder or an address) to the system's program for it, on a thread+/// of its own: the `open` crate waits for the launcher it starts (up to 250 ms each on Windows+/// and Linux, until it exits on macOS).+pub fn open(target: impl AsRef<OsStr>) {+ let target = target.as_ref().to_owned();+ let started = std::thread::Builder::new()+ .name("launch".into())+ .spawn(move || {+ let _ = open::that_detached(&target);+ });+ if let Err(e) = started {+ tracing::warn!("open: no thread to run it on: {e}");+ }+}++/// Run `cmd` quietly, waiting at most `limit` for it: true when it ran and succeeded. One that+/// runs out of time is ended. For a thread other than the window's.+pub fn run_within(cmd: &mut Command, limit: Duration) -> bool {+ let child = cmd+ .stdin(Stdio::null())+ .stdout(Stdio::null())+ .stderr(Stdio::null())+ .spawn();+ match child {+ Ok(mut child) => wait_within(&mut child, limit).is_some_and(|s| s.success()),+ Err(e) => {+ tracing::debug!("{}: {e}", program_name(cmd));+ false+ }+ }+}++/// What `cmd` writes (its output, its exit status), waiting at most `limit` for it; None when it+/// couldn't start or ran out of time (it is then ended). Its errors are dropped.+// Windows reads what these ask (versions, settings) from the registry, without a program.+#[cfg_attr(windows, allow(dead_code))]+pub fn output_within(cmd: &mut Command, limit: Duration) -> Option<Output> {+ let mut child = cmd+ .stdin(Stdio::null())+ .stdout(Stdio::piped())+ .stderr(Stdio::null())+ .spawn()+ .ok()?;+ // Read as it writes, so a long output can't fill the pipe and stall it; a program it+ // started that keeps the pipe open can't hold this caller either (the reader is let go).+ let mut pipe = child.stdout.take()?;+ let (tx, rx) = std::sync::mpsc::channel();+ std::thread::Builder::new()+ .name("launch-output".into())+ .spawn(move || {+ let mut out = Vec::new();+ let _ = pipe.read_to_end(&mut out);+ let _ = tx.send(out);+ })+ .ok()?;+ let start = Instant::now();+ let status = wait_within(&mut child, limit)?;+ let left = limit.saturating_sub(start.elapsed()) + Duration::from_millis(100);+ let stdout = rx.recv_timeout(left).ok()?;+ Some(Output {+ status,+ stdout,+ stderr: Vec::new(),+ })+}++/// Wait for `child` at most `limit`: its exit status, or None when it ran out of time (it is+/// ended and reaped) or couldn't be waited for.+fn wait_within(child: &mut Child, limit: Duration) -> Option<ExitStatus> {+ let start = Instant::now();+ loop {+ match child.try_wait() {+ Ok(Some(status)) => return Some(status),+ Ok(None) if start.elapsed() < limit => {+ std::thread::sleep(Duration::from_millis(20));+ }+ Ok(None) => {+ tracing::warn!("a program still running after {limit:?} was ended");+ let _ = child.kill();+ let _ = child.wait();+ return None;+ }+ Err(e) => {+ tracing::warn!("a program couldn't be waited for: {e}");+ return None;+ }+ }+ }+}++fn program_name(cmd: &Command) -> String {+ cmd.get_program().to_string_lossy().into_owned()+}++#[cfg(all(test, unix))]+mod tests {+ use super::*;+ use std::path::{Path, PathBuf};++ /// A shell script `name` in `dir`.+ fn script(dir: &Path, name: &str, body: &str) -> PathBuf {+ std::fs::create_dir_all(dir).unwrap();+ let file = dir.join(name);+ std::fs::write(&file, format!("#!/bin/sh\n{body}\n")).unwrap();+ file+ }++ /// The script run by `sh`: executing a file just written can fail with "text file busy"+ /// while another test's thread starts a program (it holds the file open for a moment).+ fn sh(file: &Path) -> Command {+ let mut cmd = Command::new("/bin/sh");+ cmd.arg(file);+ cmd+ }++ fn temp(name: &str) -> PathBuf {+ let d = std::env::temp_dir().join(format!("mdm-launch-{name}-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&d);+ d+ }++ #[test]+ fn a_hanging_program_never_holds_the_caller_and_falls_back() {+ let dir = temp("hang");+ let hang = script(&dir, "hang", "exec sleep 30");+ let (tx, rx) = std::sync::mpsc::channel();+ let start = Instant::now();+ run_detached_with_fallback(sh(&hang), Duration::from_millis(500), move || {+ let _ = tx.send(Instant::now());+ });+ assert!(+ start.elapsed() < Duration::from_millis(200),+ "the caller waited"+ );+ let fell_back = rx+ .recv_timeout(Duration::from_secs(5))+ .expect("no fallback");+ // Ended at its limit, not after its 30 s.+ assert!(fell_back - start < Duration::from_secs(3));+ let _ = std::fs::remove_dir_all(dir);+ }++ #[test]+ fn a_program_that_succeeds_has_no_fallback_and_one_that_fails_has_one() {+ let dir = temp("exit");+ for (body, falls_back) in [("exit 0", false), ("exit 3", true)] {+ let prog = script(&dir, "prog", body);+ let (tx, rx) = std::sync::mpsc::channel();+ run_detached_with_fallback(sh(&prog), Duration::from_secs(5), move || {+ let _ = tx.send(());+ });+ let got = rx.recv_timeout(Duration::from_secs(3)).is_ok();+ assert_eq!(got, falls_back, "{body}");+ }+ let missing = dir.join("no-such-program");+ let (tx, rx) = std::sync::mpsc::channel();+ run_detached_with_fallback(Command::new(missing), Duration::from_secs(5), move || {+ let _ = tx.send(());+ });+ assert!(rx.recv_timeout(Duration::from_secs(3)).is_ok(), "missing");+ let _ = std::fs::remove_dir_all(dir);+ }++ #[test]+ fn output_within_reads_the_output_and_gives_up_on_a_hang() {+ let dir = temp("output");+ let say = script(&dir, "say", "echo blue");+ let out = output_within(&mut sh(&say), Duration::from_secs(5)).unwrap();+ assert!(out.status.success());+ assert_eq!(String::from_utf8_lossy(&out.stdout).trim(), "blue");+ let hang = script(&dir, "hang", "exec sleep 30");+ let start = Instant::now();+ assert!(output_within(&mut sh(&hang), Duration::from_millis(300)).is_none());+ assert!(start.elapsed() < Duration::from_secs(3));+ let _ = std::fs::remove_dir_all(dir);+ }+}diff --git a/crates/app/src/main.rs b/crates/app/src/main.rsindex eee4dff5..8e03b233 100644--- a/crates/app/src/main.rs+++ b/crates/app/src/main.rs@@ -24,6 +24,7 @@ mod helpers;mod i18n;mod icons;mod langpick;+mod launch;mod list;mod model;mod native;@@ -237,6 +238,9 @@ fn app() -> eframe::Result {// This launch is MDM: its fonts are looked up while the rest starts (only the instance pays// for them, not a launch that hands its command over).theme::prepare_fonts();+ // And the file icons' themes (Linux: gsettings), off the window's thread.+ #[cfg(target_os = "linux")]+ unix::prepare_file_icons();// What an earlier update set aside (old programs, a Mac's old app, downloaded files).update::tidy();// The command channel opens now, before the window: the browser's host that started MDMdiff --git a/crates/app/src/options.rs b/crates/app/src/options.rsindex 8fe9dca3..941c3fb5 100644--- a/crates/app/src/options.rs+++ b/crates/app/src/options.rs@@ -181,6 +181,8 @@ pub struct OptionsDialog {seven_zip: Option<std::path::PathBuf>,/// Proxy / Socks → Network adapter (#35): the computer's adapters, read again every 2 s.adapters: Option<(std::time::Instant, Vec<mdm_engine::net::Adapter>)>,+ /// Test browser integration → Set it up's runs seen finished (crate::extension).+ set_up_seen: u64,}impl OptionsDialog {@@ -233,6 +235,7 @@ impl OptionsDialog {account_rows: Default::default(),sound_rows: Default::default(),sub: None,+ set_up_seen: 0,cat_edit: None,restore_ask: None,learned,@@ -2725,8 +2728,11 @@ impl OptionsDialog {}},);+ // Set it up runs on a thread of its own; the checks are read again once it's done.if set_up {- crate::extension::set_up();+ crate::extension::set_up(ctx);+ }+ if crate::extension::set_up_finished(&mut self.set_up_seen) {checks = crate::extension::checks(&self.s);}if matches!(out, Outcome::Open) {@@ -3208,7 +3214,7 @@ fn account_dialog(ui: &mut Ui, o: Pos2, e: &mut AccountEdit) -> Outcome<settings/// whose clicks come from scripts, not from a person at the browser.fn open_page(url: &str) {if !crate::offscreen() {- let _ = open::that_detached(url);+ crate::launch::open(url);}}diff --git a/crates/app/src/unix.rs b/crates/app/src/unix.rsindex 6e7bc441..5a5d36df 100644--- a/crates/app/src/unix.rs+++ b/crates/app/src/unix.rs@@ -102,14 +102,11 @@ pub fn register_browsers() {}}-/// `register_browsers`, waiting for it to finish (Test browser integration's Set it up).-pub fn register_browsers_now() {+/// `register_browsers`, waiting for it to finish, up to `limit` (Test browser integration's Set+/// it up, on a thread of its own: extension::set_up).+pub fn register_browsers_now(limit: std::time::Duration) {if let Some(mut cmd) = register_command() {- let _ = cmd- .stdin(Stdio::null())- .stdout(Stdio::null())- .stderr(Stdio::null())- .status();+ crate::launch::run_within(&mut cmd, limit);}}@@ -179,12 +176,12 @@ pub fn play_sound(file: &str) {/// distribution's name from /etc/os-release ("Ubuntu 24.04.1 LTS").pub fn os_version() -> String {if cfg!(target_os = "macos") {- let v = Command::new("sw_vers")- .arg("-productVersion")- .output()- .ok()- .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())- .unwrap_or_default();+ let v = crate::launch::output_within(+ Command::new("sw_vers").arg("-productVersion"),+ std::time::Duration::from_secs(2),+ )+ .map(|o| String::from_utf8_lossy(&o.stdout).trim().to_owned())+ .unwrap_or_default();return format!("macOS {v}").trim_end().to_owned();}std::fs::read_to_string("/etc/os-release")@@ -197,12 +194,24 @@ pub fn os_version() -> String {.unwrap_or_else(|| "Linux".into())}+/// How long the file manager has to answer ShowItems before its folder is opened instead: one+/// started for it (D-Bus activation) answers in a second or two.+const SHOW_ITEMS_LIMIT: std::time::Duration = std::time::Duration::from_secs(5);+/// Show the file selected in the file manager (macOS: Finder; Linux: the desktop's file-/// manager through D-Bus, else its folder opened).+/// manager through D-Bus, else its folder opened). Returns at once: the file manager is asked+/// on a thread of its own (crate::launch), as one slow to start, or that never answers, froze+/// the window for as long as `gdbus` waited (#222); when it doesn't answer within+/// [`SHOW_ITEMS_LIMIT`], the folder is opened instead.+///+/// `gdbus` rather than a zbus call: the same tool and call the desktops answered before, ended+/// at the limit by crate::launch (zbus's blocking calls have no time limit of their own, and a+/// connection to the session bus would be made for this one call).pub fn show_in_folder(path: &Path) {+ let dir = path.parent().map(Path::to_path_buf);if !path.exists() {- if let Some(dir) = path.parent().filter(|d| d.is_dir()) {- let _ = open::that_detached(dir);+ if let Some(dir) = dir.filter(|d| d.is_dir()) {+ crate::launch::open(dir);}return;}@@ -213,26 +222,24 @@ pub fn show_in_folder(path: &Path) {let Ok(url) = url::Url::from_file_path(path) else {return;};- let shown = Command::new("gdbus")- .args([- "call",- "--session",- "--dest",- "org.freedesktop.FileManager1",- "--object-path",- "/org/freedesktop/FileManager1",- "--method",- "org.freedesktop.FileManager1.ShowItems",- &format!("['{}']", url.as_str().replace('\'', "%27")),- "",- ])- .stdout(Stdio::null())- .stderr(Stdio::null())- .status()- .is_ok_and(|s| s.success());- if !shown && let Some(dir) = path.parent() {- let _ = open::that_detached(dir);- }+ let mut gdbus = Command::new("gdbus");+ gdbus.args([+ "call",+ "--session",+ "--dest",+ "org.freedesktop.FileManager1",+ "--object-path",+ "/org/freedesktop/FileManager1",+ "--method",+ "org.freedesktop.FileManager1.ShowItems",+ &format!("['{}']", url.as_str().replace('\'', "%27")),+ "",+ ]);+ crate::launch::run_detached_with_fallback(gdbus, SHOW_ITEMS_LIMIT, move || {+ if let Some(dir) = dir {+ let _ = open::that_detached(dir);+ }+ });}/// Options → Downloads → open magnet links and .torrent files with Mister Download Manager:@@ -441,18 +448,51 @@ fn accent_parts(parts: &[f64]) -> Option<egui::Color32> {/// macOS's accent colour (System Settings → Appearance), from `defaults read -g/// AppleAccentColor`: -1 graphite, 0 red, 1 orange, 2 yellow, 3 green, 4 blue, 5 purple, 6 pink;/// no value is the default (multicolour: blue). Mapped to Apple's published system colours.+///+/// The Native theme asks every 2 s, from the window's thread, so `defaults` runs on a thread of+/// its own (#222) and this answers what it said last, one check late; only the first answer is+/// waited for, at most half a second, so Native starts in the right colour.#[cfg(target_os = "macos")]pub fn mac_accent() -> Option<egui::Color32> {- let out = Command::new("defaults")- .args(["read", "-g", "AppleAccentColor"])- .stderr(Stdio::null())- .output()- .ok()?;- let n = String::from_utf8_lossy(&out.stdout)- .trim()- .parse::<i32>()- .ok();- Some(mac_accent_color(n))+ use std::sync::Mutex;+ use std::sync::atomic::{AtomicBool, Ordering};+ use std::time::{Duration, Instant};+ /// What `defaults` said last (None: not yet; Some(None): it couldn't be asked).+ static SAID: Mutex<Option<Option<egui::Color32>>> = Mutex::new(None);+ static ASKING: AtomicBool = AtomicBool::new(false);+ let said = || *SAID.lock().unwrap_or_else(|e| e.into_inner());+ if !ASKING.swap(true, Ordering::AcqRel) {+ let asked = std::thread::Builder::new()+ .name("mac-accent".into())+ .spawn(|| {+ let out = crate::launch::output_within(+ Command::new("defaults").args(["read", "-g", "AppleAccentColor"]),+ Duration::from_secs(2),+ );+ let color = out.map(|out| {+ let n = String::from_utf8_lossy(&out.stdout)+ .trim()+ .parse::<i32>()+ .ok();+ mac_accent_color(n)+ });+ *SAID.lock().unwrap_or_else(|e| e.into_inner()) = Some(color);+ ASKING.store(false, Ordering::Release);+ });+ if asked.is_err() {+ ASKING.store(false, Ordering::Release);+ }+ }+ let start = Instant::now();+ loop {+ if let Some(color) = said() {+ return color;+ }+ if start.elapsed() > Duration::from_millis(500) {+ return None;+ }+ std::thread::sleep(Duration::from_millis(10));+ }}/// AppleAccentColor's number (None: not set) as the colour it stands for.@@ -539,9 +579,27 @@ pub fn on_a_screen(_x: i32, _y: i32) -> bool {#[cfg(target_os = "linux")]pub fn file_icon(what: &crate::fileicons::What, px: u32) -> Option<crate::fileicons::Native> {use crate::fileicons::{Native, What};+ let (mime, icons) = icon_lookup();+ let names = match what {+ What::Folder => vec!["folder".to_string()],+ What::FolderOpen => vec!["folder-open".to_string(), "folder".to_string()],+ What::File(ext) => {+ let found = ext+ .as_ref()+ .and_then(|e| mime.mime_for(&format!("file.{e}")));+ mime.icon_names(found.unwrap_or("application/octet-stream"))+ }+ };+ icons.find(&names, px).map(Native::File)+}++/// The MIME database and the desktop's icon themes, read once: started at start-up by+/// [`prepare_file_icons`], off the window's thread (it asks `gsettings`, #222).+#[cfg(target_os = "linux")]+fn icon_lookup() -> &'static (crate::xdgicons::MimeDb, crate::xdgicons::Icons) {use crate::xdgicons::{Dirs, Icons, MimeDb};static LOOKUP: std::sync::OnceLock<(MimeDb, Icons)> = std::sync::OnceLock::new();- let (mime, icons) = LOOKUP.get_or_init(|| {+ LOOKUP.get_or_init(|| {let var = |n: &str| std::env::var(n).ok();let dirs = Dirs::new(var("HOME").as_deref(),@@ -554,18 +612,18 @@ pub fn file_icon(what: &crate::fileicons::What, px: u32) -> Option<crate::fileiclet default = if kde { "breeze" } else { "Adwaita" };let themes = [theme.as_deref().unwrap_or(default), "Adwaita", "breeze"];(MimeDb::load(&dirs.data), Icons::new(&dirs.icons, &themes))- });- let names = match what {- What::Folder => vec!["folder".to_string()],- What::FolderOpen => vec!["folder-open".to_string(), "folder".to_string()],- What::File(ext) => {- let found = ext- .as_ref()- .and_then(|e| mime.mime_for(&format!("file.{e}")));- mime.icon_names(found.unwrap_or("application/octet-stream"))- }- };- icons.find(&names, px).map(Native::File)+ })+}++/// Read the file icons' themes while the window opens ([`icon_lookup`]); the list's first+/// icons only wait for what is still being read.+#[cfg(target_os = "linux")]+pub fn prepare_file_icons() {+ let _ = std::thread::Builder::new()+ .name("file-icons".into())+ .spawn(|| {+ icon_lookup();+ });}/// The desktop's icon theme name: KDE's (`kdeglobals` [Icons] Theme) first on KDE, else GNOME's@@ -580,12 +638,10 @@ fn icon_theme(kde: bool) -> Option<String> {let read = |rel: &str| std::fs::read_to_string(config.join(rel)).ok();let kdeglobals = || ini_value(&read("kdeglobals")?, "Icons", "Theme");let gnome = || {- let out = Command::new("gsettings")- .args(["get", "org.gnome.desktop.interface", "icon-theme"])- .stdin(Stdio::null())- .stderr(Stdio::null())- .output()- .ok()?;+ let out = crate::launch::output_within(+ Command::new("gsettings").args(["get", "org.gnome.desktop.interface", "icon-theme"]),+ std::time::Duration::from_secs(2),+ )?;let name = String::from_utf8_lossy(&out.stdout).trim().trim_matches('\'')@@ -960,6 +1016,85 @@ mod tests {);assert_eq!(super::color_scheme(&Value::Str("dark".into())), None);}++ /// The child of [`show_in_folder_never_waits_for_the_file_manager`]: the file it shows.+ const SHOW_CHILD: &str = "MDM_TEST_SHOW_IN_FOLDER_CHILD";++ /// #222: a file manager that never answers ShowItems (here a `gdbus` that hangs for 30 s)+ /// leaves `show_in_folder` returning at once, and the folder is opened instead after+ /// SHOW_ITEMS_LIMIT (here an `xdg-open` that notes what it was given). PATH is the test's+ /// own, so the test runs itself again as a child with it (no `set_var` in a test).+ #[test]+ fn show_in_folder_never_waits_for_the_file_manager() {+ use std::os::unix::fs::PermissionsExt;+ use std::time::{Duration, Instant};+ if let Some(file) = std::env::var_os(SHOW_CHILD) {+ let file = std::path::PathBuf::from(file);+ let start = Instant::now();+ super::show_in_folder(&file);+ println!(+ "show_in_folder returned after {} ms",+ start.elapsed().as_millis()+ );+ // The fallback runs on its thread: wait for it before the child ends.+ let opened = file.with_file_name("opened.txt");+ let until = Instant::now() + Duration::from_secs(15);+ while !opened.exists() && Instant::now() < until {+ std::thread::sleep(Duration::from_millis(50));+ }+ return;+ }+ let root = std::env::temp_dir().join(format!("mdm-show-222-{}", std::process::id()));+ let _ = std::fs::remove_dir_all(&root);+ let (bin, folder) = (root.join("bin"), root.join("Downloads"));+ std::fs::create_dir_all(&bin).unwrap();+ std::fs::create_dir_all(&folder).unwrap();+ let file = folder.join("done.zip");+ std::fs::write(&file, b"test").unwrap();+ let opened = folder.join("opened.txt");+ let tool = |name: &str, body: String| {+ let p = bin.join(name);+ std::fs::write(&p, format!("#!/bin/sh\n{body}\n")).unwrap();+ std::fs::set_permissions(&p, std::fs::Permissions::from_mode(0o755)).unwrap();+ };+ tool("gdbus", "exec sleep 30".into());+ tool("xdg-open", format!("echo \"$1\" > '{}'", opened.display()));+ // Only these tools and the system's (no Windows programs under WSL, no real opener).+ let path = format!("{}:/usr/bin:/bin", bin.display());+ let start = Instant::now();+ let out = std::process::Command::new(std::env::current_exe().unwrap())+ .args([+ "unix::tests::show_in_folder_never_waits_for_the_file_manager",+ "--exact",+ "--nocapture",+ "--test-threads=1",+ ])+ .env(SHOW_CHILD, &file)+ .env("PATH", path)+ .output()+ .unwrap();+ let took = start.elapsed();+ let text = String::from_utf8_lossy(&out.stdout);+ // libtest prints the test's name on the same line, before it.+ let returned = text+ .split("show_in_folder returned after ")+ .nth(1)+ .and_then(|l| l.split(" ms").next()?.parse::<u64>().ok())+ .unwrap_or_else(|| panic!("the child said nothing: {text}"));+ assert!(+ returned < 500,+ "show_in_folder waited {returned} ms for gdbus"+ );+ let shown = std::fs::read_to_string(&opened).unwrap_or_default();+ assert_eq!(+ shown.trim(),+ folder.display().to_string(),+ "the folder wasn't opened"+ );+ // The folder opened after the limit, not after gdbus's 30 s.+ assert!(took < Duration::from_secs(20), "took {took:?}");+ let _ = std::fs::remove_dir_all(&root);+ }}// Sign-in secrets in the system's keychain (#44, secrets.rs). Linux: the Secret Servicediff --git a/crates/app/src/update.rs b/crates/app/src/update.rsindex f4920a66..2af59f02 100644--- a/crates/app/src/update.rs+++ b/crates/app/src/update.rs@@ -1,10 +1,12 @@//! Updating in place (Help → Check for updates → Update now): this copy's release file, fetched//! and checked in the background (`mdm_tools::update`: the release's signed checksum list), then-//! put where this copy is. MDM closes for it; the new copy starts with `/updated`, waits for the-//! old one to be gone, and removes what the update set aside.+//! put where this copy is, on a thread of its own too (unpacking, `tar`, `hdiutil`, `ditto`: the+//! window's thread waits for none of them, #222). MDM closes for it; the new copy starts with+//! `/updated`, waits for the old one to be gone, and removes what the update set aside.use std::path::{Path, PathBuf};use std::process::Command;+use std::sync::atomic::{AtomicBool, Ordering};use std::sync::{Arc, Mutex};use std::time::{Duration, Instant};@@ -14,10 +16,12 @@ use mdm_tools::update::{Install, Progress};pub const UPDATED: &str = "/updated";/// What follows once the file is in place.-#[derive(Clone, Copy, Debug, PartialEq, Eq)]+#[derive(Debug)]pub enum Next {- /// MDM closes; the new copy is starting (or the installer is running and starts it).- Restart,+ /// MDM closes once this has started: the new copy (or the installer, which starts it).+ /// Started by the window when it takes the result, so an update cancelled meanwhile starts+ /// nothing.+ Restart(Command),/// Handed to the system's package installer (a .deb or .rpm): MDM stays open.Opened,}@@ -35,11 +39,13 @@ fn folder() -> Option<PathBuf> {mdm_ipc::data_dir().map(|d| d.join("updates"))}-/// A release file on its way: its progress, then the checked file or why not. Dropped-/// (Cancel, the window closed), it stops.+/// A release file on its way: its progress, then the checked file put in place ([`apply`]), or+/// why not. Dropped (Cancel, the window closed), it stops.pub struct Job {pub progress: Arc<Progress>,- slot: Arc<Mutex<Option<Result<PathBuf, String>>>>,+ slot: Arc<Mutex<Option<Result<Next, String>>>>,+ /// The file is downloaded and being put in place (Cancel can't stop that).+ installing: Arc<AtomicBool>,task: tokio::task::JoinHandle<()>,}@@ -53,22 +59,40 @@ impl Job {pub fn start(rt: &tokio::runtime::Handle,ctx: &egui::Context,+ install: Install,assets: Vec<(String, String)>,name: String,) -> Job {let progress = Arc::new(Progress::default());let slot = Arc::new(Mutex::new(None));- let (p, out, ctx) = (progress.clone(), slot.clone(), ctx.clone());+ let installing = Arc::new(AtomicBool::new(false));+ let (p, out, busy, ctx) = (+ progress.clone(),+ slot.clone(),+ installing.clone(),+ ctx.clone(),+ );// Repaint while it runs, for the progress bar.let ticker = ctx.clone();let net = crate::settings::own_net();let task = rt.spawn(async move {- let res = match folder() {+ let fetched = match folder() {Some(dir) => mdm_tools::update::fetch(&assets, &name, &dir, &net, &p).await.map_err(|e| e.to_string()),None => Err("no data folder".into()),};+ let res = match fetched {+ Ok(file) => {+ busy.store(true, Ordering::Release);+ ctx.request_repaint();+ tokio::task::spawn_blocking(move || apply(install, &file))+ .await+ .map_err(|e| e.to_string())+ .and_then(|r| r)+ }+ Err(e) => Err(e),+ };*out.lock().unwrap() = Some(res);ctx.request_repaint();});@@ -76,18 +100,33 @@ impl Job {Job {progress,slot,+ installing,task,}}- /// The checked file, or why not, once the download ended.- pub fn result(&self) -> Option<Result<PathBuf, String>> {+ /// The update put in place (what follows), or why not, once it ended.+ pub fn result(&self) -> Option<Result<Next, String>> {self.slot.lock().unwrap().take()}++ /// The file is downloaded and being put in place.+ pub fn installing(&self) -> bool {+ self.installing.load(Ordering::Acquire)+ }}-/// Put `file` (checked) in place of this `install`.-pub fn apply(install: Install, file: &Path) -> Result<Next, String> {+/// Put `file` (checked) in place of this `install`. Long (unpacking, copying, programs waited+/// for): never on the window's thread ([`Job`] runs it).+fn apply(install: Install, file: &Path) -> Result<Next, String> {+ // Tests only (feature `test-update`): "Installing the update..." held this many seconds.+ #[cfg(feature = "test-update")]+ if let Some(secs) = std::env::var("MDM_TEST_UPDATE_HOLD")+ .ok()+ .and_then(|s| s.parse::<u64>().ok())+ {+ std::thread::sleep(Duration::from_secs(secs));+ }let exe = std::env::current_exe().map_err(|e| e.to_string())?;let dir = exe.parent().ok_or("no program folder")?.to_owned();let unpack_dir = || -> Result<PathBuf, String> {@@ -97,26 +136,22 @@ pub fn apply(install: Install, file: &Path) -> Result<Next, String> {Ok(d)};let restart = |program: &Path| -> Result<Next, String> {- Command::new(program)- .arg(UPDATED)- .spawn()- .map_err(|e| e.to_string())?;- Ok(Next::Restart)+ let mut cmd = Command::new(program);+ cmd.arg(UPDATED);+ Ok(Next::Restart(cmd))};match install {// The installer closes MDM itself (/exit), installs where it was (the same install// mode), and starts it again (/relaunch, tools/installer/mdm.iss).Install::Installer => {- Command::new(file)- .args([- "/VERYSILENT",- "/SUPPRESSMSGBOXES",- "/NORESTART",- "/relaunch=1",- ])- .spawn()- .map_err(|e| e.to_string())?;- Ok(Next::Restart)+ let mut cmd = Command::new(file);+ cmd.args([+ "/VERYSILENT",+ "/SUPPRESSMSGBOXES",+ "/NORESTART",+ "/relaunch=1",+ ]);+ Ok(Next::Restart(cmd))}Install::PortableZip | Install::PlainZip => {let out = unpack_dir()?;@@ -183,13 +218,9 @@ pub fn apply(install: Install, file: &Path) -> Result<Next, String> {let _ = std::fs::remove_dir_all(&old);std::fs::rename(&bundle, &old).map_err(|e| e.to_string())?;std::fs::rename(&staged, &bundle).map_err(|e| e.to_string())?;- Command::new("open")- .arg("-n")- .arg(&bundle)- .args(["--args", UPDATED])- .spawn()- .map_err(|e| e.to_string())?;- Ok(Next::Restart)+ let mut cmd = Command::new("open");+ cmd.arg("-n").arg(&bundle).args(["--args", UPDATED]);+ Ok(Next::Restart(cmd))}// Installing a package needs the administrator: the system's installer asks.Install::Deb | Install::Rpm => {diff --git a/crates/tools/Cargo.toml b/crates/tools/Cargo.tomlindex 3cf21e77..64038192 100644--- a/crates/tools/Cargo.toml+++ b/crates/tools/Cargo.toml@@ -29,6 +29,12 @@ zip = { version = "9.1.3", default-features = false, features = ["deflate"] }mdm-labserver.workspace = truetempfile.workspace = true+[features]+# Update now's end-to-end tests only, never in a release (tools/installer and release.yml don't+# turn it on): MDM_TEST_UPDATE_KEY names a test key a fake release's checksum list may be signed+# with instead of MDM's release key.+test-update = []+# A fake yt-dlp and the checks against it in one program (#68; see the file).[[test]]name = "fake_ytdlp"diff --git a/crates/tools/src/lib.rs b/crates/tools/src/lib.rsindex faa27f10..909b95ef 100644--- a/crates/tools/src/lib.rs+++ b/crates/tools/src/lib.rs@@ -88,7 +88,18 @@ pub fn signed_by_ytdlp(sums: &[u8], sig: &[u8]) -> bool {/// Whether `sums` (a release's SHA256SUMS.txt) carries a valid signature `sig` by Mister/// Download Manager's release key.pub fn signed_by_mdm(sums: &[u8], sig: &[u8]) -> bool {- signed_by(MDM_KEY, sums, sig)+ if signed_by(MDM_KEY, sums, sig) {+ return true;+ }+ // Update now's end-to-end tests (feature `test-update`, never in a release): a fake+ // release on a lab server, signed with a test key of their own.+ #[cfg(feature = "test-update")]+ if let Some(key) =+ std::env::var_os("MDM_TEST_UPDATE_KEY").and_then(|p| std::fs::read_to_string(p).ok())+ {+ return signed_by(&key, sums, sig);+ }+ false}/// Whether `data` carries a valid detached signature `sig` (binary OpenPGP) by the armoreddiff --git a/i18n/af.tsv b/i18n/af.tsvindex 5f7caada..e24c2663 100644--- a/i18n/af.tsv+++ b/i18n/af.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installeer yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Installeer opdatering...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/am.tsv b/i18n/am.tsvindex cb8d69ce..8ecc5429 100644--- a/i18n/am.tsv+++ b/i18n/am.tsv@@ -1928,6 +1928,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ጫን+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... ዝመና በመጫን ላይ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ar.tsv b/i18n/ar.tsvindex 6acd7f6e..68875c56 100644--- a/i18n/ar.tsv+++ b/i18n/ar.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp تثبيت yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... جار تثبيت التحديث...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/as.tsv b/i18n/as.tsvindex 09a63776..133e091a 100644--- a/i18n/as.tsv+++ b/i18n/as.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ইনষ্টল কৰক+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... আপডেট ইনষ্টল কৰা হৈছে...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/az.tsv b/i18n/az.tsvindex 4d1f454f..5d7b826e 100644--- a/i18n/az.tsv+++ b/i18n/az.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp quraşdırın+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Yeniləmə quraşdırılır...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/be.tsv b/i18n/be.tsvindex 05c49985..f2b26841 100644--- a/i18n/be.tsv+++ b/i18n/be.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Усталяваць yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Устаноўка абнаўлення...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/bg.tsv b/i18n/bg.tsvindex 8407ae94..110fda23 100644--- a/i18n/bg.tsv+++ b/i18n/bg.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Инсталиране на yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Инсталиране на актуализацията...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/bn.tsv b/i18n/bn.tsvindex 58abdd6c..050e0558 100644--- a/i18n/bn.tsv+++ b/i18n/bn.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ইনস্টল করুন+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... আপডেট ইনস্টল করা হচ্ছে...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/bs.tsv b/i18n/bs.tsvindex 42e21f9c..9a1b8d77 100644--- a/i18n/bs.tsv+++ b/i18n/bs.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instaliraj yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instaliranje ažuriranja...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ca-es-valencia.tsv b/i18n/ca-es-valencia.tsvindex 27afe5f2..d0fdabd3 100644--- a/i18n/ca-es-valencia.tsv+++ b/i18n/ca-es-valencia.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instal·la yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... S'està instal·lant l'actualització...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ca.tsv b/i18n/ca.tsvindex 233ca4da..2b3274d9 100644--- a/i18n/ca.tsv+++ b/i18n/ca.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instal·la yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... S'està instal·lant l'actualització...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/chr.tsv b/i18n/chr.tsvindex 08feadee..9587e256 100644--- a/i18n/chr.tsv+++ b/i18n/chr.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ᎦᏴᏍᏗ+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... ᎠᏍᏔᏱᏗᏍᎪᎢ ᎢᏤᎢᏍᏗ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/cs.tsv b/i18n/cs.tsvindex efdb6e8e..f76f9b80 100644--- a/i18n/cs.tsv+++ b/i18n/cs.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Nainstalovat yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instaluje se aktualizace...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/cy.tsv b/i18n/cy.tsvindex 09a7a8de..eb95ef1d 100644--- a/i18n/cy.tsv+++ b/i18n/cy.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Gosod yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Yn gosod y diweddariad...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/da.tsv b/i18n/da.tsvindex bf45b7ea..d162ef05 100644--- a/i18n/da.tsv+++ b/i18n/da.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installer yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Installerer opdateringen...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/de.tsv b/i18n/de.tsvindex f9825045..0a1932db 100644--- a/i18n/de.tsv+++ b/i18n/de.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp installieren+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Update wird installiert...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/el.tsv b/i18n/el.tsvindex 7c4a4aa0..c8749044 100644--- a/i18n/el.tsv+++ b/i18n/el.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Εγκατάσταση yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Εγκατάσταση της ενημέρωσης...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/en.tsv b/i18n/en.tsvindex 4a11cd6e..d87b05f2 100644--- a/i18n/en.tsv+++ b/i18n/en.tsv@@ -1425,6 +1425,10 @@#. text in the Download video window#. button: download and install the yt-dlp programInstall yt-dlp Install yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+ Installing the update... Installing the update...#. text in the Options window#. Options → Archives: where extracted files goInto a folder named after it, when it holds several things Into a folder named after it, when it holds several thingsdiff --git a/i18n/es-mx.tsv b/i18n/es-mx.tsvindex 40579938..59774141 100644--- a/i18n/es-mx.tsv+++ b/i18n/es-mx.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalar yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instalando la actualización...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/es.tsv b/i18n/es.tsvindex 35223964..9292f3ca 100644--- a/i18n/es.tsv+++ b/i18n/es.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalar yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instalando la actualización...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/et.tsv b/i18n/et.tsvindex 3b067484..92d564d5 100644--- a/i18n/et.tsv+++ b/i18n/et.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Install yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Värskenduse installimine...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/eu.tsv b/i18n/eu.tsvindex 5ab66ce2..9d4ec185 100644--- a/i18n/eu.tsv+++ b/i18n/eu.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalatu yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Eguneraketa instalatzen...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/fa.tsv b/i18n/fa.tsvindex 81c2b47c..4d290e38 100644--- a/i18n/fa.tsv+++ b/i18n/fa.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp نصب yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... در حال نصب بهروزرسانی...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/fi.tsv b/i18n/fi.tsvindex 177069f5..18f7fcb3 100644--- a/i18n/fi.tsv+++ b/i18n/fi.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Asenna yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Asennetaan päivitystä...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/fil.tsv b/i18n/fil.tsvindex c450c36a..290eeacc 100644--- a/i18n/fil.tsv+++ b/i18n/fil.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp I-install ang yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Ini-install ang update...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/fr-ca.tsv b/i18n/fr-ca.tsvindex a6a93cc0..fc7a0d07 100644--- a/i18n/fr-ca.tsv+++ b/i18n/fr-ca.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installer yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Installation de la mise à jour...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/fr.tsv b/i18n/fr.tsvindex a67bfd6f..e182cbae 100644--- a/i18n/fr.tsv+++ b/i18n/fr.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installer yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Installation de la mise à jour...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ga.tsv b/i18n/ga.tsvindex d6f8f000..9fe14d31 100644--- a/i18n/ga.tsv+++ b/i18n/ga.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Suiteáil yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Ag suiteáil an nuashonraithe...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/gd.tsv b/i18n/gd.tsvindex dcbb21db..cc2fd52b 100644--- a/i18n/gd.tsv+++ b/i18n/gd.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Stàlaich yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... A stàladh an ùrachaidh...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/gl.tsv b/i18n/gl.tsvindex 9d7dd3c2..3f23461a 100644--- a/i18n/gl.tsv+++ b/i18n/gl.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalar yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instalando a actualización...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/gu.tsv b/i18n/gu.tsvindex 2c4ac552..863769e4 100644--- a/i18n/gu.tsv+++ b/i18n/gu.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ઇન્સ્ટોલ કરો+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... અપડેટ ઇન્સ્ટોલ કરી રહ્યું છે...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/he.tsv b/i18n/he.tsvindex 79e50fa3..842105fa 100644--- a/i18n/he.tsv+++ b/i18n/he.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp התקן את yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... מתקין את העדכון...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/hi.tsv b/i18n/hi.tsvindex bab678c5..59bb5cf1 100644--- a/i18n/hi.tsv+++ b/i18n/hi.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp इंस्टॉल करें+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... अपडेट इंस्टॉल किया जा रहा है...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/hr.tsv b/i18n/hr.tsvindex 170bbc12..b7a45d38 100644--- a/i18n/hr.tsv+++ b/i18n/hr.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instaliraj yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instaliranje ažuriranja...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/hu.tsv b/i18n/hu.tsvindex 821cfe18..9332b1ad 100644--- a/i18n/hu.tsv+++ b/i18n/hu.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp telepítése+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Frissítés telepítése...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/hy.tsv b/i18n/hy.tsvindex 4090a426..02d0c5ce 100644--- a/i18n/hy.tsv+++ b/i18n/hy.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Տեղադրել yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Թարմացումը տեղադրվում է...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/id.tsv b/i18n/id.tsvindex d92913cc..e40bac32 100644--- a/i18n/id.tsv+++ b/i18n/id.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instal yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Menginstal pembaruan...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/is.tsv b/i18n/is.tsvindex ace3d09a..3a646762 100644--- a/i18n/is.tsv+++ b/i18n/is.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Setja upp yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Set upp uppfærslu...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ja.tsv b/i18n/ja.tsvindex 967b09e2..cc4f1f92 100644--- a/i18n/ja.tsv+++ b/i18n/ja.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp をインストール+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... 更新をインストールしています...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ka.tsv b/i18n/ka.tsvindex f3656765..080cc1e7 100644--- a/i18n/ka.tsv+++ b/i18n/ka.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp-ის ინსტალაცია+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... განახლების ინსტალაცია...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/kk.tsv b/i18n/kk.tsvindex a1c4b21a..d911d002 100644--- a/i18n/kk.tsv+++ b/i18n/kk.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp орнату+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Жаңарту орнатылуда...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/km.tsv b/i18n/km.tsvindex 0fa25c01..2f927da7 100644--- a/i18n/km.tsv+++ b/i18n/km.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp ដំឡើង yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... កំពុងដំឡើងបច្ចុប្បន្នភាព...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/kn.tsv b/i18n/kn.tsvindex c7663498..a2e10e49 100644--- a/i18n/kn.tsv+++ b/i18n/kn.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ಅನ್ನು ಸ್ಥಾಪಿಸಿ+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... ಅಪ್ಡೇಟ್ ಸ್ಥಾಪಿಸಲಾಗುತ್ತಿದೆ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ko.tsv b/i18n/ko.tsvindex 4c6fb705..13bac303 100644--- a/i18n/ko.tsv+++ b/i18n/ko.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp 설치+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... 업데이트 설치 중...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/kok.tsv b/i18n/kok.tsvindex 23acbc97..48406b64 100644--- a/i18n/kok.tsv+++ b/i18n/kok.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp स्थापीत कर+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... अद्ययावतीकरण स्थापीत करता...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/lb.tsv b/i18n/lb.tsvindex 379bc202..899297ed 100644--- a/i18n/lb.tsv+++ b/i18n/lb.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp installéieren+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Update gëtt installéiert...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/lo.tsv b/i18n/lo.tsvindex 973f06ed..2187bd2b 100644--- a/i18n/lo.tsv+++ b/i18n/lo.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp ຕິດຕັ້ງ yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... ກຳລັງຕິດຕັ້ງການອັບເດດ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/lt.tsv b/i18n/lt.tsvindex ba0a9db4..343a7721 100644--- a/i18n/lt.tsv+++ b/i18n/lt.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Įdiegti „yt-dlp“+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Diegiamas naujinimas...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/lv.tsv b/i18n/lv.tsvindex 4d380dbb..7fb110cc 100644--- a/i18n/lv.tsv+++ b/i18n/lv.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalēt yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Atjauninājuma instalēšana...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/mi.tsv b/i18n/mi.tsvindex b072ffb3..95b5373b 100644--- a/i18n/mi.tsv+++ b/i18n/mi.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Tāuta yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Tāuta ana i te whakahou...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/mk.tsv b/i18n/mk.tsvindex 75636435..17ea620f 100644--- a/i18n/mk.tsv+++ b/i18n/mk.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Инсталирај yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Инсталирање на ажурирањето...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ml.tsv b/i18n/ml.tsvindex 603b05a4..35ed7b2d 100644--- a/i18n/ml.tsv+++ b/i18n/ml.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ഇൻസ്റ്റാൾ ചെയ്യുക+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... അപ്ഡേറ്റ് ഇൻസ്റ്റാൾ ചെയ്യുന്നു...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/mr.tsv b/i18n/mr.tsvindex d5342519..95c1c856 100644--- a/i18n/mr.tsv+++ b/i18n/mr.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp स्थापित करा+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... अद्यतन स्थापित करत आहे...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ms.tsv b/i18n/ms.tsvindex ab833697..2e2f2429 100644--- a/i18n/ms.tsv+++ b/i18n/ms.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Pasang yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Memasang kemas kini...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/mt.tsv b/i18n/mt.tsvindex 3cd743b8..5571bff2 100644--- a/i18n/mt.tsv+++ b/i18n/mt.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installa yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Qed jiġi installat l-aġġornament...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/nb.tsv b/i18n/nb.tsvindex 22ec43cc..5bea7279 100644--- a/i18n/nb.tsv+++ b/i18n/nb.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installer yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Installerer oppdateringen ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ne.tsv b/i18n/ne.tsvindex a59932d6..2f1584f4 100644--- a/i18n/ne.tsv+++ b/i18n/ne.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp स्थापना गर्नुहोस्+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... अद्यावधिक स्थापना गर्दै...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/nl.tsv b/i18n/nl.tsvindex f6adab6e..d34b62a0 100644--- a/i18n/nl.tsv+++ b/i18n/nl.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp installeren+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Update installeren...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/nn.tsv b/i18n/nn.tsvindex 96a51904..4b2f6ee0 100644--- a/i18n/nn.tsv+++ b/i18n/nn.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installer yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Installerer oppdateringa ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/or.tsv b/i18n/or.tsvindex 717d96e6..f40f9d11 100644--- a/i18n/or.tsv+++ b/i18n/or.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ସ୍ଥାପନ କରନ୍ତୁ+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... ଅପଡେଟ୍ ସ୍ଥାପନ କରାଯାଉଛି...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/pa.tsv b/i18n/pa.tsvindex faeaa0eb..21d2c50a 100644--- a/i18n/pa.tsv+++ b/i18n/pa.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ਸਥਾਪਤ ਕਰੋ+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... ਅੱਪਡੇਟ ਸਥਾਪਤ ਕੀਤਾ ਜਾ ਰਿਹਾ ਹੈ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/pl.tsv b/i18n/pl.tsvindex c1150969..2212773d 100644--- a/i18n/pl.tsv+++ b/i18n/pl.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Zainstaluj yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instalowanie aktualizacji...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/pt-br.tsv b/i18n/pt-br.tsvindex 437d174d..23145343 100644--- a/i18n/pt-br.tsv+++ b/i18n/pt-br.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalar yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instalando a atualização...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/pt.tsv b/i18n/pt.tsvindex 3904c077..8ee02754 100644--- a/i18n/pt.tsv+++ b/i18n/pt.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalar o yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... A instalar a atualização...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/quz.tsv b/i18n/quz.tsvindex 872d0a56..59c4456c 100644--- a/i18n/quz.tsv+++ b/i18n/quz.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp churay+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Kunanchanata churachkanku...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ro.tsv b/i18n/ro.tsvindex bca54f3e..d5c49bca 100644--- a/i18n/ro.tsv+++ b/i18n/ro.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalați yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Se instalează actualizarea...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ru.tsv b/i18n/ru.tsvindex 3853191d..b7cfc895 100644--- a/i18n/ru.tsv+++ b/i18n/ru.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Установить yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Установка обновления...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/sk.tsv b/i18n/sk.tsvindex 98b3ca53..e2f22e5d 100644--- a/i18n/sk.tsv+++ b/i18n/sk.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Nainštalovať yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Inštaluje sa aktualizácia...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/sl.tsv b/i18n/sl.tsvindex 00da0212..4c1a7aa5 100644--- a/i18n/sl.tsv+++ b/i18n/sl.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Namesti yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Nameščanje posodobitve ...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/sq.tsv b/i18n/sq.tsvindex ed3676ba..e733fe1e 100644--- a/i18n/sq.tsv+++ b/i18n/sq.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instalo yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instalimi i përditësimit...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/sr-latn.tsv b/i18n/sr-latn.tsvindex 00972267..0678ef52 100644--- a/i18n/sr-latn.tsv+++ b/i18n/sr-latn.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Instaliraj yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Instaliranje ispravke...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/sr.tsv b/i18n/sr.tsvindex 2dcb8e0f..224c62bd 100644--- a/i18n/sr.tsv+++ b/i18n/sr.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Инсталирај yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Инсталирање ажурирања...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/sv.tsv b/i18n/sv.tsvindex e65cf244..e4761e69 100644--- a/i18n/sv.tsv+++ b/i18n/sv.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Installera yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Installerar uppdateringen...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ta.tsv b/i18n/ta.tsvindex 9588491e..f72d981a 100644--- a/i18n/ta.tsv+++ b/i18n/ta.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp ஐ நிறுவவும்+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... புதுப்பிப்பை நிறுவுகிறது...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/te.tsv b/i18n/te.tsvindex 6e54a001..3e9c595d 100644--- a/i18n/te.tsv+++ b/i18n/te.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlpను ఇన్స్టాల్ చేయండి+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... అప్డేట్ను ఇన్స్టాల్ చేస్తోంది...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/th.tsv b/i18n/th.tsvindex bd92adf9..1a37643b 100644--- a/i18n/th.tsv+++ b/i18n/th.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp ติดตั้ง yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... กำลังติดตั้งการอัปเดต...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/tr.tsv b/i18n/tr.tsvindex 021d1999..8dbee10a 100644--- a/i18n/tr.tsv+++ b/i18n/tr.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp'yi yükle+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Güncelleme yükleniyor...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/tt.tsv b/i18n/tt.tsvindex 7b4884d7..6b18329e 100644--- a/i18n/tt.tsv+++ b/i18n/tt.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp урнаштыру+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Яңарту урнаштырыла...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ug.tsv b/i18n/ug.tsvindex bbffc79c..38f716cc 100644--- a/i18n/ug.tsv+++ b/i18n/ug.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp نى قاچىلاڭ+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... يېڭىلاشنى قاچىلاش...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/uk.tsv b/i18n/uk.tsvindex 501f36f0..d126eb12 100644--- a/i18n/uk.tsv+++ b/i18n/uk.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Інсталювати yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Інсталяція оновлення...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/ur.tsv b/i18n/ur.tsvindex 403819d0..622e4408 100644--- a/i18n/ur.tsv+++ b/i18n/ur.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp انسٹال کریں+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... اپ ڈیٹ انسٹال ہو رہا ہے...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/uz.tsv b/i18n/uz.tsvindex 7ff087d0..abc49e7b 100644--- a/i18n/uz.tsv+++ b/i18n/uz.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp yt-dlp’ni oʻrnatish+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Yangilanish oʻrnatilmoqda...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/vi.tsv b/i18n/vi.tsvindex 5f1d1f92..eb111ab3 100644--- a/i18n/vi.tsv+++ b/i18n/vi.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp Cài đặt yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... Đang cài đặt bản cập nhật...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/zh-hans.tsv b/i18n/zh-hans.tsvindex 0ecb5256..6a2df593 100644--- a/i18n/zh-hans.tsv+++ b/i18n/zh-hans.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp 安装 yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... 正在安装更新...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/i18n/zh-hant.tsv b/i18n/zh-hant.tsvindex 9e4aec0c..a7c8f199 100644--- a/i18n/zh-hant.tsv+++ b/i18n/zh-hant.tsv@@ -1924,6 +1924,11 @@#. button: download and install the yt-dlp program#, machineInstall yt-dlp 安裝 yt-dlp+#. text in the Help menu's windows (About, updates, shortcuts, Tell a friend)+#. Check for updates, after Update now downloaded it: unpacking and putting the new version in place+#. the trailing ... means it is still going on: keep it+#, machine+ Installing the update... 正在安裝更新...#. text in the Options window#. Options → Archives: where extracted files go#, machinediff --git a/tools/lab/update/README.md b/tools/lab/update/README.mdnew file mode 100644index 00000000..8f674d52--- /dev/null+++ b/tools/lab/update/README.md@@ -0,0 +1,84 @@+# Update now, end to end++Checks **Help → Check for updates → Update now** the way a user's update goes. The scripts:++1. find a newer release;+2. download it and check its signed checksum list;+3. show **Installing the update...**;+4. put it in place;+5. start the new copy (`/updated`) while the old one closes.++They also check that MDM refuses a release whose checksum is wrong or whose list is signed by another key, and that closing the window half-way starts nothing.++Nothing here touches the installed MDM or the real releases:++- **The test copies.** Each run starts a copy of the given build in a folder of its own, off-screen (`MDM_OFFSCREEN=1`).+- **The releases.** They are fake 9.9.9 ones made by `mkrel.py`, served by the lab server on 127.0.0.1 (`--files`). Their `latest.json` is the release feed (`MDM_UPDATE_FEED`).+- **The keys.** The checksum lists are signed with two throwaway Ed25519 keys made for each run in its work folder: "test" and "other". MDM's release key is never read or needed.++## The build++These checks need the **`test-update`** cargo feature. It is off by default, and no release build turns it on. It adds:++- `MDM_TEST_UPDATE_KEY`: a public key the release's checksum list may be signed with, besides MDM's own.+- `/show update-now`: Update now pressed, with no clicks, in the window `/show updates` opens (that one every build has).+- `MDM_TEST_UPDATE_HOLD=N`: holds "Installing the update..." for N seconds.++The build must be release mode. A debug build is "built from source", and those never update.++```powershell+# Windows+cargo build --release -p mdm-app --features test-update -p mdm-labserver+```+```bash+# Linux (mdm-lab: the vmtest profile)+cargo build --profile vmtest -p mdm-app --features test-update -p mdm-labserver+```++## Windows: the portable zip++```powershell+tools\lab\update\upd-win.ps1 -Exe target\release\misterdownloadmanager.exe -Server target\release\labserver.exe+tools\lab\update\upd-win.ps1 ... -Only good,bad-hash # some scenarios+tools\lab\update\upd-win.ps1 ... -Shots -ShotDir <folder> # plus screenshots, below+```++Needs Python 3 and gpg (Git for Windows has one). The work folder is `target\update-e2e`, emptied first: the copies, releases, keys and `log.txt` are there.++Each copy is portable (`data\` beside its program), so `Install::PortableZip`. The windows open off the screens and nothing is clicked: closing a window is its title bar's `WM_CLOSE`.++`-Shots` also captures Download complete and the "Installing the update..." state in English, German and Arabic, light and dark, with PrintWindow (`tools\lab\cap-own.ps1`).++## Linux: the .tar.gz and the AppImage++```bash+tools/lab/update/upd-lin.sh ~/src/mdm/target/vmtest # every scenario+tools/lab/update/upd-lin.sh ~/src/mdm/target/vmtest targz-good # one+```++Needs Xvfb, dbus-daemon, Metacity (wmctrl needs a window manager), wmctrl, Python 3 and gpg. mdm-lab has them all.++The script runs on a virtual screen of its own (`:96`), never the desktop's or WSLg's. Its work folder is `$MDM_UPDATE_E2E_WORK`, else `/tmp/mdm-update-e2e`.++- A copy run from its folder is `Install::TarGz`.+- With `APPIMAGE` pointing at the copy, it is `Install::AppImage`. The fake AppImage is the same program with a marker appended, so it can be told apart once replaced.++macOS (the .dmg: `hdiutil`, `ditto`) has no runner yet: build and clippy only.++## Scenarios and what each must show++Each runner prints `PASS` or `FAIL` per scenario and exits with 1 when any fails.++| Windows | Linux | Must show |+|---|---|---|+| `good` | `targz-good`, `appimage-good` | downloaded, checked, put in place; the new copy started with `/updated`; the old one ended |+| `bad-hash` | `targz-bad-hash` | refused ("the downloaded program doesn't match its signed checksum"); nothing replaced, nothing started |+| `other-key` | `appimage-other-key` | refused ("the release's checksum list is not signed by its publisher's key"); nothing replaced or started |+| `close-download` | `targz-close-download` | the update window closed while it downloads (the asset served at 1 MB/s by `slowserve.py`); nothing replaced or started |+| `close-install` | `appimage-close-install` | the window closed during "Installing the update..." (held 8 s): the files are put in place, since that can't stop half-way, but nothing is started; the running copy stays and the next start is the new version |++## The files++- `mkrel.py`: makes a fake release (the asset, `SHA256SUMS.txt` and its signature, `latest.json`). On its first use in a work folder it also makes the throwaway keys there.+- `slowserve.py`: serves a folder slowly (the cancel-while-downloading scenario).+- `upd-win.ps1`, `upd-lin.sh`: the runners.diff --git a/tools/lab/update/mkrel.py b/tools/lab/update/mkrel.pynew file mode 100644index 00000000..ffb11096--- /dev/null+++ b/tools/lab/update/mkrel.py@@ -0,0 +1,161 @@+#!/usr/bin/env python3+"""A fake MDM release for Update now's end-to-end tests (never a real one): the asset, its+SHA256SUMS.txt signed with a throwaway key, and GitHub's latest-release JSON for MDM_UPDATE_FEED.++ mkrel.py --keys DIR --out DIR --base URL --asset NAME --kind zip|targz|file --program FILE+ [--version 9.9.9] [--sums good|bad] [--signer test|other] [--asset-base URL] [--pad MB]++--keys: a folder of this run's own. Its first use makes two throwaway Ed25519 keys there, "test"+(its public half in test-key.asc, for MDM_TEST_UPDATE_KEY) and "other" (a stranger's: a release+it signs must be refused). Never MDM's release key: that one isn't read or needed.++zip / targz: a folder named after the asset holding the program and a NEW-COPY.txt marker (the+portable zip, the .tar.gz). file: the program itself with a marker appended (an AppImage's place).+--sums bad lists a wrong checksum; --asset-base serves the asset elsewhere (a slow server);+--pad adds that many MB of random bytes to the archive (a long download).++gpg is needed: Linux's, or Git for Windows' (usr/bin/gpg.exe).+"""+import argparse+import hashlib+import io+import json+import os+import shutil+import subprocess+import tarfile+import zipfile+++def find_gpg():+ gpg = shutil.which("gpg")+ if not gpg and os.name == "nt":+ for base in (os.environ.get("ProgramFiles", r"C:\Program Files"), r"C:\Program Files (x86)"):+ cand = os.path.join(base, "Git", "usr", "bin", "gpg.exe")+ if os.path.exists(cand):+ gpg = cand+ break+ if not gpg:+ raise SystemExit("gpg not found (Linux: apt install gnupg; Windows: Git for Windows has one)")+ return gpg+++GPG = find_gpg()+# Git for Windows' gpg is an MSYS program: its home folder is given as /c/... (a C:\... one is+# read as relative). Files on its command line may stay C:/...+MSYS = os.name == "nt" and "usr" in GPG.lower().replace("\\", "/").split("/")+++def home_arg(path):+ path = os.path.abspath(path)+ if MSYS and len(path) > 1 and path[1] == ":":+ return "/" + path[0].lower() + path[2:].replace("\\", "/")+ return path+++def gpg(home, *args, check=True):+ env = {**os.environ, "GNUPGHOME": home_arg(home)}+ return subprocess.run([GPG, "--batch", "--yes", *args], env=env, check=check,+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)+++def kill_agent(home):+ gpgconf = os.path.join(os.path.dirname(GPG), "gpgconf" + (".exe" if os.name == "nt" else ""))+ if os.path.exists(gpgconf):+ subprocess.run([gpgconf, "--kill", "gpg-agent"], env={**os.environ, "GNUPGHOME": home_arg(home)},+ stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)+++def ensure_keys(keys):+ for who in ("test", "other"):+ home = os.path.join(keys, who)+ if os.path.exists(os.path.join(home, "made")):+ continue+ shutil.rmtree(home, ignore_errors=True)+ os.makedirs(home)+ if os.name != "nt":+ os.chmod(home, 0o700)+ gpg(home, "--pinentry-mode", "loopback", "--passphrase", "", "--quick-gen-key",+ f"MDM update test key, {who} (throwaway, not a release key) <{who}@invalid>",+ "ed25519", "sign", "never")+ if who == "test":+ out = gpg(home, "--armor", "--export").stdout+ open(os.path.join(keys, "test-key.asc"), "wb").write(out)+ open(os.path.join(home, "made"), "w").write("ok\n")+ kill_agent(home)+++def main():+ ap = argparse.ArgumentParser()+ ap.add_argument("--keys", required=True)+ ap.add_argument("--out", required=True)+ ap.add_argument("--base", required=True)+ ap.add_argument("--version", default="9.9.9")+ ap.add_argument("--asset", required=True)+ ap.add_argument("--kind", choices=["zip", "targz", "file"], required=True)+ ap.add_argument("--program", required=True)+ ap.add_argument("--program-name", default=None)+ ap.add_argument("--sums", choices=["good", "bad"], default="good")+ ap.add_argument("--signer", choices=["test", "other"], default="test")+ ap.add_argument("--asset-base", default=None)+ ap.add_argument("--pad", type=int, default=0)+ a = ap.parse_args()++ ensure_keys(a.keys)+ os.makedirs(a.out, exist_ok=True)+ marker = f"NEW-COPY {a.version}\n".encode()+ prog = open(a.program, "rb").read()+ name = a.program_name or os.path.basename(a.program)+ folder = a.asset+ for ext in (".tar.gz", ".zip"):+ if folder.endswith(ext):+ folder = folder[: -len(ext)]+ asset_path = os.path.join(a.out, a.asset)+ pad = os.urandom(a.pad * 1024 * 1024) if a.pad else b""+ if a.kind == "zip":+ with zipfile.ZipFile(asset_path, "w", zipfile.ZIP_DEFLATED) as z:+ z.writestr(f"{folder}/{name}", prog)+ z.writestr(f"{folder}/NEW-COPY.txt", marker)+ if pad:+ z.writestr(f"{folder}/padding.bin", pad, compress_type=zipfile.ZIP_STORED)+ elif a.kind == "targz":+ files = [(name, prog, 0o755), ("NEW-COPY.txt", marker, 0o644)]+ if pad:+ files.append(("padding.bin", pad, 0o644))+ with tarfile.open(asset_path, "w:gz") as t:+ for n, data, mode in files:+ info = tarfile.TarInfo(f"{folder}/{n}")+ info.size, info.mode = len(data), mode+ t.addfile(info, io.BytesIO(data))+ else:+ open(asset_path, "wb").write(prog + b"\n" + marker)+ if os.name != "nt":+ os.chmod(asset_path, 0o755)++ digest = hashlib.sha256(open(asset_path, "rb").read()).hexdigest()+ if a.sums == "bad":+ digest = "0" * 64+ sums = os.path.join(a.out, "SHA256SUMS.txt")+ with open(sums, "w", newline="\n") as f:+ f.write(f"{digest} {a.asset}\n")+ home = os.path.join(a.keys, a.signer)+ gpg(home, "--digest-algo", "SHA256", "--detach-sign", "-o", sums + ".sig", sums)+ kill_agent(home)+ base = a.base.rstrip("/")+ asset_base = (a.asset_base or base).rstrip("/")+ json.dump({+ "tag_name": f"v{a.version}",+ "published_at": "2026-01-01T00:00:00Z",+ "html_url": f"{base}/release.html",+ "body": "## A test release\n\n- Made by Update now's end-to-end tests. Not a real release.",+ "assets": [+ {"name": a.asset, "browser_download_url": f"{asset_base}/{a.asset}"},+ {"name": "SHA256SUMS.txt", "browser_download_url": f"{base}/SHA256SUMS.txt"},+ {"name": "SHA256SUMS.txt.sig", "browser_download_url": f"{base}/SHA256SUMS.txt.sig"},+ ],+ }, open(os.path.join(a.out, "latest.json"), "w"), indent=1)+ print(f"{a.asset}: sha256 {digest[:16]}... ({a.sums}), signed by the {a.signer} key")+++if __name__ == "__main__":+ main()diff --git a/tools/lab/update/slowserve.py b/tools/lab/update/slowserve.pynew file mode 100644index 00000000..a1932aac--- /dev/null+++ b/tools/lab/update/slowserve.py@@ -0,0 +1,29 @@+#!/usr/bin/env python3+"""Serve a folder on 127.0.0.1:PORT at RATE bytes per second: a release whose download takes long+enough to be cancelled half-way (Update now's end-to-end tests).++ slowserve.py DIR PORT RATE+"""+import functools+import http.server+import sys+import time++root, port, rate = sys.argv[1], int(sys.argv[2]), int(sys.argv[3])+++class Slow(http.server.SimpleHTTPRequestHandler):+ def copyfile(self, src, dst):+ while True:+ chunk = src.read(max(rate // 10, 1))+ if not chunk:+ return+ dst.write(chunk)+ time.sleep(0.1)++ def log_message(self, *a):+ sys.stderr.write("slowserve: " + (a[0] % a[1:]) + "\n")+++http.server.ThreadingHTTPServer(("127.0.0.1", port),+ functools.partial(Slow, directory=root)).serve_forever()diff --git a/tools/lab/update/upd-lin.sh b/tools/lab/update/upd-lin.shnew file mode 100644index 00000000..426d4aaa--- /dev/null+++ b/tools/lab/update/upd-lin.sh@@ -0,0 +1,147 @@+#!/usr/bin/env bash+# Update now, end to end, on Linux: the .tar.gz and AppImage paths (README.md). Off-screen test+# copies in folders of their own, on a virtual screen of this script's own (Xvfb :96, a session+# bus, Metacity), fake 9.9.9 releases signed with a throwaway key made for this run (mkrel.py),+# served by the lab server on 127.0.0.1. Needs a release-mode build with the `test-update`+# feature (vmtest or release profile: debug builds are "built from source" and never update).+#+# tools/lab/update/upd-lin.sh <folder with misterdownloadmanager and labserver> [scenario ...]+# e.g. upd-lin.sh ~/src/mdm/target/vmtest (every scenario)+#+# Scenarios and what each must show (the run fails otherwise, exit status 1):+# targz-good, appimage-good put in place, the new copy started with /updated, the old ended+# targz-bad-hash refused: nothing replaced, nothing started+# appimage-other-key the checksum list signed by another key: refused+# targz-close-download the window closed while it downloads (1 MB/s): nothing replaced or started+# appimage-close-install the window closed during "Installing the update...": replaced, nothing started+#+# Work folder: $MDM_UPDATE_E2E_WORK, else /tmp/mdm-update-e2e (emptied first).+set -uo pipefail+bin=$(cd "${1:?usage: upd-lin.sh <build folder> [scenario ...]}" && pwd); shift+here=$(cd "$(dirname "$0")" && pwd)+all="targz-good appimage-good targz-bad-hash appimage-other-key targz-close-download appimage-close-install"+want=${*:-$all}+work=${MDM_UPDATE_E2E_WORK:-/tmp/mdm-update-e2e}+rm -rf "$work"; mkdir -p "$work"+for t in Xvfb dbus-daemon metacity wmctrl python3 gpg; do+ command -v $t >/dev/null || { echo "needs $t"; exit 2; }+done++# Our own screen, never the desktop's (nor WSLg's on WSL).+unset WAYLAND_DISPLAY WAYLAND_SOCKET PULSE_SERVER+export DISPLAY=:96 XDG_SESSION_TYPE=x11 LIBGL_ALWAYS_SOFTWARE=1+export XDG_RUNTIME_DIR=$work/xdg-run+mkdir -p "$XDG_RUNTIME_DIR"; chmod 700 "$XDG_RUNTIME_DIR"+export DBUS_SESSION_BUS_ADDRESS=unix:path=$XDG_RUNTIME_DIR/bus+now() { cut -d' ' -f1 /proc/uptime; }+T0=$(now)+log() { echo "[$(awk -v a="$T0" -v b="$(now)" 'BEGIN {printf "%6.1f", b - a}')s] $*" | tee -a "$work/log.txt"; }+xvfb=""; dbus=""; wm=""+cleanup() {+ local rc=$?+ pkill -f "$work/run-" 2>/dev/null+ [ -n "$wm" ] && kill "$wm" 2>/dev/null+ [ -n "$dbus" ] && kill "$dbus" 2>/dev/null+ [ -n "$xvfb" ] && kill "$xvfb" 2>/dev/null+ exit $rc+}+trap cleanup EXIT+Xvfb :96 -screen 0 1280x800x24 -nolisten tcp -dpi 96 >"$work/xvfb.log" 2>&1 </dev/null & xvfb=$!+for _ in $(seq 50); do xdpyinfo >/dev/null 2>&1 && break; sleep 0.1; done+dbus=$(dbus-daemon --session --address="$DBUS_SESSION_BUS_ADDRESS" --fork --print-pid)+metacity --replace --no-composite >"$work/metacity.log" 2>&1 </dev/null & wm=$!+sleep 1++port=8299; slowport=8296; base=http://127.0.0.1:$port/files+keys=$work/keys+release() { # release <name> <kind targz|file> <asset> [mkrel args]+ local name=$1 kind=$2 asset=$3; shift 3+ python3 "$here/mkrel.py" --keys "$keys" --out "$work/rel-$name" --base "$base" --asset "$asset" \+ --kind "$kind" --program "$bin/misterdownloadmanager" --program-name misterdownloadmanager "$@" |+ sed 's/^/ /' | tee -a "$work/log.txt"+}+TGZ=MisterDownloadManager-9.9.9-linux-x86_64-experimental.tar.gz+APP=MisterDownloadManager-9.9.9-linux-x86_64-experimental.AppImage+log "making the fake releases (throwaway keys in $keys)"+release targz-good targz $TGZ+release targz-bad-hash targz $TGZ --sums bad+release targz-slow targz $TGZ --pad 30 --asset-base "http://127.0.0.1:$slowport"+release appimage-good file $APP+release appimage-other-key file $APP --signer other++mine() { wmctrl -lp 2>/dev/null | awk -v p="$1" '$3 == p {print $1}'; }+run() { # run <name> <targz|appimage> <release> <hold> <close: -|download|install>; sets STARTED ENDED REPLACED+ local name=$1 kind=$2 rel=$3 hold=$4 close=$5+ local w=$work/run-$1 prog srv slow="" pid upd before new+ mkdir -p "$w/copy" "$w/data" "$w/Downloads"+ if [ "$kind" = appimage ]; then prog=$w/copy/MisterDownloadManager.AppImage; else prog=$w/copy/misterdownloadmanager; fi+ cp "$bin/misterdownloadmanager" "$prog"+ local start_hash; start_hash=$(sha256sum "$prog" | cut -c1-16)+ python3 - "$w/data/downloads.json" "$w/Downloads" <<'PY'+import json, sys+path, dl = sys.argv[1:3]+s = dict(language="en", language_asked=True, helpers_asked=True, extension_never_ask=True,+ update_check=False, torrent_incoming=False, torrent_upnp=False, torrent_dht=False,+ torrent_lsd=False, category_dirs=[["General", dl]])+json.dump({"next_id": 1, "items": [], "version": 2, "settings": s}, open(path, "w"))+PY+ "$bin/labserver" --bind "127.0.0.1:$port" --files "$work/rel-$rel" >"$w/labserver.log" 2>&1 & srv=$!+ [ "$close" = download ] && { python3 "$here/slowserve.py" "$work/rel-$rel" $slowport 1000000 2>"$w/slow.log" & slow=$!; }+ (+ export MDM_DATA_DIR=$w/data MDM_OFFSCREEN=1 MDM_UPDATE_FEED=$base/latest.json MDM_TEST_UPDATE_KEY=$keys/test-key.asc+ [ "$hold" != 0 ] && export MDM_TEST_UPDATE_HOLD=$hold+ if [ "$kind" = appimage ]; then export APPIMAGE=$prog; else unset APPIMAGE; fi+ cd "$w" && setsid -f "$prog" >"$w/stdout.log" 2>&1 </dev/null+ )+ pid=""+ for _ in $(seq 300); do pid=$(pgrep -f "^$prog$" | head -1); [ -n "$pid" ] && [ -n "$(mine "$pid")" ] && break; sleep 0.1; done+ STARTED=no; ENDED=no; REPLACED=no+ if [ -z "$pid" ]; then log " MDM showed no window (see $w/stdout.log)"; kill $srv $slow 2>/dev/null; return; fi+ sleep 2+ before=$(mine "$pid")+ ( export MDM_DATA_DIR=$w/data; [ "$kind" = appimage ] && export APPIMAGE=$prog; "$prog" /show updates >/dev/null 2>&1 )+ upd=""+ for _ in $(seq 100); do upd=$(mine "$pid" | grep -vxF -f <(echo "$before") | head -1); [ -n "$upd" ] && break; sleep 0.1; done+ sleep 2+ ( export MDM_DATA_DIR=$w/data; [ "$kind" = appimage ] && export APPIMAGE=$prog; "$prog" /show update-now >/dev/null 2>&1 )+ log " Update now pressed (window $upd)"+ [ "$close" = download ] && { sleep 1.5; wmctrl -i -c "$upd"; log " the update window closed while it downloads"; }+ [ "$close" = install ] && { sleep 3; wmctrl -i -c "$upd"; log " the update window closed during 'Installing the update...'"; }+ local deadline=$(( $(cut -d. -f1 /proc/uptime) + hold + 30 ))+ while [ "$(cut -d. -f1 /proc/uptime)" -lt "$deadline" ]; do+ [ $ENDED = no ] && ! kill -0 "$pid" 2>/dev/null && { ENDED=yes; log " the old copy ended"; }+ if [ $STARTED = no ]; then+ new=$(pgrep -af "/updated" | grep -F "$w/copy/" | head -1)+ [ -n "$new" ] && { STARTED=yes; log " a new copy started: $new"; }+ fi+ [ $ENDED = yes ] && [ $STARTED = yes ] && break+ sleep 0.25+ done+ # Replaced: the tar.gz's marker file, or the AppImage changed (the release's has one appended).+ if [ -f "$w/copy/NEW-COPY.txt" ] || [ "$(sha256sum "$prog" | cut -c1-16)" != "$start_hash" ]; then REPLACED=yes; fi+ log " folder: $(ls "$w/copy" | tr '\n' ' ')"+ pkill -f "$w/copy/" 2>/dev/null+ kill $srv $slow 2>/dev/null+ sleep 1+}++failed=()+check() { # check <name> <started> <ended> <replaced>+ local line="started=$STARTED old-ended=$ENDED replaced=$REPLACED"+ if [ "$STARTED $ENDED $REPLACED" = "$2 $3 $4" ]; then log "PASS $1: $line"+ else log "FAIL $1: $line (expected started=$2 old-ended=$3 replaced=$4)"; failed+=("$1"); fi+}+for s in $want; do+ log "=== $s"+ case $s in+ targz-good) run $s targz targz-good 4 -; check $s yes yes yes ;;+ appimage-good) run $s appimage appimage-good 4 -; check $s yes yes yes ;;+ targz-bad-hash) run $s targz targz-bad-hash 0 -; check $s no no no ;;+ appimage-other-key) run $s appimage appimage-other-key 0 -; check $s no no no ;;+ targz-close-download) run $s targz targz-slow 0 download; check $s no no no ;;+ appimage-close-install) run $s appimage appimage-good 8 install; check $s no no yes ;;+ *) log "unknown scenario $s"; failed+=("$s") ;;+ esac+done+[ ${#failed[@]} -gt 0 ] && { log "failed: ${failed[*]}"; exit 1; }+log "all passed"diff --git a/tools/lab/update/upd-win.ps1 b/tools/lab/update/upd-win.ps1new file mode 100644index 00000000..407361b4--- /dev/null+++ b/tools/lab/update/upd-win.ps1@@ -0,0 +1,215 @@+# Update now, end to end, on Windows: the portable zip path (README.md). Off-screen test copies in+# folders of their own (never the installed MDM), fake 9.9.9 releases signed with a throwaway key+# made for this run (mkrel.py), served by the lab server on 127.0.0.1. Needs a release-mode build+# with the `test-update` feature (Install::detect says "built from source" in debug builds).+#+# tools\lab\update\upd-win.ps1 -Exe target\release\misterdownloadmanager.exe -Server target\release\labserver.exe+# ... -Only good,bad-hash some scenarios+# ... -Shots -ShotDir <folder> also Download complete and "Installing the update..." in+# en, de, ar, light and dark (the scenarios still run first)+#+# Scenarios and what each must show (the run fails otherwise, exit code 1):+# good downloaded, checked, put in place, the new copy started with /updated, the old ended+# bad-hash refused: nothing replaced, nothing started+# other-key the checksum list signed by another key: refused, nothing replaced or started+# close-download the window closed while it downloads (1 MB/s): nothing replaced or started+# close-install the window closed during "Installing the update...": replaced, nothing started+param(+ [Parameter(Mandatory)][string]$Exe,+ [Parameter(Mandatory)][string]$Server,+ [string]$Work = "",+ [string[]]$Only = @(),+ [switch]$Shots,+ [string]$ShotDir = "",+ [int]$Port = 8298,+ [int]$SlowPort = 8297+)+$ErrorActionPreference = "Stop"+$root = Split-Path -Parent (Split-Path -Parent (Split-Path -Parent $PSScriptRoot))+$Exe = (Resolve-Path $Exe).Path+$Server = (Resolve-Path $Server).Path+if (-not $Work) { $Work = Join-Path $root "target\update-e2e" }+if (Test-Path $Work) { Remove-Item -Recurse -Force $Work }+New-Item -ItemType Directory -Force $Work | Out-Null+if ($Shots -and -not $ShotDir) { $ShotDir = Join-Path $Work "shots" }+if ($ShotDir) { New-Item -ItemType Directory -Force $ShotDir | Out-Null }+Add-Type @"+using System; using System.Text; using System.Collections.Generic; using System.Runtime.InteropServices;+public static class UW {+ public delegate bool P(IntPtr h, IntPtr l);+ [DllImport("user32.dll")] public static extern bool EnumWindows(P f, IntPtr l);+ [DllImport("user32.dll", CharSet=CharSet.Unicode)] public static extern int GetWindowText(IntPtr h, StringBuilder s, int n);+ [DllImport("user32.dll")] public static extern bool IsWindowVisible(IntPtr h);+ [DllImport("user32.dll")] public static extern uint GetWindowThreadProcessId(IntPtr h, out uint p);+ [DllImport("user32.dll")] public static extern bool PostMessage(IntPtr h, uint m, IntPtr w, IntPtr l);+ public static List<KeyValuePair<IntPtr,string>> Of(uint pid) {+ var r = new List<KeyValuePair<IntPtr,string>>();+ EnumWindows((h, l) => {+ uint p; GetWindowThreadProcessId(h, out p);+ if (p == pid && IsWindowVisible(h)) {+ var sb = new StringBuilder(512); GetWindowText(h, sb, 512);+ r.Add(new KeyValuePair<IntPtr,string>(h, sb.ToString()));+ }+ return true;+ }, IntPtr.Zero);+ return r;+ }+}+"@+$t0 = Get-Date+# To the console and log.txt, never to the pipeline (a function's output is its result).+function Log([string]$m) {+ $l = "[{0,6:N1}s] {1}" -f ((Get-Date) - $t0).TotalSeconds, $m+ Write-Host $l+ Add-Content -Encoding utf8 -Path "$Work\log.txt" -Value $l+}+$WM_CLOSE = 0x10++# --- The releases: one folder each, signed with this run's throwaway keys.+$keys = "$Work\keys"+$base = "http://127.0.0.1:$Port/files"+$asset = "MisterDownloadManager-9.9.9-portable.zip"+function Release([string]$name, [string[]]$more) {+ $out = "$Work\rel-$name"+ & python "$PSScriptRoot\mkrel.py" --keys $keys --out $out --base $base --asset $asset --kind zip `+ --program $Exe --program-name misterdownloadmanager.exe @more | ForEach-Object { Log " $_" }+ if ($LASTEXITCODE) { throw "mkrel.py failed" }+ $out+}+Log "making the fake releases (throwaway keys in $keys)"+$rel = @{+ "good" = Release "good" @()+ "bad-hash" = Release "bad-hash" @("--sums", "bad")+ "other-key" = Release "other-key" @("--signer", "other")+ "slow" = Release "slow" @("--pad", "30", "--asset-base", "http://127.0.0.1:$SlowPort")+}+$key = "$keys\test-key.asc"++# --- One run: a copy in its own folder (portable: data\ beside it), its update window, Update now.+function Run([string]$name, [string]$relDir, [int]$hold = 0, [string]$close = "", [string]$lang = "en",+ [bool]$dark = $false, [bool]$shots = $false) {+ $w = "$Work\$name"; $copy = "$w\copy"+ New-Item -ItemType Directory -Force "$copy\data", "$w\Downloads" | Out-Null+ Copy-Item $Exe "$copy\misterdownloadmanager.exe"+ # The settings every run starts from (docs-shots.ps1's), written by Python: exact JSON, no BOM.+ @'+import json, sys+path, lang, dark, dl = sys.argv[1:5]+dark = dark == "1"+cats = ["General", "Compressed", "Documents", "Music", "Programs", "Video", "Torrents"]+s = dict(language=lang, language_asked=True, helpers_asked=True, extension_never_ask=True,+ update_check=False, torrent_incoming=False, torrent_upnp=False, torrent_dht=False,+ torrent_lsd=False, dark_mode_support=dark, always_dark=dark,+ category_dirs=[[c, dl] for c in cats])+json.dump({"next_id": 1, "items": [], "version": 2, "settings": s}, open(path, "w"))+'@ | python - "$copy\data\downloads.json" $lang $(if ($dark) { "1" } else { "0" }) "$w\Downloads"+ $srv = Start-Process -PassThru -WindowStyle Hidden $Server -ArgumentList "--bind", "127.0.0.1:$Port", "--files", $relDir+ $slow = $null+ if ($close -eq "download") {+ $slow = Start-Process -PassThru -WindowStyle Hidden python -ArgumentList "`"$PSScriptRoot\slowserve.py`"", "`"$relDir`"", "$SlowPort", "1000000"+ }+ $env:MDM_OFFSCREEN = "1"+ $env:MDM_UPDATE_FEED = "$base/latest.json"+ $env:MDM_TEST_UPDATE_KEY = $key+ if ($hold) { $env:MDM_TEST_UPDATE_HOLD = "$hold" } else { Remove-Item Env:MDM_TEST_UPDATE_HOLD -ErrorAction SilentlyContinue }+ $r = @{ started = $false; oldEnded = $false; marker = $false }+ try {+ $app = Start-Process -PassThru "$copy\misterdownloadmanager.exe"+ $main = $null+ for ($i = 0; $i -lt 200 -and -not $main; $i++) { Start-Sleep -Milliseconds 100; $main = [UW]::Of([uint32]$app.Id) | Select-Object -First 1 }+ if (-not $main) { throw "$name`: MDM showed no window" }+ Start-Sleep 2+ $suffix = "$lang-" + $(if ($dark) { "dark" } else { "light" })+ if ($shots) {+ $before = [UW]::Of([uint32]$app.Id) | ForEach-Object { $_.Key }+ & "$copy\misterdownloadmanager.exe" /d "http://127.0.0.1:$Port/gen/2M/holiday-photos.zip" /p "$w\Downloads" /n | Out-Null+ Start-Sleep 4+ $dc = [UW]::Of([uint32]$app.Id) | Where-Object { $before -notcontains $_.Key } | Select-Object -Last 1+ & "$root\tools\lab\cap-own.ps1" -ProcessId $app.Id -Title $dc.Value -Out "$ShotDir\download-complete-$suffix.png" | Out-Null+ Log " shot download-complete-$suffix.png ($($dc.Value))"+ [UW]::PostMessage($dc.Key, $WM_CLOSE, [IntPtr]::Zero, [IntPtr]::Zero) | Out-Null+ Start-Sleep 1+ }+ $before = [UW]::Of([uint32]$app.Id) | ForEach-Object { $_.Key }+ & "$copy\misterdownloadmanager.exe" /show updates | Out-Null+ $upd = $null+ for ($i = 0; $i -lt 150 -and -not $upd; $i++) { Start-Sleep -Milliseconds 100; $upd = [UW]::Of([uint32]$app.Id) | Where-Object { $before -notcontains $_.Key } | Select-Object -First 1 }+ if (-not $upd) { throw "$name`: no update window" }+ Start-Sleep 2+ & "$copy\misterdownloadmanager.exe" /show update-now | Out-Null+ Log " Update now pressed ($($upd.Value))"+ if ($close -eq "download") {+ Start-Sleep -Milliseconds 1500+ [UW]::PostMessage($upd.Key, $WM_CLOSE, [IntPtr]::Zero, [IntPtr]::Zero) | Out-Null+ Log " the update window closed while it downloads"+ }+ if ($shots) {+ # Downloaded and checked well within this; the hold keeps "Installing the update...".+ Start-Sleep 12+ & "$root\tools\lab\cap-own.ps1" -ProcessId $app.Id -Title $upd.Value -Out "$ShotDir\update-installing-$suffix.png" | Out-Null+ Log " shot update-installing-$suffix.png"+ return $r+ }+ if ($close -eq "install") {+ Start-Sleep 3+ [UW]::PostMessage($upd.Key, $WM_CLOSE, [IntPtr]::Zero, [IntPtr]::Zero) | Out-Null+ Log " the update window closed during 'Installing the update...'"+ }+ $deadline = (Get-Date).AddSeconds([Math]::Max(30, $hold + 25))+ while ((Get-Date) -lt $deadline) {+ if (-not $r.oldEnded -and $app.HasExited) { $r.oldEnded = $true; Log " the old copy ended" }+ if (-not $r.started) {+ $new = Get-CimInstance Win32_Process -Filter "Name='misterdownloadmanager.exe'" | Where-Object { $_.CommandLine -like "*$copy*" -and $_.CommandLine -like "*/updated*" }+ if ($new) { $r.started = $true; Log " a new copy started: $($new.CommandLine)" }+ }+ if ($r.oldEnded -and $r.started) { break }+ Start-Sleep -Milliseconds 250+ }+ if (-not $r.started) {+ $still = [UW]::Of([uint32]$app.Id) | Where-Object { $_.Key -eq $upd.Key }+ if ($still) { & "$root\tools\lab\cap-own.ps1" -ProcessId $app.Id -Title $upd.Value -Out "$w\update-window.png" | Out-Null }+ }+ $r.marker = Test-Path "$copy\NEW-COPY.txt"+ Log " folder: $((Get-ChildItem $copy -Name) -join ', ')"+ return $r+ } finally {+ Get-CimInstance Win32_Process -Filter "Name='misterdownloadmanager.exe'" | Where-Object { $_.CommandLine -like "*$copy*" } |+ ForEach-Object { Stop-Process -Id $_.ProcessId -Force -ErrorAction SilentlyContinue }+ if ($app -and -not $app.HasExited) { Stop-Process -Id $app.Id -Force -ErrorAction SilentlyContinue }+ Stop-Process -Id $srv.Id -Force -ErrorAction SilentlyContinue+ if ($slow) { Stop-Process -Id $slow.Id -Force -ErrorAction SilentlyContinue }+ Remove-Item Env:MDM_OFFSCREEN, Env:MDM_UPDATE_FEED, Env:MDM_TEST_UPDATE_KEY, Env:MDM_TEST_UPDATE_HOLD -ErrorAction SilentlyContinue+ Start-Sleep 1+ }+}++# --- The scenarios: (release, hold, close, expected started / old ended / replaced).+$scenarios = [ordered]@{+ "good" = @{ rel = "good"; hold = 4; close = ""; want = @{ started = $true; oldEnded = $true; marker = $true } }+ "bad-hash" = @{ rel = "bad-hash"; hold = 0; close = ""; want = @{ started = $false; oldEnded = $false; marker = $false } }+ "other-key" = @{ rel = "other-key"; hold = 0; close = ""; want = @{ started = $false; oldEnded = $false; marker = $false } }+ "close-download" = @{ rel = "slow"; hold = 0; close = "download"; want = @{ started = $false; oldEnded = $false; marker = $false } }+ "close-install" = @{ rel = "good"; hold = 8; close = "install"; want = @{ started = $false; oldEnded = $false; marker = $true } }+}+$failed = @()+foreach ($name in $scenarios.Keys) {+ if ($Only.Count -and $Only -notcontains $name) { continue }+ $s = $scenarios[$name]+ Log "=== $name"+ $got = Run $name $rel[$s.rel] $s.hold $s.close+ $bad = @($s.want.Keys | Where-Object { $got[$_] -ne $s.want[$_] })+ $line = "started=$($got.started) old-ended=$($got.oldEnded) replaced=$($got.marker)"+ if ($bad.Count) { $failed += $name; Log "FAIL $name`: $line (expected $(($bad | ForEach-Object { "$_=$($s.want[$_])" }) -join ' '))" }+ else { Log "PASS $name`: $line" }+}+if ($Shots) {+ foreach ($lang in "en", "de", "ar") {+ foreach ($dark in $false, $true) {+ Log "=== shots $lang $(if ($dark) { 'dark' } else { 'light' })"+ Run "shots-$lang-$dark" $rel["good"] 300 "" $lang $dark $true | Out-Null+ }+ }+ Log "shots in $ShotDir"+}+if ($failed.Count) { Log "failed: $($failed -join ', ')"; exit 1 }+Log "all passed"