Skip to content

v0.3.0 — a local control API, with its own reference

Choose a tag to compare

@PortableDiag PortableDiag released this 13 Sep 16:34
· 14 commits to main since this release

A local HTTP control API, so agents and other programs can do everything the window does: open a folder or a playlist, play, pause, seek, skip, change every mode, rate a track, change the three playback settings, quit.

Off by default. Switch it on under the gear button → Remote control API, where the port and the key sit beside the switch.

KEY=$(gapless --api-key)
curl -s -H "Authorization: Bearer $KEY" http://127.0.0.1:8421/api/docs

It documents itself. docs/API.md is compiled into the binary and served at GET /api/docs (?section= narrows it), so the reference can never describe a different version than the one answering you. GET /api is a one-line index of every route. Pointing something at the port and the key is enough to get it started.

Not MPRIS, which is unchanged. MPRIS is the right interface for media keys and a lock screen and the wrong one for scripting: a caller needs a bus connection and bindings, its vocabulary is fixed by the spec so silence trimming, crossfade length, the interior-silence cap, ratings and favorites shuffle have nowhere to live in it, and its Shuffle is a bool where this player has three states.

Security. Loopback only. Every route needs the key — there is no unauthenticated endpoint, not even a health check. The key is 32 bytes from /dev/urandom, mode 0600, compared in constant time.

Fixed

Loading a folder could hang the whole application — introduced with the rating context menu in v0.2.0. load_source cleared the track list with first_child(), and a GtkListBox's children are not all rows: the rating popover is parented to it, so the loop never terminated. Found by the new API harness on its first POST /api/open, not by using the app.

Verification

verify.sh 6/6 · verify-resume.sh 4/4 · verify-mpris-modes.sh 3/3 · verify-api.sh 41/41 · cargo test 29/29