Configuration and command line
Private configuration
Section titled “Private configuration”Lives outside the repo, at $XDG_CONFIG_HOME/warpzone/config.toml
(default ~/.config/warpzone/config.toml). It is the only place with personal
data. examples/config.example.toml documents every key.
[hub]name = "nas"device_id = "XXXXXXX-..."root = "/srv/games" # path on the hub's filesystem (an example; use your own)api_url = "http://nas.local:8384"# api_cert_sha256 = "AB:CD:..." # optional: pin the hub's GUI certificate, with an https:// api_urlapi_key_file = "~/.config/warpzone/hub.key" # or api_key = "..."addresses = ["tcp://nas.local:22000"] # optional, default ["dynamic"]
[devices.deck]device_id = "YYYYYYY-..."profile = "steamos-emudeck"folders = ["library", "tools", "saves", "frontend"]addresses = ["tcp://deck.local:22000"] # optional, default ["dynamic"]self_update = true # optional: install the self-update timer (default true)channel = "stable" # optional: "stable" (default) or "rc"pin = "v0.3.0" # optional: stay on this tag (vX.Y.Z or vX.Y.ZrcN)auto_hub = false # optional: create the hub folders it lacks (default false)auto_prune = true # optional: the unattended prune timer (default true with "library")exclude_systems = ["ps4", "switch"] # optional: systems the device does not run (default: none, it runs all)
[devices.machine]device_id = "ZZZZZZZ-..."profile = "steamos-emudeck"folders = ["library", "tools", "saves", "frontend", "songs", "settings"]
[inbox] # optional, read only by `warpzone inbox` and `warpzone scrape`root = "/Volumes/hub" # the hub root as mounted on this machinedats_dir = "~/dats/libretro-database/metadat"work_dir = "~/tmp/warpzone" # optional; default: the system temp folderchdman = "/opt/homebrew/bin/chdman" # optional tools; PATH is searched when unsetbsdtar = "/usr/bin/bsdtar"rahasher = "~/tools/RAHasher" # only used when setdolphin_tool = "/usr/local/bin/dolphin-tool"mame_dat = "~/dats/mame0282lx.zip" # optional arcade databases (see Inbox)fbneo_dat = "~/dats/fbneo-arcade.dat"mame2003plus_dat = "~/dats/mame2003-plus.xml"gamelist_mame = "/Volumes/hub/frontend/es-de/gamelists/mame/gamelist.xml" # optionalgamelist_ps3 = "/Volumes/hub/frontend/es-de/gamelists/ps3/gamelist.xml" # optionalskyscraper = "/usr/local/bin/Skyscraper" # optional; PATH is searched when unset (scraping)tool_timeout_minutes = 240 # optional, the default: kills a tool that hangschdman_threads = 2 # optional; chdman's --numprocessors (unset: chdman's own count)chdman_flac = true # optional, the default; false: `createcd` without FLAC (less memory)scrape_region = "sp" # optional; Skyscraper's `--region` on the gather (unset: nothing)scrape_language = "es" # optional; Skyscraper's `--lang` on the gather (unset: nothing)
[serve] # optional, read only by `warpzone serve`listen = "0.0.0.0:8780" # optional, the defaulttoken_file = "/config/ui.token" # optional; else WARPZONE_UI_TOKEN# access_team_domain = "example.cloudflareaccess.com" # optional, with access_aud: Cloudflare Access sign-in# access_aud = "<the application's AUD tag>"# access_emails = ["you@example.com"] # optional: only these e-mails
[ra] # optional, read by `serve` and `catalog --ra-achievements`user = "ExampleUser" # optional; the RA user whose progress is shownwarpzone inbox and warpzone scrape read only the [inbox] table, so a computer (or the hub container) that only files games
needs no [hub] or [devices]. API keys are never printed, logged or included in
error messages; the RetroAchievements key is read from RA_API_KEY, never from a file.
warpzone serve reads [hub], [devices.*], [serve], [ra], [inbox] rahasher and the arcade
DATs of [inbox] (mame_dat, fbneo_dat, mame2003plus_dat, to refuse deleting a set others
depend on); its token
comes from WARPZONE_UI_TOKEN or [serve] token_file and is never printed either (see
Library UI).
The hub’s API over the network
Section titled “The hub’s API over the network”Syncthing’s GUI certificate is self-signed, so a client that verifies certificates the usual way
rejects it, and a hub reached across the LAN (provision hub from a laptop, the hub container on a
bridge network, every console’s provision device) would have to use http://, with the API key
in the clear. The optional [hub] api_cert_sha256 removes that choice:
- It holds the SHA-256 fingerprint of the hub Syncthing’s GUI certificate (
https-cert.pem).normalize_cert_sha256drops:and whitespace and lowercases, so whatopenssl x509 -fingerprint -sha256prints after=, a browser’s spaced form and bare hex are the same pin. Anything that is not exactly 64 hex digits is a config error. - With it, the hub client speaks TLS and accepts only a server whose leaf certificate (the DER from
getpeercert(binary_form=True)) hashes to exactly that value. The comparison ishmac.compare_digest, done inconnect()after the handshake and beforehttp.clientwrites anything, so the request line, the headers and theX-API-Keynever reach another server. A mismatch is aSyncthingErrorwith both fingerprints and no key in it. The name in the URL is not checked: the pin replaces it. - The pinned client is an
OpenerDirectorwith only the HTTPS handler and the error handlers: it follows no redirect (a 3xx is an error, so the key cannot be copied to another host), uses no proxy from the environment (it always connects directly) and cannot speak plain HTTP. TLS 1.2 is the minimum. - Without a pin the client follows the same two rules (
syncthing._direct_opener): no redirect is followed, so a 3xx is an error that names itsLocationand the key is never sent there (setapi_urlto that address instead), and no proxy from the environment is used (HTTP_PROXYand the like are ignored; it connects directly). Only the TLS check differs: anhttps://loopback URL trusts Syncthing’s self-signed certificate, any otherhttps://URL needs one the system trusts. http://with a pin is a config error (exit 2), andClientrefuses it too: the pin says that only a verified TLS peer gets the key. Anhttps://loopback URL with a pin is checked like any other (without a pin, loopback keeps skipping verification, as before).cli._hub_clientis the only place that builds a client for the hub, soprovision hub,provision device(whitelist pre-check andauto_hub),check,status,serveandwhitelistall get the pin. A mismatch in theprovision devicepre-check is reported like an unreachable hub (with the mismatch text) and provisioning goes on; nothing was sent. Clients for the local Syncthing (config.xml) are never pinned.- Without the key nothing changes. Syncthing renews an auto-generated GUI certificate about every 790
days, with a new key, so the pin must then be updated; a custom certificate in
https-cert.pemis never replaced by Syncthing. warpzone doctorstays offline: its “Hub API” line reports only what the config says (https with a pin, https on loopback, https verified by the system, or a warning for plainhttp://away from loopback).warpzone checkandstatusprove that the pin matches.
Command line
Section titled “Command line”python3 -m warpzone <command>; also installable as a warpzone script.
| Command | Runs on | Does |
|---|---|---|
warpzone check |
anywhere | Validates config + profiles, reports which whitelists are missing on the hub (via GET /rest/db/browse), never writes. Exit 1 if any are missing; --offline skips the hub. Where it can read a device’s whitelist (the hub root with --root, or the device’s own library folder), it also reports a whitelist that names a system in the device’s exclude_systems (exit 1), see Supported systems. |
warpzone provision hub |
anywhere that reaches the hub API | Adds every configured device to the hub, creates/updates every wz-* folder on the hub and shares it with the devices that subscribe to it and stops sharing it with a configured device that no longer does (no file is deleted), sets the hub ignores. A newly created whitelisted folder first lets only the whitelists through and waits for them (--timeout, default 120 s) before the full scan, see “Hub bootstrap”. Idempotent. --additive does only the creation of the wz-* folders the hub lacks, never a whitelisted one and never a change to a folder the hub has, see Hub folders from a console. |
warpzone provision device <name> |
on the device | Reads the local Syncthing API key from the local config.xml (searching the default locations, including the SyncThingy flatpak; --syncthing-config PATH overrides), adds the hub device, creates the subscribed folders with the bootstrap above (--timeout SECONDS). With auto_hub = true it first creates on the hub the folders of the device that the hub lacks (see Hub folders from a console). --unattended is for a run nobody watches and changes the rules as described in Autonomous updates; it exits 3 when a write waits for the menu to close. When that Syncthing is the SyncThingy flatpak it first grants it the missing flatpak override --user --filesystem=~/.var/app/<app> for every folder under ~/.var/app (flatpak hides other apps’ data), and asks for a Syncthing restart. When the device subscribes to settings, it installs the ES-DE startup script that runs settings apply (see ES-DE startup script). When the device subscribes to library and its profile has [es_systems] or [retroarch], it also writes the frontend’s system list override and pins RetroArch’s paths (see Frontend and RetroArch overrides). When the profile has [shadps4] it also lists the PS4 games folder in shadPS4’s install directories (see shadPS4 install directories). When the profile has [cemu] it also sets Cemu’s MLC path and adds the library’s Wii U folder to its game paths (see Cemu paths). When the profile has [switch_content.*] it also adds the library’s extras/switch folder to the lists of update and DLC folders of Eden and Ryujinx (see Switch update and DLC folders). When the profile has [links.*] and the device lists library, it links the library games into the emulator’s game folder and installs the ES-DE startup script that keeps them linked (see Title links). When it lists frontend and the profile has [artwork], it limits the artwork folders to the systems on the device, writes the gamelists and installs the refresh timer (see Frontend artwork). When it lists library and auto_prune is not false, it installs the unattended prune timer (see Unattended runs). Idempotent. |
warpzone frontend refresh [device] |
on the device | For a device whose profile has [artwork] and that lists frontend: widens the artwork folders’ ignores to the systems that have games now (when the local Syncthing is found) and rewrites the frontend’s gamelists from the synced ES-DE data, only while the frontend is closed. --dry-run prints what it would do. See Frontend artwork. |
warpzone play-state sync <device> |
on the device | For a device with ES-DE that lists play-state: publishes what its gamelists say and merges the other devices’ ledgers into them, only while ES-DE is closed or starting (--frontend-starting, which its startup script passes). --dry-run, --quiet. Needs no network. See Play state. |
warpzone links sync <device> |
on the device | For a profile with [links.*] and a device that lists library: makes each rule’s target hold a symlink per library title, never while the emulator runs (see Title links). --dry-run only says what it would do, --quiet prints nothing. ES-DE runs it at startup. |
warpzone saves convert <device> |
on the device | For a profile with [save_convert.*] and a device that lists saves: reconciles the hub’s raw saves with the emulator’s own files (DraStic’s .dsv), never while the emulator runs, with a backup before any overwrite (see Save conversion). --dry-run only says what it would do, --quiet prints nothing. EmulationStation runs it around the emulator and frontend refresh runs it on the timer. |
warpzone prune [device] |
on the device | Reports, and with --apply deletes, the files of the whitelisted folders that the device no longer whitelists (see Pruning). Report only by default. --apply --unattended is what the prune timer runs: no size cap, the half-of-device guard instead (see Unattended runs). |
warpzone catalog |
where the hub root is mounted (the hub’s container) | Builds and updates the catalog index in catalog/ from library/ (see The catalog index). --root PATH (default [hub] root), --dry-run. --ra-hash hashes the games that lack an RA hash with RAHasher (--rahasher PATH, else [inbox] rahasher); --ra-lists refreshes the cached RA game lists (RA_API_KEY; --force ignores their age); --dats [--dats-dir PATH] fills the DAT serials of games that have none from the DAT folder of inbox. |
warpzone whitelist migrate [device ...] |
where the hub root is mounted | Converts hand-written patterns-<device>.stignore files into the library UI’s format, proving on the hub’s tree that the included paths stay the same, with a backup of each file it replaces (see The migration). --root PATH, --dry-run. Exit 1 if any file was refused. |
warpzone whitelist restore <device> [backup] |
where the hub root is mounted | Lists the backups of a device’s whitelist, or writes one back after showing its diff against the current file and the paths it turns on and off, with a backup of the file it replaces and a re-check right before the write (see History and restore). --root PATH, --dry-run. Exit 1 if refused. |
warpzone serve |
in the hub’s container | Serves the library UI and its JSON API (see Library UI). Writes only device whitelists, the catalog, the whitelist backups and the play queue, on request, and, on a confirmed deletion, moves one game’s files, media and gamelist entry into trash/ (see Deleting a game). Runs until stopped; exit 2 without a token or when [hub] root has no library/.stfolder. |
warpzone bios |
on a device or the hub | Reports which BIOS and firmware files a library has, lacks or has wrong (see BIOS check). Read-only. Exit 1 if a required item is missing or wrong. |
warpzone inbox |
a computer that mounts the hub’s share, or the hub’s container | Identifies, converts and files new games dropped in inbox/ (see Inbox). Report only by default, --apply acts, and every --apply that processed an item writes a run record (see The run record); --notify-url URL sends a webhook when some item went to review. With --apply it then scrapes the games it placed when Skyscraper is configured or found; --no-scrape skips that (see Scraping). Exit 1 if any item needs review; a scrape never changes it. |
warpzone scrape |
a computer that mounts the hub’s share, or the hub’s container | Fills the hub’s ES-DE gamelists and media for the library’s games that lack them, with Skyscraper (see Scraping). Convergent: writes by default, only adds, --dry-run runs no Skyscraper and writes nothing. --refresh-text is the one exception to “only adds”: it replaces the name, description and genre of existing entries from Skyscraper’s cache (no request, a backup of each gamelist it changes; its --dry-run runs Skyscraper from the cache in a folder of its own and writes nothing to the hub; see Refreshing the text). --root PATH, --system NAME ..., --retry-not-found, --force-lock. --unattended [--max-games N] [--max-minutes N] [--notify-url URL] is the run of a scheduled task, once a night (see Unattended scrape): it refuses --dry-run, --force-lock, --retry-not-found and --refresh-text, and exits non-zero only for news. Exit 1 when the run could not finish, 2 for no Skyscraper or a held lock. |
sh <clone>/warpzone/data/updater.sh install <device> |
on the device, from a fresh git clone |
The one way to install a device: checks out the best release of the channel, makes the venv next to the clone, and runs provision device (see Self-update). |
warpzone self-update |
on the device | Runs one tick of the updater script’s live copy (sh ~/.local/share/warpzone/updater/updater.sh tick), as the timer does, and exits with its code (see Self-update); --now passes --now (--fetch-now to an older live copy). Needs no config. Without a live copy it says so and exits 1. --channel stable|rc [--dry-run] runs no tick: it sets the device’s channel in its config and in the updater’s settings. |
warpzone health [device] |
on the device | Checks that this version works here: loads the config and the profiles, runs settings apply, play-state sync, links sync and frontend refresh as dry runs within the 15 seconds ES-DE gives its startup scripts, and checks that the startup scripts and the units exist with an interpreter that imports warpzone (see warpzone health). Writes no user data, needs no DATs or tools. Exit 0 when it works, 1 when a check failed. |
warpzone doctor |
any machine | Checklist of this machine: tools, config, local Syncthing, DATs, hub folder (see Doctor). Offline, never changes anything. Exit 1 if a required check fails. |
warpzone settings apply |
on the device | Writes the layered emulator settings into each emulator’s config file: only the layered keys, with a backup, never while the emulator runs (see Emulator settings). Run by ES-DE at startup and by hand. |
warpzone settings capture |
on the device | Shows what changed in the emulators’ settings since the last sync and writes the keys the user chooses to the common or the device layer on the hub. |
warpzone settings audit |
on the device | Reports drift between the layers and the emulators’ files. Read-only. Exit 1 on drift. |
warpzone status |
anywhere | Folder state, need counts, errors, receive-only local changes, for the hub (and the local device if any). |
warpzone render-ignores <device> |
anywhere | Prints the ignore lines a device folder would get. For debugging. |
--dry-run belongs to the commands that write by default: provision hub, provision device, frontend refresh, play-state sync, links sync, saves convert, settings apply,
settings capture, catalog and whitelist migrate. For provision it prints the REST calls the command would make (method,
path, JSON body with secrets redacted) and sends no write, though it still sends the GET
requests it needs to compute the diff; the others say what they would write. Commands that act
only with --apply (prune, inbox) have no --dry-run: the report is the dry run, see
Writing commands. check, bios, doctor, status, render-ignores,
settings audit, health and a self-update tick do not write user data and take none.
Every command takes --config PATH (default $WARPZONE_CONFIG, then the XDG path) except
self-update: it needs no config and runs the installed updater with the settings provision device wrote (--now), or, with --channel stable|rc, edits the config those settings name.
Exit codes: 0 ok, 1 runtime error (for health, a failed check, a config error included),
2 usage or config error, 3 only for provision device --unattended (deferred), 130 when
a command is interrupted with Ctrl-C and 143 for an updater tick killed by HUP, INT or
TERM. Every error warpzone reports derives from WarpzoneError, which carries its exit code
(errors.py); UsageError, the base of ConfigError, ProfileError, ModelError,
BiosError and InboxError, makes it 2. So a usage error of bios or inbox (a missing
--root, a configured file that does not exist) exits 2, not 1, and 1 stays for what went
wrong while working (a missing BIOS, an item sent to review).
prune has its own flags: --apply, --unattended (only with --apply, not with
--max-gib or --force), --max-gib N (default 50), --force,
--list, --notify-url URL, --timeout SECONDS (wait for the rescan),
--syncthing-config PATH. It does not take --dry-run: without --apply it
is one. inbox takes --notify-url URL too (an http:// or https:// URL, never printed),
which does something only with --apply, and --unattended (only with --apply, not with
--force-lock; both are usage errors, exit 2). If the device name is left out, it is the configured device whose ID
matches the local Syncthing.
Writing commands
Section titled “Writing commands”There are two kinds of command that write, and the rule follows from what a mistake costs.
Destructive commands report first and act only with --apply. They delete or move data
the user owns and cannot get back from a backup: prune (files of a whitelisted folder the
device no longer whitelists) and inbox (converts, places and moves the originals of the games
in inbox/). Without --apply they read, plan and print, and change nothing; the report is
the dry run, so they take no --dry-run. prune re-checks each file right before deleting it
and has a size cap on top (--max-gib).
One exception: the unattended prune. A game turned off in the library UI must leave the
console by itself, so the prune timer runs prune --apply --unattended with nobody watching. It
keeps every safety rule of prune and its re-check before each delete, drops the size cap (one
PS4 game is larger than the default) and refuses to delete anything when a folder would lose
more than half of what the device holds in it (see
Unattended runs).
The second exception: the unattended inbox. A game dropped in inbox/ from any computer must
reach the library by itself, so a scheduled task runs inbox --apply --unattended every 15
minutes with nobody watching. What it can do is bounded: it only adds to the library and never
overwrites a file there (the one replacement, a newer PS4 update, is done as an attended run does
it), the originals it moves stay in _done/ for 7 days, and it never acts on an item that is
still being written (the item must hold still for 5 minutes across runs). It exits non-zero only
for news. See Unattended inbox.
No other destructive command runs unattended.
The third exception: deleting a game from the library UI. serve is a server, not a
command, but a deletion moves data the user owns out of the library, so it follows this rule
with the page in place of the terminal: a delete request first answers with its plan (every file
and its size, the media, the gamelist entry, the whitelist lines per console, the saves that
stay) and acts only when the same request comes back with the plan’s expect, which is what the
user’s confirmation sends. The confirmation plays the role of --apply, and a plan that changed
in between is refused. What it can do is bounded: it moves, never deletes, the files of one whole
game into trash/ at the hub root, re-checking each path right before moving it; it refuses
while the inbox lock is held and refuses an arcade set that others depend on; it never touches
saves; and it removes a console’s whitelist lines only once that console has received the
deletion. The trash keeps each entry 7 days for a restore. Its purge after that runs by itself,
like the inbox’s purge of _done/, and removes only what a confirmed deletion moved there. See
Deleting a game.
Convergent commands write by default and accept --dry-run. They bring the machine to
the state the config and the profile describe: running one again changes nothing, and what
they change is either warpzone’s own (Syncthing folders it prefixes with wz-, its units,
scripts and state files, symlinks it made) or a file that an emulator or the frontend owns,
which they edit on one key or one line, with a backup first and never while that program runs.
The frontend’s gamelists are the exception: frontend refresh regenerates each whole from the
hub’s copy with the player’s fields carried over, so it keeps a backup only of a gamelist that
cannot be read (see Frontend artwork).
They are provision hub, provision device, frontend refresh, play-state sync,
links sync, saves convert, scrape (which only adds gamelist entries and media files, with a backup of the gamelist before its first change, and with --refresh-text also replaces the name, description and genre of existing entries, with the same backup; scrape --unattended is the same command run by a scheduler once a night, a note and not a third rule: see Unattended scrape), settings apply, settings capture (which writes only the keys the user
chooses), catalog (which writes only catalog/) and whitelist migrate (which keeps a backup
of each whitelist and proves the included paths unchanged) and whitelist restore (which keeps a backup
of the whitelist it replaces). --dry-run says what they would do and writes nothing. self-update is the
timer’s own convergent step and takes no --dry-run: it moves the clone to a release that
passes the checks, and goes back to the last good one when it fails (see
Self-update). self-update --channel stable|rc is
convergent like the others: it edits one line of the device’s config (with a backup
config.toml.bak-<date>) and channel= in the updater’s settings, and takes --dry-run, which
it accepts only with --channel.
Taking a device off a hub folder is convergent, not destructive: no file is deleted or moved on either side, the same run with the device subscribed shares it again, and only a person runs it.
serve is a server, not a run: it writes only on request, one device whitelist at a time,
with the convergent rule’s safeguards (a backup of the file it replaces, refused when the file
changed since the client read it, a re-check right before the rename) and a dry_run on every
request instead of --dry-run. Its restore of a whitelist backup is the same guarded write. Its
deletion of a game is the destructive exception above.
Read-only commands never write user data: check, bios, doctor, health, status,
render-ignores and settings audit.
A new command that deletes or moves user data is destructive and follows the first rule; anything else follows the second. Either way, never overwrite or delete user data without a re-check right before acting.
Idempotency rules for provision
Section titled “Idempotency rules for provision”- Existing
wz-*folders are updated in place withPATCH, only for the keys warpzone owns (label,path,type,devices,versioning,fsWatcherEnabled, andrescanIntervalSon whitelisted device folders). Unknown keys are left alone.devicesis merged: missing subscribers are added; on the hub a configured device that no longer subscribes is taken out; every other entry is kept with all its fields. - Folders not prefixed
wz-are never touched. - Changing a folder’s
pathon an existing folder is refused (it would make Syncthing see a mass delete); the user is told to remove the folder first. The one exception is a save folder whose old path the profile lists inprevious_pathsand whose old directory is empty or fully on the hub: it is removed from Syncthing and added again at the new path, after a second check right before and with the hub device paused in the console’s Syncthing meanwhile (seeprevious_pathsindevelopment/design/profiles.md). - Devices are never removed from Syncthing by warpzone; only
provision hubtakes a configured device off a hubwz-*folder it no longer subscribes to.