Dispatcharr/apps
Cédric Marcoux b6bbd39469 fix(timeshift): PATH-first catch-up + strict-UTC API surface with proxy-time provider timezone conversion
Two coupled fixes that make catch-up play the requested programme:

1. Try the PATH catch-up form (/timeshift/.../{start}/{id}.ts) BEFORE the
   timeshift.php query form. Empirical testing showed some XC providers
   return the LIVE stream on the query form (HTTP 200, silently ignoring
   `start`) — a valid MPEG-TS indistinguishable from a real archive, so the
   cascade accepted it and the user always got live content. The PATH form
   actually seeks. Candidate ordering now lives in
   build_timeshift_candidate_urls() with the full rationale.

2. Strict-UTC XC API surface + single proxy-time timezone conversion:
   - xc_get_epg start/end always UTC, server_info.timezone always "UTC",
     time_now UTC — the timezone triple is consistently UTC.
   - Removed the global default_timezone setting and the
     _convert_xmltv_to_local_timezone rewrite entirely.
   - The proxy converts the client's UTC timestamp to the SERVING provider's
     own zone (server_info.timezone captured on account refresh, read from
     the account's default profile) right before building the upstream URL —
     DST-correct via ZoneInfo, no-op for UTC/unknown zones. Verified against
     a real provider: it interprets the URL timestamp as its LOCAL wall
     clock, so pure UTC pass-through seeks 1-2h off.
   - EPG duration lookup keeps the ORIGINAL UTC timestamp (programmes are
     stored in UTC) — exactly one conversion in the whole chain.

Also per review feedback:
- Removed the debug_logging toggle — verbose timeshift logging now follows
  the standard logger DEBUG level (DISPATCHARR_LOG_LEVEL).
- Removed the dead default_language setting (never read anywhere; the EPG
  lang field is hardcoded). TIMESHIFT_DEFAULTS is down to
  xmltv_prev_days_override, and the Settings UI shows that single field
  with accurate help text.
- Validate the timestamp up front (400 on malformed input) instead of
  forwarding it verbatim into the upstream URL.
- Redact the upstream URL in the connection-error log (requests exceptions
  embed the full URL, which carries XC credentials).
- URL-encode XC credentials in both URL builders.
- Request identity encoding upstream (the TS-sync peek reads raw bytes).
- Poll the stop key on the 5-second heartbeat cadence instead of every 100
  chunks (~25 MB), so stream-limit terminations free the provider slot fast.
- New tests: proxy timestamp wiring (converted value reaches the URL
  builder, original UTC value reaches the duration lookup), _redact_url,
  decisive 3xx break (anti ban), invalid timestamp rejection; deflaked the
  format-cache promotion test (django cache persists across runs).
2026-06-10 22:04:44 +02:00
..
accounts feat(auth): add QueryParamJWTAuthentication for token retrieval via query parameters 2026-05-30 11:14:59 -05:00
api initial connect feature 2026-02-08 09:29:22 -05:00
backups refactor(backups): simplify PostgreSQL engine check in _is_postgresql function 2026-05-30 20:18:50 -05:00
channels Merge remote-tracking branch 'upstream/dev' into feat/timeshift-native-v2 2026-06-10 08:42:33 +02:00
connect fix: replace fork()-based subprocess with posix_spawn at all uWSGI spawn sites 2026-05-15 16:45:09 -05:00
dashboard modified database fields for consistency, removed custom_url from streams (no longer needed) 2025-03-16 09:07:10 -04:00
epg fix(epg): resolve EPG channel list refresh issue after parsing completion 2026-06-07 09:56:25 -05:00
hdhr fix(api): update HDHR URLs to use port-aware URI builder 2026-06-07 14:27:57 -05:00
m3u Merge remote-tracking branch 'upstream/dev' into feat/timeshift-native-v2 2026-06-10 08:42:33 +02:00
output fix(timeshift): PATH-first catch-up + strict-UTC API surface with proxy-time provider timezone conversion 2026-06-10 22:04:44 +02:00
plugins migrate official plugin repo URL to GitHub Pages 2026-06-03 12:36:07 -04:00
proxy Merge remote-tracking branch 'upstream/dev' into feat/timeshift-native-v2 2026-06-10 08:42:33 +02:00
timeshift fix(timeshift): PATH-first catch-up + strict-UTC API surface with proxy-time provider timezone conversion 2026-06-10 22:04:44 +02:00
vod Merge pull request #1287 from nemesbak/fix/vod-metadata-director-cast-releasedate 2026-05-29 21:32:39 -05:00