5 Commits

Author SHA1 Message Date
Denis Defolie 6c1a7efb0d Media tab: sort by name, date or size, and thumbnails for videos and sounds
The listing now returns the date (v) and size of every file, not just of
images. A selector next to the type filters sorts files by name (natural
order, default), date (newest first) or size (largest first), client side;
folders stay first and the choice is remembered on the tablet.

Video and sound tiles now request /thumb like images (the server already
made them). The existing icon fallback covers a sound without a cover.
Audio and video tiles with a thumbnail get a border in their type colour.

Tests: listing date and size, a Chromium sort test with three files whose
name, date and size orders all differ (kept after reload), and a
thumbnail test with real ffmpeg. Both UI tests were checked to fail when
the feature is reverted.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-30 16:57:29 +01:00
Denis 6bd8cbc822 Add [media] follow_symlinks and list make qr in the quick start
follow_symlinks (default true) keeps the new behaviour of following links
wherever they point; false restores the strict rule: only links whose target
stays inside the configured folder are followed, the search does not walk
linked folders, no picture is taken from outside the root and players are not
matched to a library file through a link.

The README (fr/en) quick start now lists `make qr`, next to `make url`.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 16:58:14 +01:00
Denis 167a4c674b Media tab: follow symbolic links wherever they point
Folders kept on another disk and linked from a configured media folder
(~/Videos/Cinema -> /datadisk/...) were hidden by the rule that the real path
must stay inside the root.

- Links are followed when listing, opening, searching and making thumbnails.
  What still bounds access: no absolute path, "..", or hidden component from
  the client, a closed list of extensions, and the type taken from the real
  file (lien.mp3 -> script.sh stays refused).
- Search follows links without scanning a folder twice (loops, second link to
  the same folder) and reports results under their link path.
- Players receive the path under the root, links kept (MediaLibrary.open_path),
  so the path they announce over MPRIS still maps to a library file (title and
  picture); locate() also resolves paths reached through a link.
- The picture next to a media file is looked up beside the real file.
- Tests for each case, including the path given to the player; docs updated.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 16:50:37 +01:00
Denis 1de5685338 Add thumbnails, name search and a title/image in the Playing tab; keep player controls visible
- Thumbnails (ffmpeg, optional): square crops of images, a frame or poster of
  videos, embedded or folder cover of sounds, cached on disk; /thumb route
  protected by the token like /art. [media] thumbnails = false disables it.
- Name search in the Media tab (server side, accents and case ignored, all
  words required, bounded by result count, scanned entries and time).
- Playing tab: title and picture for files of the library (also when the
  player gives none), and a "last opened file" card when no player runs.
- The player controls and the volume bar never leave the visible area:
  sticky controls and height breakpoints; tests/test_ui_layout.py measures
  13 window sizes in a real Chromium driven over DevTools (tests/uidriver.py).
- Static files are served under /static/<version>/ and pages are revalidated,
  so a tablet no longer keeps an old interface from its heuristic cache.
- Documentation (README fr/en, CLAUDE.md, config.example.toml, make deps).

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-10-26 16:28:14 +01:00
Denis 5921b7c414 Add the Media tab: browse sound, image and video files and open them on the PC
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>
2026-10-26 13:32:37 +01:00