Commit Graph
59 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 5b9eb74a84 feat(epg): source XMLTV de repli quand le panneau ne rend rien d'actuel
Le guide du fournisseur est figé sur beaucoup de revendeurs : sur le compte de
test, get_simple_data_table répond correctement mais le dernier programme
français date de deux jours, et le xmltv.php du panneau ne couvre aucune chaîne
française. Aucun correctif côté appel Xtream ne pouvait donc remplir la grille.

Nouveau service XmltvEpgService : téléchargement de dumps XMLTV publics,
décompression gzip détectée sur le nombre magique, parsing en flux via
XmlEventReader — un dump national fait 46 Mo décompressés, en charger l'arbre
DOM coûterait plusieurs centaines de mégaoctets dans le conteneur. Mesuré à
environ 1 s pour 973 chaînes. Index rafraîchi toutes les 6 h, programmes
terminés depuis plus de 6 h écartés à l'indexation.

L'appel sortant reste un dernier recours. L'ordre est inchangé —
get_simple_data_table, puis get_short_epg — et le dump n'est consulté que si
le panneau ne rend aucun programme couvrant l'instant présent : compter les
entrées ne suffisait pas, un guide périmé en renvoie des centaines. La source
se configure par EPG_XMLTV_URLS ; vider la variable supprime tout appel
sortant. La réponse porte un en-tête X-Epg-Source pour savoir qui a répondu.

Les identifiants sont rapprochés après normalisation : le dump écrit
France.2.fr là où le panneau annonce France2.fr. Repli sur le nom affiché de
la chaîne, et table stream_id vers identifiant EPG mise en cache 6 h.

Le client passe désormais par /api/epg au lieu d'appeler player_api.php en
direct. Il dupliquait le choix de l'action, la conversion des fuseaux et le
décodage base64 ; le backend le fait une fois, met en cache pour tous les
utilisateurs, et sait basculer sur le repli — bascule impossible depuis le
navigateur.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-11 10:48:10 +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
Michael e4301077b0 feat: implement HLS live streaming and VOD transcoding handler with FFmpeg and NVIDIA GPU support 2026-04-01 21:14:33 +02:00
Michael fa6ae90d8d feat: add mobile-optimized IPTV player with HLS and MpegTS support 2026-03-29 10:19:36 +02:00
Michael c57273be2c feat: Implement GPU-accelerated live HLS streaming with FFmpeg, including iOS optimizations and IPTV redirect resolution. 2026-03-09 14:10:13 +01:00
Michael 50a6998c09 feat: add EPG TV guide, season passes (auto-recording) and unified recordings/EPG tab with 3 sub-tabs 2026-03-09 08:21:48 +01:00
Michael 4c2e3ce600 feat: add stop recording button and POST /api/recordings/stop/<id> endpoint to kill FFmpeg process 2026-03-08 23:53:32 +01:00
Michael 7e0837374e refactor(recordings): eliminate Router/mount, expose direct handler methods to avoid shelf_router path collision 2026-03-08 22:10:59 +01:00
Michael d91be43f27 fix(backend): move GET /recordings/logs/<id> to main router to avoid shelf_router collision with DELETE /<id> 2026-03-08 21:42:53 +01:00
Michael 2180572b92 feat: implement live tv recording system 2026-03-08 08:40:55 +01:00
Michael 755367018a feat: Implement core server application with API routing, streaming, and static content serving. 2026-01-07 11:29:00 +01:00
Michael 1dd77bd87a feat: implement core server with API routing, middleware, and static file serving 2026-01-07 11:24:26 +01:00
Michael a149bf266c chore: add detailed login logging and update startup message 2026-01-07 10:39:06 +01:00
Michael 38572fa747 fix(auth): move auth check inside proxy handler after path filtering 2026-01-07 09:32:51 +01:00
Michael d1933f7500 merge: resolve Dockerfile conflict (kept optimization + nvenc support) 2026-01-07 08:44:50 +01:00
Michael 8df9a37baa feat: security overhaul (proxy ssrf fix, streaming sanitization, docker optimization) 2026-01-07 08:43:33 +01:00
Michael 71630d75e8 feat: Install FFmpeg with NVIDIA NVENC/NVDEC support via apt-get instead of a static build. 2026-01-03 10:26:17 +01:00
Michael ce82b9e824 feat: Implement API handlers for live and VOD streaming and create database module. 2026-01-01 20:13:56 +01:00
Michael 01d522613f fix: add Dart-pure PlaylistConfig for server and fix imports 2025-12-16 20:20:24 +01:00
Michael 57b7acbead feat: Implement streaming handlers for live MPEG-TS proxy and VOD HLS transcoding via FFmpeg, and add a release build script. 2025-12-16 07:39:33 +01:00
Michael 07ffb1b75f feat: Introduce backend server with live TV proxy, VOD HLS transcoding, and IPTV streaming settings UI. 2025-12-15 16:49:48 +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 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 61e0fa2435 feat: Add IPTV settings tab for managing category filters, streaming options, appearance, and admin access, and introduce a new server entry point. 2025-12-08 22:02:41 +01:00
Michael 689eb4adbc feat: Introduce a new Dart server application providing API, static assets, streaming, proxying, and a cleanup service. 2025-12-08 21:57:04 +01:00
Michael f5f70f73a6 feat: Implement initial server with API, streaming, Xtream proxy, and static file serving. 2025-12-08 21:47:10 +01:00
Michael 63846c090a feat: implement IPTV settings management with streaming and display preferences 2025-12-08 21:40:46 +01:00
Michael 5069e92bb7 feat: Implement core server infrastructure with API routing, static file serving, and security middleware. 2025-12-08 21:14:17 +01:00
Michael e95fdb534a feat: add new UI tabs for movies and series, including mobile-specific versions with search and pagination. 2025-12-08 20:43:41 +01:00
Michael 1e3e490e26 feat: Add initial server implementation with API routing, security middleware, and a file cleanup service. 2025-12-07 22:49:29 +01:00
Michael 4a829d316b feat: Add mobile settings tab UI with user profile, appearance, and streaming options 2025-12-07 15:44:22 +01:00
Michael 47eaf50e0c feat: implement core server with API routing, static file serving, Xtream proxy, FFmpeg streaming, and security middleware. 2025-12-07 15:34:36 +01:00
Michael b244f1f807 feat: introduce core server with API, media streaming, Xtream proxy, and player UI 2025-12-07 15:29:00 +01:00
Michael 7372f51b19 feat: add initial Dart server with API routing, authentication, streaming, and static file serving. 2025-12-07 15:21:29 +01:00
Michael 5ca08a50b5 feat: add security middleware for security headers, honeypot, and rate limiting to the server. 2025-12-07 10:39:46 +01:00
Michael 28d4bef661 feat: Initialize core database with user, playlist, and session management, and establish initial server and user API handler files. 2025-12-07 00:34:40 +01:00
Michael 4786ded67d feat: Implement server with API routing, static file serving, Xtream proxy, and streaming capabilities. 2025-12-06 19:13:10 +01:00
Michael 2c581bc8e5 feat: Implement core backend server with API, Xtream proxy, and streaming capabilities, and introduce IPTV player screen. 2025-12-06 17:48:50 +01:00
Michael 2517ac777a feat: add Xtream API data models, IPTV player screen, and server entry point 2025-12-06 17:39:05 +01:00
Michael 77dde5d7fd feat: add initial server infrastructure with API, static file serving, Xtream proxy, and streaming capabilities. 2025-12-06 17:28:25 +01:00
Michael d6b42512b6 feat: add initial Dart server implementation with API routing, Xtream proxy, static file serving, and streaming support. 2025-12-06 16:48:57 +01:00
Michael 5be7c0c3ff feat: implement IPTV player screen with FFmpeg transcoding for live streams, playback position tracking, and dedicated settings 2025-12-06 16:43:19 +01:00
Michael 33239ca11e feat: Implement Xtream API data models and live TV tab for IPTV functionality, including application icons. 2025-12-06 16:23:21 +01:00
Michael ec6108b747 feat: Implement core server logic including API routing, static file serving, Xtream proxy, and streaming capabilities. 2025-12-06 15:38:17 +01:00
Michael ebbf9217fc feat: add LiveTVTab widget for displaying categorized live TV channels with pagination. 2025-12-06 15:28:05 +01:00
Michael 5671afbd26 feat: Add IPTV player screen with FFmpeg transcoding, resume playback, and dedicated movie/series tabs. 2025-12-06 14:10:52 +01:00
Michael b9371bf368 feat: add core server with REST API, Xtream proxy, streaming, and watch history provider 2025-12-06 13:40:48 +01:00