Remote management: one Manager is the server, the others are clients
Superseded 2026-11-03. The Swift server (
StationServer,RelayServer,antenna-tower-server,control-room, the Manager's launchd helper and MCP assistant) was replaced by the Go tower intower/(ADR 0005). What follows is history.
Design agreed 2026-09-28.
2026-10-18: being taken further by Settings from the Mac mini (ADR 0001): every app, not only Managers, now gets its settings from the server, devices join by invite, and a client that can't reach the server queues its changes instead of turning read-only or editing through iCloud. Where this document says otherwise, that one is newer.
Today every Manager edits the station itself: each writes settings straight to iCloud, and each runs its own jobs (event refreshes, Jev). A few settings live on one Mac only (the relay, the OpenSky login, the assistant server, the TypeSafe key, how often events refresh), so the Mac mini's can't be reached from the MacBook Air at all.
With remote management, one Manager (the Mac mini's) is the server. It is the only one that writes settings to iCloud, and the only one that runs jobs. Another Manager (the Air's) becomes a client: its panes work as they do now, but every change goes to the server, which applies it and publishes it to iCloud. The Apple TVs keep reading iCloud as before.
This is remote management, not yet a separate server: the server is still the Manager app. Splitting it out (a headless helper, or the homelab) comes later; see Later.
Decisions #
- The server publishes; clients send it changes. Only the server writes synced settings to iCloud. A client sends each changed key to the server and reads the server's changes straight from it, not from iCloud (which can lag by minutes).
- The server is the Mac running the relay. "Run the relay on this Mac" makes a Manager the server as well, so there's one choice, not two.
- Jobs run on the server only. A client's event refresher (and Jev, which
runs inside it) stays off; its menu shows the server's status and "Refresh
Now" asks the server. So is On Demand's category picking (2026-10-13): the
picks (
OnDemandSettings.keptand the automaticcategories) are a synced setting worked out from Jev's tags, which are kept on one Mac. A client changes only the preferences (languages, kinds, by-hand picks); the server works the picks out again when they change. A Mac with no tags for a source leaves its picks alone rather than picking every category. Before this the client (tags, English picks) and the server (no TypeSafe key, so no tags: every category) each wrote its own answer over the other's, and each write had the other fetch the whole catalog again. The tags are the server's too: a client's On Demand pane shows them and its "Tag New Categories" asks the server (commands/ondemand-tags,ondemand-tag), and a server with none is sent the client's from before (ondemand-seed). The server needs the TypeSafe key (Settings › Server) to tag new categories. - Can't reach the server: read-only, until you choose otherwise. A client that can't reach its server shows everything (from iCloud) but turns editing off, with a banner. Edit without Mac mini is a deliberate choice: the client then writes iCloud directly, as today, until the server can be reached again.
- The server takes offline edits as they are. When the client reconnects, the keys it changed while offline are sent to the server as the latest value. The server also applies iCloud changes as they arrive, as it does today. Each setting keeps its latest value.
- The admin API sits next to the relay, with its own key.
/v1/adminon the relay's server (port 8766), found the same way (the synced address, then Bonjour). The household token isn't enough: every Apple TV has it. Admin calls need a per-client key, made by pairing with a six-digit code the server shows. Keys stay on each Mac; the server can forget a client. - Settings go by key, with versions. The panes don't change: a client's
SettingsSyncsends changed keys instead of writing iCloud. Each key has a revision; a write based on an old revision is refused and the client takes the server's value (a job may have changed it a moment before). - The server's own settings in one place. A client's Settings › Server lists the server's per-Mac settings (event refresh, assistant server, TypeSafe key, OpenSky login) rather than adding a This Mac/Mac mini switch to each pane.
The protocol #
At http://<host>:8766/v1/admin. Bodies are binary property lists (settings
are UserDefaults values: data, strings, numbers, arrays, dictionaries).
Every request but pair sends X-RetroTV-Admin: <key>; without a known key
the answer is 401. The household token isn't needed here.
| Request | Answer |
|---|---|
POST pair-code |
{code, expires, name}: a new code, the one the Server pane then shows. Only from this Mac itself (loopback), for --pairing-code. |
POST pair {code, name} |
{key}, if the code is the one the server shows (ten minutes, one use, five tries). |
GET settings?since=<seq>&epoch=<e> |
{epoch, seq, changes: [{key, rev, value?}]}: every synced key changed after seq (all of them when since is 0 or the epoch differs). No value means removed. |
PUT settings/<key> {base, value?} |
{rev, seq} if base is the key's current revision, else 409 {rev, value?}: the server's current one. |
GET status |
The server's name, its relay status, event channels' status and last refresh, and its own settings. |
PUT local/<key> {value} |
One of the server's own settings. |
POST commands/<name> |
refresh-events, opensky-login {clientID, clientSecret} (checked with OpenSky first). |
- Revisions come from one counter (
seq) that goes up whenever a synced key's value changes on the server, however it changed (a client, a job, iCloud). They're kept in memory; the epoch, made at each start, tells a client to fetch everything again after a restart. - A client polls
settingsevery three seconds while it's connected. - Plain HTTP on the home network, like the relay: a client's key crosses the network in the clear. Fine at home; anything further (Tailscale) is encrypted by the tunnel.
In the code #
Packages/RetroRelay, targetRelayAdmin(Foundation): the protocol's wire format,SettingsLedger(revisions and the compare-and-set),PairingDesk(codes and keys), andAdminClient.RelayServermounts/v1/adminwhen given aRelayAdminBackend;retro-relayhas none.- Manager (
Sources/Manager/Remote/):RemoteServer(the backend, on the server Mac),RemoteLink(the client: pairing, polling, sending, the offline mode) and the Server pane in Settings. SettingsSyncgets a route:cloud(as today), orserver, where changes made here go toRemoteLinkand iCloud changes aren't taken in.
Built (2026-09-28) #
-
RelayAdmin(inPackages/RetroRelay):SettingsLedger,PairingDesk,AdminClientand the wire format, tested with the relay's tests.RelayService.Config.adminmounts/v1/admin/**, which skips the household token check. -
Server (
RemoteServer): mounted byRelayHostwhenever the relay runs. Paired Macs are kept on the server by the SHA-256 of their key (remoteClients). Its own settings for clients (ServerSetting.all): event refresh cadence, the assistant server, the TypeSafe key (sent as set or not, never itself). Commands:refresh-events,opensky-login. -
Client (
RemoteLink):remoteServer(name, address, key) on the client Mac;remoteOfflineEdits, the keys changed while editing without the server, kept across quits. It starts before the station loads, read-only until the first answer. A change the server refuses (an old revision) or that can't be sent is put back, with a notice. -
The Manager: a Server pane in Settings (pair a Mac with a code and forget them, on the server; pick the server and type its code, or an address for Tailscale, on a client; the server's own settings), a banner over every pane while a client isn't connected, panes disabled while it's read-only, the menu bar's event channels from the server, and the Relay pane showing the server's relay and sending its OpenSky login there.
-
From the command line (2026-09-28): on the server,
just pairing-code, or"/Applications/Rabbit Ears Manager.app/Contents/MacOS/Rabbit Ears Manager" --pairing-code(over SSH too), prints a new code. It asks the running Manager at127.0.0.1:8766; the server only gives codes to its own Mac.
Later #
- The server split. The server's logic moves out of the Manager's window into a helper with no window (or the homelab), and every Manager becomes a client. Publishing to iCloud needs an Apple device, so a Linux server would also need the Apple TVs to read settings from it.
- Away from home. Tailscale (or similar) would let a client reach the server anywhere; nothing here assumes the home network except discovery.
Phin Tech docs
Rabbit Ears Manager in the store →