Commit Graph

3 Commits

Author SHA1 Message Date
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