Skip to content

misterdownloadmanager: The ultimate open-source, clean-room download manager written from scratch in pure Rust for Windows, Mac, and Linux

Helium: MDM offers it the extension on Linux and macOS, by Helium's own name for the store (#685) (#725)

Ahmed Nefzaoui460ab099c093
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 095efa8b..60308b42 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -7,6 +7,7 @@ Each release's notes on GitHub come from its section here (`## [X.Y.Z]`, see
### Added
+- Helium: on Linux and macOS, MDM offers the extension to Helium, through Helium's own services: with them allowed, it arrives at Helium's next start (on macOS Helium asks first). It names the store as Helium does: Helium asks Google's update service without its version, and Google answers it "no update", which is why the offer MDM writes for Chrome on Windows, which Helium reads there too, never brought it the extension. On Windows MDM's window still opens the store's page in Helium. On Linux the .deb's and .rpm's helper files for everyone cover Helium too, so MDM writes none in its folder in your home. [Browser integration](docs/browser-integration.md#helium) says how to add the extension in Helium, and what to turn on when Helium says **Extension downloads are disabled** ([#685](https://github.com/anefzaoui/misterdownloadmanager/issues/685)).
- Links you add by hand go with the User-Agent of your default browser, at the version you have installed (Chrome, Edge, Brave, Opera, Vivaldi, Firefox or Safari, on Windows, Linux and macOS), instead of the Internet Explorer 11 one MDM sent until now, which some sites no longer let through. MDM looks the browser up once as it starts. **Options → Downloads** shows it with **Automatic** ticked; untick it to type your own, and a User-Agent you had set stays yours. When MDM doesn't recognise your default browser, it sends a current Chrome's; when a site turns a browser's User-Agent away, it asks once more with its former one, as for downloads from the browser (part of [#668](https://github.com/anefzaoui/misterdownloadmanager/issues/668)).
- Linux and macOS: a gallery-dl installed by the system (a package manager, Homebrew, pip) is found and used when MDM has none of its own, as yt-dlp is; **Helpers** can switch to MDM's own copy where MDM has one (Windows and Linux x86-64) ([#571](https://github.com/anefzaoui/misterdownloadmanager/issues/571)).
- Videos a site sends in pieces (HLS and DASH streams, as many sites other than YouTube do) download several pieces at once, as many as **Options → Connection** gives a file (8 by default): against a test server that slows each connection, 4 at once took under a third of the time, 8 under a fifth. With a speed limit on, they still come one at a time, so the limit holds; a video in one file, as most of YouTube's are, is unchanged. The command line's `video-get` and `playlist-get` take `-c` for it ([#531](https://github.com/anefzaoui/misterdownloadmanager/issues/531)).
diff --git a/README.md b/README.md
index dc9a460c..e0ec36f8 100644
--- a/README.md
+++ b/README.md
@@ -21,7 +21,7 @@
<sub>The Chrome Web Store's is for
<img src="docs/images/browsers/edge.png" width="16" height="16" alt=""> Edge,
<img src="docs/images/browsers/brave.png" width="16" height="16" alt=""> Brave,
- <img src="docs/images/browsers/opera.png" width="16" height="16" alt=""> Opera and Vivaldi too (<a href="docs/browser-integration.md">how</a>).</sub>
+ <img src="docs/images/browsers/opera.png" width="16" height="16" alt=""> Opera, Vivaldi and Helium too (<a href="docs/browser-integration.md">how</a>).</sub>
</p>
<p align="center">
@@ -277,9 +277,9 @@ right-to-left window.
- **Speeds up every download** by fetching parts of the file at the same time, and keeps
re-balancing until the last byte.
- **Resumes** after a crash, a restart or a dropped connection, without starting over.
-- **Catches downloads from Firefox, Chrome, Edge, Brave, Opera and Vivaldi** (the extension is
- on Firefox Add-ons and the Chrome Web Store), and gives them back to the browser when MDM isn't
- running.
+- **Catches downloads from Firefox, Chrome, Edge, Brave, Opera, Vivaldi and Helium** (the
+ extension is on Firefox Add-ons and the Chrome Web Store), and gives them back to the browser
+ when MDM isn't running.
- **Downloads videos** from web pages (a button appears over the video; playlists, subtitles,
the sound alone), **image galleries** with gallery-dl, and **torrents and magnet links**
(sequential order, RSS feeds, sharing limits).
diff --git a/ROADMAP.md b/ROADMAP.md
index 8cb9e85c..52fa308f 100644
--- a/ROADMAP.md
+++ b/ROADMAP.md
@@ -539,6 +539,9 @@ These ship in a later version, when they're ready.
### Being built
+- 🔄 Helium: MDM offers it the extension on Linux and macOS, through Helium's own services, the
+ Linux packages' helper files cover it, and the docs say how to add the extension in Helium
+ ([#685](https://github.com/anefzaoui/misterdownloadmanager/issues/685)); in review
- 🔄 A freeze of the window while torrents ran on a busy or slow disk: it waited for the torrent
engine, which holds a torrent while its writes to the disk end
([#693](https://github.com/anefzaoui/misterdownloadmanager/issues/693)): the torrents' numbers
diff --git a/crates/ipc/src/browsers.rs b/crates/ipc/src/browsers.rs
index 144c7696..73a84398 100644
--- a/crates/ipc/src/browsers.rs
+++ b/crates/ipc/src/browsers.rs
@@ -17,9 +17,9 @@
//! (learn.microsoft.com/microsoft-edge/extensions/developer-guide/native-messaging, Linux);
//! Brave's from `brave_main_delegate.cc` (Linux: Chrome's, `/etc/opt/chrome`); Vivaldi, built
//! without Chrome's branding, reads Chromium's (as Vivaldi's forum confirms); Firefox's from
-//! MDN's "Native manifests" (Linux, global: `/usr/lib/mozilla` or `/usr/lib64/mozilla`). Opera,
-//! Helium, Thorium and Firefox's forks document none: they keep their manifest in the home
-//! folder.
+//! MDN's "Native manifests" (Linux, global: `/usr/lib/mozilla` or `/usr/lib64/mozilla`); Helium
+//! reads Chromium's, then Chrome's (its patch, above). Opera, Thorium and Firefox's forks
+//! document none: they keep their manifest in the home folder.
use std::path::{Path, PathBuf};
@@ -54,6 +54,13 @@ pub struct Browser {
/// macOS: the folder under ~/Library/Application Support whose `NativeMessagingHosts` a
/// Chromium browser reads when it isn't its own data folder (Brave reads Chrome's).
pub mac_hosts: Option<&'static str>,
+ /// It offers the extensions named in its data folders' `External Extensions` (Chromium's
+ /// DIR_USER_EXTERNAL_EXTENSIONS, read for one user) at its next start: on Linux (Chromium's
+ /// branding only, not Chrome's) and on macOS ([`external_dirs`]).
+ pub linux_user_external: bool,
+ pub mac_user_external: bool,
+ /// The store's update service as it names it there.
+ pub store_update_url: &'static str,
}
const fn chromium(
@@ -73,6 +80,9 @@ const fn chromium(
linux_home: &[],
linux_system: &[],
mac_hosts: None,
+ linux_user_external: false,
+ mac_user_external: false,
+ store_update_url: crate::extension::STORE_UPDATE_URL,
}
}
@@ -88,6 +98,19 @@ impl Browser {
self.linux_system = folders;
self
}
+
+ /// It reads `External Extensions` in its data folders, for one user, on Linux and macOS.
+ const fn user_external(mut self, linux: bool, mac: bool) -> Browser {
+ self.linux_user_external = linux;
+ self.mac_user_external = mac;
+ self
+ }
+
+ /// It names the store's update service `url` (Helium).
+ const fn store_update_url(mut self, url: &'static str) -> Browser {
+ self.store_update_url = url;
+ self
+ }
}
/// Linux: Chrome's folder for everyone (Google's builds of Chrome, every channel; Brave).
@@ -131,6 +154,9 @@ const fn gecko(
linux_home,
linux_system: &[],
mac_hosts: None,
+ linux_user_external: false,
+ mac_user_external: false,
+ store_update_url: crate::extension::STORE_UPDATE_URL,
}
}
@@ -165,7 +191,8 @@ pub const BROWSERS: &[Browser] = &[
"google-chrome-canary",
],
)
- .linux_system_in(&[ETC_CHROME]),
+ .linux_system_in(&[ETC_CHROME])
+ .user_external(false, true),
chromium(
"Chromium",
&["Chromium.app"],
@@ -261,14 +288,23 @@ pub const BROWSERS: &[Browser] = &[
&["opera"],
),
// Helium reads its own folder, then Chrome's (on Linux and macOS); `.dev` is an unofficial
- // build's.
+ // build's. On Linux, built with Chromium's branding, it then reads Chromium's folder for
+ // everyone, then Chrome's (its scan-chrome-native-messaging-hosts.patch; both paths are in
+ // its program, #685), so the .deb's and .rpm's manifest covers it. On Windows it reads
+ // Chromium's key, then Chrome's (launch_context_win.cc), as Chromium does. It offers the
+ // extensions named in its own folder's `External Extensions` on Linux and macOS, through its
+ // services when they name the store by its own address; Chrome's entries (the registry's on
+ // Windows) name Google's, which answers it "no update", so it offers nothing from them (#685).
chromium(
"Helium",
&["Helium.app"],
&["helium", "helium-browser"],
&["net.imput.helium"],
&["net.imput.helium", "net.imput.helium.dev"],
- ),
+ )
+ .linux_system_in(&[ETC_CHROMIUM, ETC_CHROME])
+ .user_external(true, true)
+ .store_update_url(crate::extension::HELIUM_STORE_UPDATE_URL),
// Thorium's and Arc's folders: unverified.
chromium(
"Thorium",
@@ -508,6 +544,76 @@ fn host_dirs_in(
dirs
}
+/// A browser's folder of external extensions in its data folder (Chromium's
+/// DIR_USER_EXTERNAL_EXTENSIONS).
+const USER_EXTERNAL: &str = "External Extensions";
+
+/// Linux and macOS: the folders whose `<id>.json`, naming the store's update service as the
+/// browser reading it names it (the second of each pair), makes it offer that extension at its
+/// next start ("New extension added", the user turning it on there), for this user (`home`,
+/// `config` = $XDG_CONFIG_HOME) or for everyone, each given only where its browser is.
+///
+/// For one user, each browser marked so reads `External Extensions` in its data folder: Chrome on
+/// macOS, Helium on both, by its own name for the store (#685); Chrome on Linux reads none in the
+/// home folder. For everyone, Chrome's: on macOS `/Library/Application Support/Google/Chrome/
+/// External Extensions` (chrome_paths.cc, DIR_EXTERNAL_EXTENSIONS), on Linux
+/// `/usr/share/google-chrome/extensions`. Helium reads macOS's too, and an entry there, read
+/// before its own, would win with Google's address: none is written there for it. Windows offers
+/// the extension through the registry (crates/nmhost).
+pub fn external_dirs(
+ home: &Path,
+ config: &Path,
+ mac: bool,
+ all_users: bool,
+) -> Vec<(PathBuf, &'static str)> {
+ external_dirs_in(Path::new("/"), home, config, mac, all_users)
+}
+
+/// `external_dirs`, with everyone's folders under `root` (`/`; a test's own folder).
+fn external_dirs_in(
+ root: &Path,
+ home: &Path,
+ config: &Path,
+ mac: bool,
+ all_users: bool,
+) -> Vec<(PathBuf, &'static str)> {
+ let system = |d: &str| root.join(d.trim_start_matches('/'));
+ if all_users {
+ // Chrome's folder for everyone, where Chrome is.
+ let (dir, chrome) = if mac {
+ (
+ "/Library/Application Support/Google/Chrome/External Extensions",
+ "/Applications/Google Chrome.app",
+ )
+ } else {
+ ("/usr/share/google-chrome/extensions", "/opt/google/chrome")
+ };
+ return if system(chrome).exists() {
+ vec![(system(dir), crate::extension::STORE_UPDATE_URL)]
+ } else {
+ Vec::new()
+ };
+ }
+ let support = home.join("Library/Application Support");
+ let mut dirs: Vec<(PathBuf, &'static str)> = Vec::new();
+ for b in BROWSERS {
+ let data: Vec<PathBuf> = match mac {
+ true if b.mac_user_external => b.mac_data.iter().map(|d| support.join(d)).collect(),
+ false if b.linux_user_external => {
+ b.linux_config.iter().map(|d| config.join(d)).collect()
+ }
+ _ => continue,
+ };
+ for d in data.into_iter().filter(|d| d.is_dir()) {
+ let d = d.join(USER_EXTERNAL);
+ if !dirs.iter().any(|(x, _)| *x == d) {
+ dirs.push((d, b.store_update_url));
+ }
+ }
+ }
+ dirs
+}
+
/// Whether the host manifest at `manifest` starts `program` (the same file), and it runs.
pub fn names_program(manifest: &Path, program: &Path) -> bool {
let Some(named) = manifest_program(manifest) else {
@@ -875,6 +981,111 @@ mod tests {
assert_eq!(dirs(Some(&helper)), all(&[chrome, brave, opera, mozilla]));
}
+ /// #685: Helium alone, on Linux, reads the package's manifest for everyone in Chromium's
+ /// folder (or Chrome's): no file of MDM's left in its own folder in the home.
+ #[cfg(unix)]
+ #[test]
+ fn a_manifest_for_everyone_covers_helium() {
+ use std::os::unix::fs::PermissionsExt;
+ let t = tempfile::tempdir().unwrap();
+ let (root, home) = (t.path().join("root"), t.path().join("home"));
+ std::fs::create_dir_all(home.join(".config/net.imput.helium")).unwrap();
+ let helper = root.join("usr/bin/misterdownloadmanager-nmhost");
+ std::fs::create_dir_all(helper.parent().unwrap()).unwrap();
+ std::fs::write(&helper, "#!/bin/sh\n").unwrap();
+ std::fs::set_permissions(&helper, std::fs::Permissions::from_mode(0o755)).unwrap();
+ let dirs = || -> Vec<PathBuf> {
+ host_dirs_in(
+ &root,
+ &home,
+ &home.join(".config"),
+ false,
+ false,
+ Some(&helper),
+ )
+ .into_iter()
+ .map(|(d, _)| d.strip_prefix(&home).unwrap().to_owned())
+ .collect()
+ };
+ let own = PathBuf::from(".config/net.imput.helium/NativeMessagingHosts");
+ assert_eq!(dirs(), std::slice::from_ref(&own));
+ for etc in [ETC_CHROMIUM, ETC_CHROME] {
+ let dir = root.join(etc.trim_start_matches('/'));
+ std::fs::create_dir_all(&dir).unwrap();
+ let json = serde_json::json!({ "name": "x", "path": helper, "type": "stdio" });
+ std::fs::write(dir.join(HOST_MANIFEST), json.to_string()).unwrap();
+ assert!(dirs().is_empty(), "{etc}");
+ std::fs::remove_file(dir.join(HOST_MANIFEST)).unwrap();
+ assert_eq!(dirs(), std::slice::from_ref(&own));
+ }
+ }
+
+ /// #685: the external extension folders, each with the store's address as its browser names
+ /// it. One user: Chrome's only on macOS, Helium's own data folders (each channel's) on Linux
+ /// and macOS, only those there, by Helium's own name for the store. Everyone: Chrome's, for
+ /// Chrome only (Helium would read macOS's before its own).
+ #[test]
+ fn external_extension_folders() {
+ use crate::extension::{HELIUM_STORE_UPDATE_URL as HELIUM, STORE_UPDATE_URL as GOOGLE};
+ let t = tempfile::tempdir().unwrap();
+ let (root, home) = (t.path().join("root"), t.path().join("home"));
+ let config = home.join(".config");
+ let user = |mac| external_dirs_in(&root, &home, &config, mac, false);
+ let everyone = |mac| external_dirs_in(&root, &home, &config, mac, true);
+ assert!(user(false).is_empty() && user(true).is_empty());
+ assert!(everyone(false).is_empty() && everyone(true).is_empty());
+
+ // Linux: Chrome reads none in the home folder; Helium its own.
+ std::fs::create_dir_all(config.join("google-chrome")).unwrap();
+ assert!(user(false).is_empty());
+ std::fs::create_dir_all(config.join("net.imput.helium.dev")).unwrap();
+ std::fs::create_dir_all(config.join("net.imput.helium")).unwrap();
+ assert_eq!(
+ user(false),
+ [
+ (config.join("net.imput.helium/External Extensions"), HELIUM),
+ (
+ config.join("net.imput.helium.dev/External Extensions"),
+ HELIUM
+ ),
+ ]
+ );
+
+ // macOS: Chrome's and Helium's, each by its own name for the store.
+ let support = home.join("Library/Application Support");
+ std::fs::create_dir_all(support.join("net.imput.helium")).unwrap();
+ assert_eq!(
+ user(true),
+ [(support.join("net.imput.helium/External Extensions"), HELIUM)]
+ );
+ std::fs::create_dir_all(support.join("Google/Chrome")).unwrap();
+ assert_eq!(
+ user(true),
+ [
+ (support.join("Google/Chrome/External Extensions"), GOOGLE),
+ (support.join("net.imput.helium/External Extensions"), HELIUM),
+ ]
+ );
+
+ // Everyone's: Chrome's, only where Chrome is; never for Helium alone.
+ std::fs::create_dir_all(root.join("Applications/Helium.app")).unwrap();
+ std::fs::create_dir_all(root.join("opt/helium")).unwrap();
+ assert!(everyone(true).is_empty() && everyone(false).is_empty());
+ std::fs::create_dir_all(root.join("Applications/Google Chrome.app")).unwrap();
+ std::fs::create_dir_all(root.join("opt/google/chrome")).unwrap();
+ assert_eq!(
+ everyone(true),
+ [(
+ root.join("Library/Application Support/Google/Chrome/External Extensions"),
+ GOOGLE
+ )]
+ );
+ assert_eq!(
+ everyone(false),
+ [(root.join("usr/share/google-chrome/extensions"), GOOGLE)]
+ );
+ }
+
/// The folders for everyone each browser reads are in the list the packages ship.
#[test]
fn every_browsers_system_folder_is_shipped() {
diff --git a/crates/ipc/src/extension.rs b/crates/ipc/src/extension.rs
index 713eb2eb..074316ee 100644
--- a/crates/ipc/src/extension.rs
+++ b/crates/ipc/src/extension.rs
@@ -20,6 +20,10 @@ pub const FIREFOX_ID: &str = "[email protected]";
/// extension at its next start (developer.chrome.com, "Alternative extension distribution
/// options").
pub const STORE_UPDATE_URL: &str = "https://clients2.google.com/service/update2/crx";
+/// Helium's name for the Chrome Web Store's update service (its proxy-extension-downloads.patch,
+/// `kChromeWebstoreUpdateURL`): an entry naming it goes through Helium's own services, while
+/// Google's address, asked directly without the browser's version, answers "no update" (#685).
+pub const HELIUM_STORE_UPDATE_URL: &str = "https://update-url-to-be-replaced.qjz9zk";
/// A Chromium extension ID: 32 letters from a to p.
pub fn valid_id(id: &str) -> bool {
diff --git a/crates/nmhost/src/main.rs b/crates/nmhost/src/main.rs
index 1a93021c..15c859de 100644
--- a/crates/nmhost/src/main.rs
+++ b/crates/nmhost/src/main.rs
@@ -36,7 +36,7 @@ use serde::{Deserialize, Serialize};
mod win32;
const HOST_NAME: &str = "com.misterdownloadmanager.host";
-use mdm_ipc::extension::{FIREFOX_ID, STORE_ID, STORE_UPDATE_URL, chromium_ids, store_id};
+use mdm_ipc::extension::{FIREFOX_ID, STORE_ID, chromium_ids, store_id};
/// Where each Chromium browser looks for native messaging hosts on Windows, under HKCU (one
/// user) or HKLM (everyone). Chromium-branded builds (Chromium, Helium, Thorium, and Brave and
/// Brave Origin with every channel) read Chromium's first, then Chrome's, as most other forks do
@@ -53,7 +53,9 @@ const REGISTRY_KEYS: [&str; 4] = [
const FIREFOX_KEY: &str = r"Software\Mozilla\NativeMessagingHosts";
/// Chrome's external extensions: an entry naming the store's extension makes Chrome offer it at
/// its next start ("New extension added"), the user turning it on there. HKLM's is read from the
-/// 32-bit view on 64-bit Windows, hence /reg:32 (HKCU has one view).
+/// 32-bit view on 64-bit Windows, hence /reg:32 (HKCU has one view). Helium reads it too, but
+/// asks Google's address without the browser's version, and Google answers "no update": nothing
+/// is offered there (#685), the app's window opens the store's page in Helium instead.
#[cfg(windows)]
const CHROME_EXTERNAL_KEY: &str = r"Software\Google\Chrome\Extensions";
@@ -824,7 +826,7 @@ fn register(all_users: bool) -> Result<(), String> {
"/t",
"REG_SZ",
"/d",
- STORE_UPDATE_URL,
+ mdm_ipc::extension::STORE_UPDATE_URL,
"/f",
"/reg:32",
])?;
@@ -886,32 +888,20 @@ fn host_dirs(all_users: bool, host: Option<&std::path::Path>) -> Vec<(PathBuf, b
.collect()
}
-/// Linux and macOS: the folder Chrome reads external extensions from (an `<id>.json` naming
-/// the store's update service makes Chrome offer that extension at its next start), when
-/// Chrome is there. macOS has one per user and one for everyone; Linux Chrome reads only the
-/// system's, so a per-user registration there leaves it to the app's own offer (extension.rs).
+/// Linux and macOS: the folders the browsers there read external extensions from (an
+/// `<id>.json` naming the store's update service makes the browser offer that extension at its
+/// next start), for those that are there, each with the service's address as that browser names
+/// it (`mdm_ipc::browsers::external_dirs`: Chrome's, and Helium's own, #685). Linux Chrome reads
+/// only the system's, so a per-user registration there leaves Chrome to the app's own offer
+/// (extension.rs).
#[cfg(not(windows))]
-fn chrome_external_dir(all_users: bool) -> Option<PathBuf> {
+fn external_dirs(all_users: bool) -> Vec<(PathBuf, &'static str)> {
let home = PathBuf::from(std::env::var_os("HOME").unwrap_or_default());
- let (dir, chrome) = if cfg!(target_os = "macos") {
- if all_users {
- (
- PathBuf::from("/Library/Application Support/Google/Chrome/External Extensions"),
- PathBuf::from("/Applications/Google Chrome.app"),
- )
- } else {
- let chrome = home.join("Library/Application Support/Google/Chrome");
- (chrome.join("External Extensions"), chrome)
- }
- } else if all_users {
- (
- PathBuf::from("/usr/share/google-chrome/extensions"),
- PathBuf::from("/opt/google/chrome"),
- )
- } else {
- return None;
- };
- chrome.exists().then_some(dir)
+ let config = std::env::var_os("XDG_CONFIG_HOME")
+ .map(PathBuf::from)
+ .filter(|p| p.is_absolute())
+ .unwrap_or_else(|| home.join(".config"));
+ mdm_ipc::browsers::external_dirs(&home, &config, cfg!(target_os = "macos"), all_users)
}
/// Linux: this program runs from inside an AppImage's mount (`APPDIR`), which is gone once the
@@ -982,13 +972,21 @@ fn register(all_users: bool) -> Result<(), String> {
if !failed.is_empty() {
return Err(failed.join("; "));
}
- if let (Some(dir), Some(id)) = (chrome_external_dir(all_users), store_id()) {
- std::fs::create_dir_all(&dir).map_err(|e| format!("{}: {e}", dir.display()))?;
- write_json(
- &dir.join(format!("{id}.json")),
- &serde_json::json!({ "external_update_url": STORE_UPDATE_URL }),
- )?;
- println!("offered the extension to Chrome in {}", dir.display());
+ // Linux, the .deb's or .rpm's helper for one user: no offer in the home folder, which the
+ // package manager couldn't take away with the package (#266); the app's window offers it.
+ #[cfg(target_os = "linux")]
+ let offer = all_users || program != std::path::Path::new(PACKAGED_HOST);
+ #[cfg(not(target_os = "linux"))]
+ let offer = true;
+ if let Some(id) = store_id().filter(|_| offer) {
+ for (dir, update_url) in external_dirs(all_users) {
+ std::fs::create_dir_all(&dir).map_err(|e| format!("{}: {e}", dir.display()))?;
+ write_json(
+ &dir.join(format!("{id}.json")),
+ &serde_json::json!({ "external_update_url": update_url }),
+ )?;
+ println!("offered the extension in {}", dir.display());
+ }
}
Ok(())
}
@@ -998,7 +996,7 @@ fn unregister(all_users: bool) -> Result<(), String> {
for (dir, _) in host_dirs(all_users, None) {
let _ = std::fs::remove_file(dir.join(format!("{HOST_NAME}.json")));
}
- if let Some(dir) = chrome_external_dir(all_users) {
+ for (dir, _) in external_dirs(all_users) {
let _ = std::fs::remove_file(dir.join(format!("{STORE_ID}.json")));
}
println!("unregistered {HOST_NAME}");
diff --git a/crates/nmhost/tests/host.rs b/crates/nmhost/tests/host.rs
index a6c17b36..69e797d4 100644
--- a/crates/nmhost/tests/host.rs
+++ b/crates/nmhost/tests/host.rs
@@ -261,8 +261,8 @@ fn strangers_are_refused() {
}
/// #41: a user with only Zen and Helium (no ~/.mozilla, no Chrome) gets the manifests where
-/// those two read them: Mozilla's folder, created, and Helium's own. `--unregister` takes them
-/// away. (Windows registers in the registry, which every one of them reads.)
+/// those two read them: Mozilla's folder, created, and Helium's own, with the store's extension
+/// offered to Helium (#685). `--unregister` takes them away. (Windows registers in the registry, which every one of them reads.)
#[cfg(not(windows))]
#[test]
fn zen_and_helium_alone_are_registered() {
@@ -311,10 +311,20 @@ fn zen_and_helium_alone_are_registered() {
let origin = serde_json::json!(format!("chrome-extension://{id}/"));
assert!(origins.as_array().unwrap().contains(&origin), "{origins}");
}
+ // #685: Helium offers the store's extension at its next start, from its own folder, through
+ // its own services (its name for the store; Google's answers it "no update").
+ let offer = helium.join("External Extensions/ejoleppdfgjdndddcjoehopknmlglojp.json");
+ let offered: serde_json::Value =
+ serde_json::from_str(&std::fs::read_to_string(&offer).unwrap()).unwrap();
+ assert_eq!(
+ offered["external_update_url"],
+ "https://update-url-to-be-replaced.qjz9zk"
+ );
host("--unregister");
for dir in [&mozilla_hosts, &helium_hosts] {
assert!(!dir.join("com.misterdownloadmanager.host.json").exists());
}
+ assert!(!offer.exists());
let _ = std::fs::remove_dir_all(&home);
}
diff --git a/docs/README.md b/docs/README.md
index 9834860b..3e787158 100644
--- a/docs/README.md
+++ b/docs/README.md
@@ -15,7 +15,7 @@ These pages explain each part of the program. The tutorials walk through the thi
- **[Adding downloads](adding-downloads.md)** — Add URL, the clipboard, the drop target, batch downloads and lists of links, and Start Download versus Download Later.
- **[Link grabber and archives](link-grabber.md)** — many links at once, in packages; zip, 7z and rar archives extracted when they are downloaded.
-- **[Browser integration](browser-integration.md)** — the extension for Firefox (from addons.mozilla.org), Chrome, Edge, Brave, Opera and Vivaldi (from the Chrome Web Store), which downloads it takes, and what happens when MDM isn't running.
+- **[Browser integration](browser-integration.md)** — the extension for Firefox (from addons.mozilla.org), Chrome, Edge, Brave, Opera, Vivaldi and Helium (from the Chrome Web Store), which downloads it takes, and what happens when MDM isn't running.
- **[Run MDM on a server](server.md)** — MDM without a window on a home server or NAS (Docker, Unraid), downloading into its folders; send it downloads from your phone or browser.
- **[Control MDM from your phone](remote-control.md)** — add links, magnets and torrents from a phone or another computer at home, and watch and control the list.
diff --git a/docs/browser-integration.md b/docs/browser-integration.md
index 9fd28e55..8f096380 100644
--- a/docs/browser-integration.md
+++ b/docs/browser-integration.md
@@ -34,6 +34,12 @@ To load it by hand instead (a browser that can't use the store, or a build of yo
**Mister Download Manager** appears in the list. Leave it turned on. Pin its button to the toolbar to see at a glance whether the browser reaches MDM.
+### Helium
+
+[Helium](https://helium.computer/) installs the extension from the same page in the Chrome Web Store: click **Add to Chrome**. Helium fetches extensions through its own services, so this works only while they're allowed. If Helium says **Extension downloads are disabled**, open `helium://settings/privacy/services` (**Settings → Privacy and security → Helium services**), turn on **Allow connecting to Helium services** and **Proxy extension downloads and updates**, and click **Add to Chrome** again. With those off, load the extension by hand instead, as above (`chrome://extensions` works in Helium too).
+
+MDM's setup registers the helper where Helium looks for it, on Windows, Linux and macOS. On Linux and macOS MDM also offers the extension to Helium, through Helium's own services, so with them allowed it arrives by itself at Helium's next start (on macOS Helium asks first: **New extension added** in its menu, where you turn it on). The Linux packages (.deb, .rpm) leave that to the window below, writing nothing in your home folder. On Windows Helium can't be offered the extension this way: MDM's **Add Mister Download Manager to your browser** window opens the store's page in Helium when Helium was installed with its setup; Helium from its zip isn't found there, so open the store's page in it yourself. Helium presents itself as Google Chrome, on purpose, so in **Options → General → Capture downloads from the following browsers** it is **Google Chrome**.
+
### Safari (macOS)
The Mac app carries the Safari extension: there is nothing to download. Safari 17 or later and macOS 14 or later are needed.
diff --git a/docs/getting-started.md b/docs/getting-started.md
index a3284198..376c8245 100644
--- a/docs/getting-started.md
+++ b/docs/getting-started.md
@@ -75,9 +75,9 @@ And on the other desktops it was checked on:
`sudo apt remove misterdownloadmanager` (or `sudo dnf remove misterdownloadmanager`) removes the
programs, and the small files that tell your browsers where MDM's helper is: the .deb and .rpm
-install those for everyone (in `/etc` and `/usr/lib`), for Chrome, Chromium, Edge, Brave, Vivaldi
-and Firefox (the Snap too), so MDM doesn't write them in your home folder. For the AppImage or the
-tar.gz, delete the file or the folder.
+install those for everyone (in `/etc` and `/usr/lib`), for Chrome, Chromium, Edge, Brave, Vivaldi,
+Helium and Firefox (the Snap too), so MDM doesn't write them in your home folder. For the AppImage
+or the tar.gz, delete the file or the folder.
What MDM keeps in your home folder stays, as with any package: your list and settings
(`~/.local/share/misterdownloadmanager`), the AppImage's and the tar.gz's browser files, and
diff --git a/docs/guide-catch-browser-downloads.md b/docs/guide-catch-browser-downloads.md
index 4be098a4..05bd8571 100644
--- a/docs/guide-catch-browser-downloads.md
+++ b/docs/guide-catch-browser-downloads.md
@@ -2,7 +2,7 @@
[← Back to docs index](README.md)
-Set up the extension once, and every download link you click in Firefox, Chrome, Edge, Brave, Opera or Vivaldi goes to MDM.
+Set up the extension once, and every download link you click in Firefox, Chrome, Edge, Brave, Opera, Vivaldi or Helium goes to MDM.
## Before you start
@@ -33,6 +33,8 @@ Once it is set up, a download link goes like this:
2. The browser asks to confirm: click **Add extension**. It keeps the extension up to date.
3. Go to a web page and click a download link, for example a ZIP or an EXE: MDM opens **Download File Info**. Click **Start Download**.
+Helium installs it from the same page, as long as Helium may download extensions: see [Helium](browser-integration.md#helium).
+
## Without the store
When a browser can't use its store (a computer managed by an organization, or a build of your own), add the extension by hand:
diff --git a/tools/extension/e2e.mjs b/tools/extension/e2e.mjs
index ab7873d1..a2508750 100644
--- a/tools/extension/e2e.mjs
+++ b/tools/extension/e2e.mjs
@@ -7,7 +7,7 @@
// browser kept nothing.
//
// cargo build --release -p mdm-app -p mdm-nmhost -p mdm-labserver; tools\extension\pack.ps1
-// node tools/extension/e2e.mjs [chrome] [brave] [edge] [firefox] [waterfox] [--only=case,case]
+// node tools/extension/e2e.mjs [chrome] [brave] [edge] [helium] [firefox] [waterfox] [--only=case,case]
//
// Waterfox runs with Firefox's driver (E2E_WATERFOX: its program, when not installed in the usual
// place). E2E_FIREFOX_ASK=1: Firefox's family asks what to do with each new type in every case
@@ -86,6 +86,8 @@ const BROWSERS = WIN
chrome: ["chromium", [`${pf}\\Google\\Chrome\\Application\\chrome.exe`, `${local}\\Google\\Chrome\\Application\\chrome.exe`]],
brave: ["chromium", [`${pf}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`, `${local}\\BraveSoftware\\Brave-Browser\\Application\\brave.exe`]],
edge: ["chromium", [`${pf86}\\Microsoft\\Edge\\Application\\msedge.exe`, `${pf}\\Microsoft\\Edge\\Application\\msedge.exe`]],
+ // Helium (#685): installed for the user by its setup, or its zip unpacked anywhere (E2E_HELIUM).
+ helium: ["chromium", [process.env.E2E_HELIUM || "", `${local}\\imput\\Helium\\Application\\chrome.exe`].filter(Boolean)],
firefox: ["firefox", [`${pf}\\Mozilla Firefox\\firefox.exe`, `${pf86}\\Mozilla Firefox\\firefox.exe`]],
// Firefox's family: the same driver (E2E_WATERFOX: a copy unpacked elsewhere).
waterfox: ["firefox", [process.env.E2E_WATERFOX || "", `${pf}\\Waterfox\\waterfox.exe`].filter(Boolean)],
@@ -95,6 +97,8 @@ const BROWSERS = WIN
chrome: ["chromium", ["/usr/bin/google-chrome", "/opt/google/chrome/chrome"]],
brave: ["chromium", ["/usr/bin/brave-browser"]],
edge: ["chromium", ["/usr/bin/microsoft-edge"]],
+ // Helium's .deb (helium-bin), else its tarball or AppImage unpacked anywhere (E2E_HELIUM).
+ helium: ["chromium", [process.env.E2E_HELIUM || "", "/usr/bin/helium", "/opt/helium/helium"].filter(Boolean)],
// A .deb or tarball Firefox; else Ubuntu's Snap.
firefox: ["firefox", ["/usr/lib/firefox/firefox", "/opt/firefox/firefox", "/snap/bin/firefox"]],
waterfox: ["firefox", [process.env.E2E_WATERFOX || "", "/usr/lib/waterfox/waterfox", "/opt/waterfox/waterfox"].filter(Boolean)],
@@ -2528,6 +2532,8 @@ const TEST_HOST_KEYS = {
chrome: "Software\\Google\\Chrome\\NativeMessagingHosts",
brave: "Software\\BraveSoftware\\Brave-Browser\\NativeMessagingHosts",
edge: "Software\\Microsoft\\Edge\\NativeMessagingHosts",
+ // Helium is built with Chromium's branding: it reads Chromium's key, then Chrome's (#685).
+ helium: "Software\\Chromium\\NativeMessagingHosts",
// Firefox's forks read Mozilla's key too.
firefox: "Software\\Mozilla\\NativeMessagingHosts",
waterfox: "Software\\Mozilla\\NativeMessagingHosts",