Media tab (needs at least one folder, hidden otherwise):
- Folders from [media] roots in config.toml, default = the user's Music, Videos
and Pictures (XDG, never $HOME); [] disables the tab
- Icons per type, subfolders, breadcrumb, back, refresh, All/Sounds/Images/
Videos filter; a tap opens the file on the PC (WebSocket system/open_media)
- Three special launchers (audio, image, video), editable on /admin: system
default (gio open), installed application (gio launch) or a raw command
(allow_custom_command); the file path is appended as the last argument
- The client never sends an absolute path: (root, relative path) is resolved
server side; refuses "..", hidden entries, symlinks leaving the root, and
anything but known media extensions (a script renamed .mp3 is refused)
- GET /api/media (Bearer token), listing runs in a thread, 1000 entries max
Interface cache: pages are revalidated (Cache-Control: no-cache) and static
files are served under /static/<version>/ (immutable cache), so a tablet can
no longer keep an old interface after an update. Reproduced and verified:
opening the same link serves the cached page, one refresh fixes it for good.
Refactors: restapi.py (shared REST helpers), AppPicker (shared by the launcher
and opener forms on /admin).
Tests: 159 (library escapes, openers, admin API, config, cache headers). Also
checked end to end with a real server (fake gio recording its arguments) and
headless Chromium. Not tried on the real tablet.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>