Commit Graph
78 Commits
Author SHA1 Message Date
Claude ea63314ba7 Durcit la sécurité du backend et du player
Proxy /api/xtream :
- Authentification de session rétablie (Authorization ou cookie HttpOnly
  session — les requêtes navigateur même-origine le portent) ; le proxy
  était volontairement ouvert, offrant un rebond SSRF non authentifié
- Redirections suivies manuellement avec revalidation à chaque saut
  (hôte privé interdit + allowlist de domaine) : avec followRedirects,
  seule l'URL initiale était validée, une 302 amont suffisait pour
  atteindre un hôte interne
- Erreurs proxy sans détail d'exception (ClientException porte l'URL
  amont, credentials Xtream inclus), logs redactés

Logs :
- redactedLogRequests remplace logRequests() de shelf : l'URI de
  /api/xtream/<url> écrivait username/password Xtream en clair à chaque
  requête, annulant l'effort de LogRedactor partout ailleurs
- Les 500 d'epg_api ne renvoient plus e.toString() au client (même
  risque ClientException) ; détail redacté en log serveur

Middleware :
- X-Forwarded-For honoré uniquement depuis un proxy de confiance
  (loopback + RFC1918 par défaut, surchargables via TRUSTED_PROXIES) :
  un client direct forgeait l'en-tête et contournait le rate limit
  global comme la limite de tentatives de login
- Honeypot comparé sur chemin exact/préfixe : l'ancien
  contains(trap.replaceAll('/','')) bloquait toute URL contenant
  console, env ou wpadmin, y compris des URLs proxifiées légitimes

Comptes :
- Mot de passe admin initial aléatoire (Random.secure, affiché une fois
  au démarrage) ou ADMIN_INITIAL_PASSWORD ; fini le admin/admin persistant
- Longueur minimale de 8 caractères à la création et au changement

Divers :
- CleanupService ne cible plus Directory.systemTemp en récursif (il
  supprimait les temporaires de la VM Dart et le parent des sessions HLS)
- web/xf-player-core.js : postMessage vers location.origin au lieu de
  '*', et filtrage d'event.origin à la réception (le côté Flutter le
  faisait déjà)

Validé : dart analyze (0 issue) et dart test (48/48) sur bin/.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_015oEu9QayWsw7hCKhenxgVa
2026-08-27 12:19:58 +00:00
MichaelandClaude Opus 5 de49e8b34d fix(player): rebasculer sur HLS quand la piste audio n'est pas démuxable
mpegts.js ne démuxe que l'AAC et le MP3. Une chaîne diffusée en E-AC3
(stream_type 0x87) ou en AC-3 (0x81) était donc lue sans aucune piste audio,
sans erreur ni avertissement : l'image passait, le son était simplement absent.
Les journaux le montrent au PMT — "pid_stream_type":{"256":27,"257":135} avec
un "common_pids" réduit au seul h264, là où les flux audibles annoncent
"257":15 pour l'AAC.

L'évènement MEDIA_INFO porte l'information : quand il arrive sans piste audio,
le lecteur détruit la session MPEG-TS et rejoue la même chaîne par
/api/live/<id>/source/playlist.m3u8. Le préréglage source garde la vidéo en
copie de flux et ne réencode que l'audio, en AAC — le coût processeur reste
négligeable. La bascule n'est tentée qu'une fois par lecture, et seulement sur
une URL live directe.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 11:15:17 +02:00
MichaelandClaude Opus 5 1feeaae78a feat(design): Warm Cinema theme + event-driven adaptive players
Replaces the Projector Noir palette with "Warm Cinema" and rebuilds the
web players around a shared, event-driven engine.

Design
- app_colors: warm charcoal (#0B0908), cream (#F3E9DF), ember (#D9541F);
  adds posterScrim/heroScrim gradients, lift()/emberFocus() shadows,
  const cream-alpha tokens replacing Colors.whiteNN, and primaryFill,
  a deeper ember reserved for text-bearing fills so white labels clear
  the 4.5:1 AA threshold that #D9541F alone does not
- app_theme / mobile_theme: Fraunces (display serif) + Karla (body),
  tighter radii, 20+ component themes
- glass_container: opaque layered surfaces replace the blurred glass
- themed_loading_screen restyled; players and boot splash follow

Performance
- drop every BackdropFilter: backdrop blur forced a full framebuffer
  read per frame per card, the main source of scroll jank
- bundle Fraunces/Karla as assets so google_fonts stops fetching from
  fonts.gstatic.com at startup
- bound image decode size on 12 sites: a 40-poster grid drops from
  ~240 MB to a few tens of MB of GPU memory

Players (new shared engine: web/xf-player-core.js)
- start on media events instead of polling the buffer every 100-200 ms
- hls.js/mpegts.js loaded on demand, so ~213 KB of mpegts is never
  fetched for HLS streams
- liveSyncDurationCount 10 -> 2, startFragPrefetch on, testBandwidth
  off, MPEG-TS initial stash 512 KB -> 64 KB
- adaptive escalation fast -> balanced -> safe after repeated stalls in
  a 60 s window, applied live for HLS so there is no visible cut

Preserved from the recent streaming work on main: server-side quality
selection, stable player viewId, the turbo direct MPEG-TS path, vendored
library cache headers and the CI/Docker changes. Only the theme layer and
the player front-end were replaced; GlassCard stays in ui_components.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-10 21:42:56 +02:00
MichaelandClaude Fable 5 e332895d7d feat(design): Projector Noir theme - tungsten amber on film-black
Full visual refonte replacing the generic neon-blue glass look:

- palette: warm film-black surface ladder, tungsten amber primary,
  warm taupe secondary, verdigris teal tertiary; semantic and
  category colors retuned to match (coral live, gold movies)
- typography: Syne (display/headlines) + Instrument Sans (body/UI)
  replace Space Grotesk/Inter/Outfit across all screens
- glassmorphism tokens warmed (amber inner glow, warm-white borders)
- web player theme.css + index.html loader mirror the new tokens
- hardcoded Colors.blue* in streaming settings and recordings tabs
  now use AppColors tokens
- DESIGN_SYSTEM.md updated to v3.0 Projector Noir

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 14:52:45 +02:00
MichaelandClaude Fable 5 92634dba13 perf: faster stream startup
- Stop sending no-store on vendored player libraries: hls.min.js and
  mpegts.min.js (~750 KB) were re-downloaded on every player open
- hls.js: start with 1 live segment instead of 3, lower buffer-first
  threshold 1.5s -> 0.8s, poll buffer every 100ms
- mpegts.js: initial stash 512KB -> 128KB, start at 0.5s buffered
- Live FFmpeg: -hls_init_time 1 closes the first segment after ~1s

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 11:23:32 +02:00
MichaelandClaude Fable 5 60d3f42901 feat: security hardening, streaming overhaul, design polish, tests
Security:
- Replace unsalted SHA-256 password hashing with bcrypt (lazy rehash on login)
- Add authenticated /api/xtream-api gateway: Xtream credentials are injected
  server-side and never sent to the frontend; /api/playlists no longer
  returns passwords
- Redact credentials from all logs (login body, proxy/FFmpeg/scheduler URLs)
- Add auth to recordings, EPG, season-passes and streaming routes
  (HttpOnly session cookie for hls.js; loopback bypass for local FFmpeg)
- Lock player postMessage to same-origin in both directions
- Vendor and pin hls.js 1.6.7 / mpegts.js 1.7.3 (drop CDN @latest)
- Fix rate limiter (client IP was never resolved), add login rate limit,
  restrict CORS, add CSP Report-Only, block private-IP SSRF targets,
  fix path traversal in recording log retrieval, chmod 777 -> 770
- Remove dead HiveService (seeded admin/admin into IndexedDB with SHA-256)
- Fix authMiddleware not populating 'user' context (getPlaylist ignored the
  logged-in user; admin purge always returned 403)

Streaming:
- New FfmpegSessionManager: process registry, idle reaper (4 min live /
  15 min VOD), orphan cleanup at startup, clean SIGTERM shutdown,
  fast-fail with stderr instead of 30 s timeout
- Quality selection (source/high/medium/low) for live and VOD; source mode
  streams with -c:v copy (zero transcoding); selector wired into the player
- Concurrent recordings (MAX_CONCURRENT_RECORDINGS, default 2); conflicts
  retry on the next tick instead of silently failing
- Lower live latency (HLS window 20 -> 10 segments, liveSync 10 -> 3)
- Fix recording log lookup (.mp4 vs .mkv mismatch)

Design:
- Replace hardcoded colors with AppColors tokens (12 files)
- web/theme.css syncs HTML players with the Flutter palette
- DPAD/keyboard navigation (arrow-key focus, player shortcuts)
- Tooltips on player icon buttons, Semantics on content cards
- Remove 7 dead widgets broken since the Stitch merge

Quality:
- bin/test/: 21 unit tests (bcrypt, redaction, traversal, SSRF, recording
  conflicts) plus a quality-selector widget test
- GitHub Actions CI (analyze + test + build web)
- Archive stale status docs into docs/archive/

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-06-10 10:07:18 +02:00
MichaelandClaude Opus 4.7 cb5eca7547 fix: add set_volume handler to player_lite.html for mute toggle
player_lite (Live TV desktop) ignored set_volume messages from Flutter,
so mute/unmute button had no effect. Added handler matching player.html.

Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
2026-05-03 08:40:48 +02:00
Michael e641d04a3a feat: implement streaming handler with FFmpeg-based live and VOD HLS transcoding support 2026-04-01 21:35:25 +02:00
Michael ddb8110c40 feat: add mobile scaffold layout and dedicated mobile video player implementation 2026-03-29 12:07:14 +02:00
Michael 36a7658cf9 feat: add mobile-optimized video player and streaming API handler 2026-03-29 11:47:09 +02:00
Michael db2eab0e66 feat: add mobile-optimized IPTV player with HLS and MpegTS support 2026-03-29 10:36:37 +02:00
Michael fa6ae90d8d feat: add mobile-optimized IPTV player with HLS and MpegTS support 2026-03-29 10:19:36 +02:00
Michael 2f7d709fe6 fix(player): finalize Buffer-First strategy in player_lite.html 2026-03-10 22:13:41 +01:00
Michael 893ae7b03a perf(player): switch to Buffer-First strategy to eliminate chaotic startup and micro-cuts 2026-03-10 22:08:20 +01:00
Michael 118887ab6f perf(player): add MpegTS auto-recovery and optimize initial buffer to prevent Stream Error 2026-03-10 22:02:44 +01:00
Michael b8922a2f08 perf(player): optimize desktop players for micro-cuts and stability 2026-03-10 22:02:13 +01:00
Michael 2ef1db8a68 perf(proxy): enable Keep-Alive and playlist caching to fix 5s zap delay; tuned mobile player for micro-cuts 2026-03-10 22:01:52 +01:00
Michael 79fae261aa perf(player): implement Turbo Start for faster zapping while maintaining stability 2026-03-10 21:55:11 +01:00
Michael 9e97f45046 feat(player): increase buffering and stability for HLS and MPEG-TS 2026-03-10 21:30:02 +01:00
Michael a8d2a5446d perf: implement robust playback stabilization to fix choppy video
- Increased MPEG-TS stashInitialSize to 1MB for better jitter resistance
- Enabled HLS.js discontinuity nudging to prevent freezing on corrupt segments
- Smoothed latency chasing with 1.1x playback rate
- Increased HLS sync distance to 6 segments for improved stability
2026-03-10 19:25:02 +01:00
Michael df4bcfd07f fix: stabilize IPTV playback and implement request throttling
- Add playback lock to XtreamService to delay EPG during stream init
- Increase MPEG-TS stash buffer to 512KB for better stability
- Enable liveBufferLatencyChasing to prevent stream drift
- Tune HLS parameters for balanced speed and reliability
2026-03-10 18:54:44 +01:00
Michael 0ca6f96710 feat: implement Turbo-Start stream acceleration
- Add direct MPEG-TS support and optimized HLS tuning
- Implement low-latency sync and instant bitrate selection
- Achieve TiviMate-like zapping speed by reducing initial buffers
2026-03-10 18:41:46 +01:00
Michael 736ab0f51c chore: optimize IPTV performance and fix navigation Loop
- Revert aggressive caching in XtreamService (use forceCache + 1h stale)
- Adjust HLS.js buffers (60s-120s) for stream stability
- Fix desktop navigation loop in PlaylistSelectionScreen
- Fix receive timeouts (revert to 30s/60s)
2026-03-10 18:28:10 +01:00
Michael 33d0e0a80d fix(streaming): optimize quality, audio sync, and content update refresh
- Increased FFmpeg video quality to 8Mbps and audio to 192kbps.
- Added audio resync filters and better presets.
- Optimized HLS buffer settings for mobile players to reduce interruptions.
- Reduced API cache duration to 15m and added refresh support for faster content updates.
2026-03-10 10:26:24 +01:00
Michael a256ca87b6 fix(player): resolve Safari infinite loading by refining play overlay and loading logic 2026-03-09 23:05:10 +01:00
Michael dbb6559640 fix(player): restore missing stream variables in player_mobile.html to fix infinite loading 2026-03-09 22:56:27 +01:00
Michael 3ef4884336 feat(player): remove non-functional fullscreen button as requested 2026-03-09 22:52:05 +01:00
Michael 0ae4946816 feat(player): standardize Safari compatibility fixes across all player versions 2026-03-09 22:43:51 +01:00
Michael 105496d243 feat(player): improve Safari/iOS compatibility with manual play overlay and robust loading 2026-03-09 22:40:58 +01:00
Michael 19a0755e01 feat(mobile): dedicated mobile player and responsive UI improvements 2026-03-09 22:14:33 +01:00
Michael b69e9d1812 fix(mobile): optimize player UI for mobile portrait and tune HLS buffering 2026-03-09 21:56:56 +01:00
Michael 441597354e fix(mobile): fix orientation reset with IndexedStack, support HLS in Lite player, and optimize fullscreen 2026-03-09 21:35:00 +01:00
Michael 13647a35da feat: Implement TV recording management with API endpoints, a data model, and a scheduling service that uses FFmpeg to record streams. 2026-03-09 16:46:45 +01:00
Michael 2d418e4e0c feat: Add playlist selection screen and basic web IPTV player. 2026-01-01 18:32:39 +01:00
Michael c165ff5d40 feat: Implement IPTV player screen with web iframe integration for live and VOD streams, utilizing player_lite.html for live TV. 2026-01-01 18:26:05 +01:00
Michael 79ad1243fa feat: Add a themed loading screen widget and a web-based HLS/MPEG-TS video player. 2026-01-01 18:21:54 +01:00
Michael 3f9a88c09a feat: Implement Xtream Codes IPTV streaming, VOD transcoding, and content browsing UI with a dedicated web player. 2025-12-15 21:18:36 +01:00
Michael 6d69617e40 feat: Add local Docker test environment setup with PowerShell script and Docker Compose. 2025-12-15 20:56:17 +01:00
Michael 01d0e97961 feat: add web-based streaming player with HLS/MPEG-TS support and streaming API handler 2025-12-15 17:00:55 +01:00
Michael 2c0725590e feat: Add initial IPTV player with web-based playback and streaming API. 2025-12-15 13:01:24 +01:00
Michael 2ca8f5e969 feat: introduce server with API, HLS streaming, Xtream proxy, and player UI 2025-12-14 22:32:15 +01:00
Michael d46714c9bc feat: Add new HTML player pages for streaming video with HLS and MPEG-TS support. 2025-12-14 22:07:07 +01:00
Michael 2eb3304a2b feat: introduce Xtream Codes API service for IPTV content access and streaming. 2025-12-14 21:48:37 +01:00
Michael ee707d3cf9 feat: implement IPTV player screen for live, VOD, and series streams with integrated controls and state management. 2025-12-14 18:47:00 +01:00
Michael bffef49554 feat: Implement HLS streaming with file serving and FFmpeg transcoding for live and VOD content. 2025-12-14 18:26:44 +01:00
Michael a7ca1a087f feat: add Xtream service for IPTV integration and a lite player HTML file. 2025-12-14 16:43:23 +01:00
Michael 781f58cb38 feat: Add IPTV player HTML pages with HLS/MPEG-TS support and parent communication. 2025-12-14 16:24:20 +01:00
Michael b2298a9bf4 feat: Add initial IPTV player with HLS.js and mpegts.js support, including UI and parent communication. 2025-12-14 16:05:30 +01:00
Michael 5b0ae63290 feat: Add Xtream Codes API service for managing playlists, streams, and channels, including caching and proxy handling. 2025-12-14 09:13:53 +01:00
Michael 0644f376db feat: implement Xtream Codes API service for managing IPTV connections, streams, and channel data. 2025-12-14 00:17:13 +01:00