fix(m3u): use non-blank archive-days helper in the player

`epgArchiveDays` used `tvg.rec ?? timeshift ?? catchup.days`, but `??` does not
skip an empty string — the common `tvg-rec=""` default stopped the chain and
yielded 0, which the timeline treats as an unbounded catch-up window, so a
channel with a real `timeshift`/`catchup-days` could offer "Watch" on
programmes older than its actual archive. Use the shared `getM3uArchiveDays`
(non-blank + correct precedence), matching the unified live tab. (Codex P2)

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
4grayandClaude Opus 4.8 committed 2026-07-01 15:52:59 +02:00
1 parent 23f20a1a30
commit a4251d881c
2 files changed
+24 -7

No files matched your search

@@ -66,6 +66,20 @@ describe('catchup.utils', () => {
).toBe(7);
});
it('skips a blank tvg-rec and uses a real timeshift value', () => {
// `tvg-rec=""` is a common parser default; a nullish (`??`) chain would
// stop on it and yield 0 (unbounded window). The non-blank helper skips
// it and returns the real timeshift days.
expect(
getM3uArchiveDays({
...baseChannel,
catchup: undefined,
timeshift: '7',
tvg: { ...baseChannel.tvg, rec: '' },
})
).toBe(7);
});
it('supports legacy same-stream shift playback when catchup type is shift', () => {
expect(isM3uCatchupPlaybackSupported(baseChannel)).toBe(true);
expect(resolveM3uCatchupUrl(baseChannel, archivedProgram, 1_775_820_000))