# Control MDM from your phone Add a download from your phone, or from another computer at home, and watch it run on the computer where MDM is: paste a link or a magnet link, send a `.torrent` file, see the list with its progress, and pause, start or remove downloads. Your phone opens a small page that MDM itself serves; nothing is installed on the phone, and no outside service is involved. The remote control is **off until you turn it on**, it answers **only phones and computers you paired** with a code MDM shows, and it listens **only on your local network** (your Wi-Fi or your cable), never on an address the internet can reach. ![Options, Remote](images/options-remote.webp) ## Turn it on 1. **Options → Remote**. 2. Tick **Let phones and computers on the local network control MDM**. 3. Click **OK**. The page then says **On** and shows the address to open, such as `https://192.168.1.20:8463/`. The first time, Windows may ask whether to let MDM communicate on networks: allow it on private networks, or the phone can't reach MDM. ## Pair your phone 1. On the computer: **Options → Remote → Pair a device...** It shows a QR code, the address and an 8-digit code. 2. On the phone, on the same Wi-Fi: scan the QR code with the camera (or type the address). 3. The browser warns that the connection's certificate isn't trusted. That is expected: MDM made its own certificate, on your computer, and no public authority knows it. To be sure the page is your MDM's, open the warning's details: the certificate's **SHA-256 fingerprint** is the one **Options → Remote** shows. Then continue to the page (**Advanced → Proceed** in Chrome, **Show details → visit this website** in Safari). 4. The code is filled in when you scanned the QR code; otherwise type it. Give the phone a name, and tap **Pair**. The window on the computer says so, and closes with **Done**. A code works once, for ten minutes, and not after five wrong tries: click **New code** for another. To keep the page one tap away, add it to the phone's home screen (the browser's menu: **Add to Home screen**). ![The page on a phone](images/remote-phone.webp) ## What the page does - **Add**: a download's address or a magnet link, or a `.torrent` file from the phone. Pick a **Category** (or let the file's type pick it), and **When**: **Start now**, or wait in a queue. A torrent is added with all its files, once MDM has read them (a magnet link can take a moment). - **The list**: every download with its progress, speed and size, with **All**, **Unfinished** and **Finished**. **Pause** and **Start** each one; **×** removes it from the list, and with **Delete the file too**, deletes its file from the computer. - **The queues**: start and stop each one. - The bar at the top shows the total speed and the free space where your downloads go. Downloads added from the phone are like the ones you add on the computer: they go into the category's folder, follow the queues, the Scheduler and the speed limits, and go through the network adapter you chose in **Options → Proxy / Socks** (and stop when it disconnects). The page shows the language your phone uses when MDM has it, and follows its light or dark mode. ## Your paired devices **Options → Remote** lists the paired devices, when each was paired and when it was last seen. Select one and click **Remove**: it is refused from its next request on, at once (no need for **OK**). On the phone, the page's **⋮ → Forget this device** does the same from that side. Lost your phone? Remove it in Options. To stop everyone at once, untick the box: nothing listens any more. ## Send downloads to a phone or another computer MDM can also hand a download to another MDM on the same network, a phone's or another computer's, so it downloads there instead of here: right-click a download → **Send to ▸** and the device's name. **Download File Info** and **Download video** have a **Send to** button too. 1. On the other device, turn on its remote control (as above) and choose **Pair a device...**: it shows a code. 2. Here: **Options → Remote → Send to devices...** (or right-click a download → **Send to ▸ Pair a device...**). The MDMs on this network are listed under **Found on this network**: click one, or type its address. Type the code it shows and click **Pair**. 3. From then on, **Send to ▸** lists it. What is sent: - **A download that isn't finished** goes as its address, with what its request needs: the page it came from, the browser's cookies for it, its User-Agent and its file name. It starts there at once, in the category its type gives. The cookies go only to the paired device, inside the encrypted connection, and are never written to a log. - **A finished download** goes as its file: handed over in pieces, so a connection that drops goes on where it stopped when you send it again, and checked at the end against its SHA-256. It lands in the category's folder there, under a name of its own (never over another file), and joins its list as finished, **Received from** this computer. It is marked as coming from the internet, naming the address it was downloaded from, as every download is (**Options → Save to**'s "Mark downloaded files as coming from the internet"). - **A torrent** goes as its magnet link. - **A video** (and an image gallery) is downloaded here first, then its file is sent: the other device doesn't need yt-dlp. **How pairing proves who's who.** The code is never sent over the network. Both MDMs run SPAKE2, a password-authenticated key exchange, over it: each side gets the same key only if it used the same code, and each proves it holds that key with a check over the whole exchange, which names the certificate the receiving MDM serves and the one the sending MDM saw. So someone else on the network who doesn't know the code gets one guess per try (and the tries are limited as for a typed code), and someone relaying between the two, with a certificate of its own, is found out: the check names the wrong certificate, and nothing is paired. Once paired, the sending MDM keeps the other's certificate and checks it on every connection: if it ever changes, nothing is sent and MDM says so; pair again only if you trust it. A device that moved to another address (a new DHCP lease) is found again on the network by itself, recognised by that certificate. **What a pairing allows:** another MDM paired this way may say what it is, add a download (with what its request needs) and hand over files, nothing else: it can't list, pause or remove your downloads. A phone's browser or the browser add-on keeps what it always had (list, add an address, pause, start, remove, queues) and can't hand over files. **Unpairing:** select the device in **Send to devices...** and click **Remove**: it is unpaired on both sides (on the other one as soon as it answers). On the other device, removing this computer from its **Paired devices** does the same: the next send says it was unpaired, and it leaves the list. Sending needs no remote control of its own: only the device that receives has its remote control on. ### Finding devices on the network While its remote control listens on a local network address, MDM announces itself there with DNS-SD (multicast DNS, the service `_mdm._tcp`), with its name and an id that changes each time MDM starts, so the others can list it without anyone typing an address and nobody can follow it from one day to the next. Looking for devices goes on while **Send to devices...** is open, and stops a minute after; nothing about discovery listens on the network otherwise. **Found on this network** only lists: pairing still needs the code the device shows, and an announcement is never trusted for anything else. Some networks (guest Wi-Fi, some office networks) block multicast: type the address there (**Options → Remote** on the other device shows it). ### Editions MDM for Android comes in two editions: the full one (GitHub, F-Droid), which downloads every address as the desktop does, and the Google Play one, which **never downloads from YouTube or its video servers** (`youtube.com`, `youtu.be`, `youtube-nocookie.com`, `googlevideo.com`), whoever sends the address. A computer sending such a download to a Play edition knows it (each MDM says its edition when asked) and downloads it itself, then hands the finished file over: the phone receives a file from your own paired computer and never contacts YouTube. If the address is sent anyway, the phone refuses it. ## Where it listens - **Listen on**: **Every local network address** (the default) listens on each private address of the computer (`192.168.x.x`, `10.x.x.x`, `172.16–31.x.x`, and IPv6's `fd…`), one by one, and follows them when you join another network. **This computer only** listens on `127.0.0.1`. Or pick one address of one adapter. - **Port**: `8463` unless another program uses it; then pick another (1024 to 65535). Don't make MDM reachable from the internet (a router's port forwarding): the remote control is made for your home network. To reach it while away, use a VPN to your home network instead (WireGuard, Tailscale): with Tailscale, choose its address in **Listen on**. ## Security What keeps the remote control safe, in short: - **Off by default**, and nothing listens while it is off. - **Paired devices only**: every request but pairing needs the token the device got when it paired. A pairing code works once, for ten minutes, with five tries, and tries are slowed down. The settings keep a fingerprint of each token, not the token. - **Your local network only**: MDM listens on the computer's private addresses, one by one, never on every address at once. - **Encrypted**: HTTPS, with a certificate made on your computer and kept; its fingerprint is in Options, to compare with the one the phone's browser shows. - **Web pages can't use it**: requests must name MDM's own address, come from its own page, and carry the token; MDM's page can't be shown inside another site. - **Only downloads**: a paired device lists, adds, pauses, starts and removes downloads, hands over finished files (into the category's folder, under a name of their own, never over another file), and starts and stops queues. It can't change settings, open windows on the computer, or see folders (the list it gets has no paths). - **Send to device**: discovery only lists devices, sending needs a pairing, the paired device's certificate is pinned when paired, and only local network addresses (and this computer's) are paired with or sent to, never through a proxy. Found a problem? Please report it privately, as [SECURITY.md](../SECURITY.md) says. ## For developers: the Send to device protocol Another MDM pairs with SPAKE2 (Ed25519 group, RustCrypto's `spake2`) over the code: 1. `POST /api/pair/spake` `{msg, fp, name}`: the sender's SPAKE2 message (`A`, identities `mdm-send-to-device sender` / `receiver`), its own certificate's SHA-256 and its name. Paced and counted as a typed code (one try a second, five per address, twenty in all). Answered `{session, msg, proof, left}`: the receiver's message (`B`) and its proof, HMAC-SHA256 under the key of `mdm-pair-v1`, the role, both messages, the receiver's certificate's SHA-256 (as it serves it) and the sender's, each with its length. 2. The sender checks that proof with the certificate it saw on this connection: a wrong code or another certificate (a relay's) fails here, and it stops. Then `POST /api/pair/confirm` `{session, proof}` with its own proof (role `sender`); the receiver checks it the same way and answers `{token, id, name}`. The sender pins the certificate. A pairing link's `#pair=&fp=` (the QR code) gives the pin before the first connection. A token from this pairing is another MDM's: `GET /api/about`, `POST /api/add`, `/api/file…` and `/api/forget` only (`403 wrong-kind` elsewhere); a browser's token (`POST /api/pair`) keeps the page's routes and adds an address alone. | Request | What it does | |---|---| | `GET /api/about` | `{name, edition, version, protocol, id}`: `edition` is `full` or `play` (an unknown one is taken as the strictest), `id` the install's id (said to paired MDMs only) | | `POST /api/add` | `{url, start, referer?, cookies?, user_agent?, name?}`; a Play edition answers `403` `edition-refuses` (with `site`) for YouTube's addresses | | `POST /api/file` | `{name, size, sha256, url?}` starts a file handover, or goes on with one: `{id, at}`, `at` the bytes it holds; `url` the address it came from, for its mark; `507` `no-space`, `429` `too-many-files` (eight at once per device) | | `PUT /api/file/?at=` | one piece (at most 4 MB) at length `n`: `{at}`; `409` `wrong-offset` with its own `at` | | `POST /api/file//done` | checked by its SHA-256 and placed: the list's answer (`{id}`); `409` `short`, `422` `checksum-mismatch` (sent again from the start) | A handover's id is the same for the same file from the same device, so one cut off goes on after a restart of either side; one left a week is removed with its part file. ### On Android (the next step) The Android app's side comes next, on the same code: the phone runs this same remote control. - **Phone → computer:** the phone pairs with a computer's remote control by scanning its QR code (the pin comes with it), then **Send to ▸ ** on a download, or on a link shared to MDM, sends the address with its cookies, Referer and name through `POST /api/add`. - **Computer → phone:** the phone's remote control listens while the app's download service runs; its **Pair a device...** shows the code, typed on the computer. Android may stop a background app's network: the computer then says the device doesn't answer. - **The Play edition** answers `edition: play` and refuses YouTube's addresses at `POST /api/add`, as the app's own gate does for addresses typed or shared on the phone; files handed over are what it receives instead. - CI runs a desktop MDM on the runner and the app in an emulator, which reaches it at `10.0.2.2`.