Skip to content

fix(m3u): preserve catchup seek parameter names#473

Merged
stackia merged 3 commits into
mainfrom
codex/fix-catchup-seek-rewrite
May 8, 2026
Merged

fix(m3u): preserve catchup seek parameter names#473
stackia merged 3 commits into
mainfrom
codex/fix-catchup-seek-rewrite

Conversation

@stackia
Copy link
Copy Markdown
Owner

@stackia stackia commented May 8, 2026

Summary

Fixes a 3.12.0 catchup rewrite regression where M3U catchup-source URLs using a meaningful single range seek parameter such as tvdr=begin-end were rewritten to playseek=begin-end before reaching the built-in web player.

Root Cause

The URL template refactor introduced a unified playseek carrier for all dynamic catchup query templates. That is still needed for path templates and split query templates so the server can resolve placeholders and apply seek offsets, but it was too broad for single range seek parameters that the server already understands or that are explicitly declared with r2h-seek-name.

Changes

  • Preserve tvdr=begin-end in rewritten M3U catchup URLs.
  • Preserve custom single range seek parameters when the source URL declares the same name via r2h-seek-name.
  • Keep playseek=begin-end as the carrier for path templates and unrecognized query template parameters.
  • Preserve existing RTSP semantics where configured r2h-seek-name selects what to consume but does not rename a request-supplied playseek parameter.
  • Strip URL-supplied r2h-token from upstream HTTP and RTSP requests, case-insensitively.

Validation

  • git diff --cached --check
  • cmake --build build -j$(getconf _NPROCESSORS_ONLN)
  • ./scripts/run-e2e.sh -p 1 test_url_template.py
  • ./scripts/run-e2e.sh -p 1 test_rtsp_seek_mode.py
  • ./scripts/run-e2e.sh -p 1 test_http_proxy.py
  • ./scripts/run-e2e.sh -p 1 test_m3u.py
  • ./scripts/run-e2e.sh -p 1 test_auth.py

Fixes #471

@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-473.eastasia.1.azurestaticapps.net

@stackia stackia force-pushed the codex/fix-catchup-seek-rewrite branch from 8b48eec to 27960b7 Compare May 8, 2026 14:51
@stackia stackia marked this pull request as ready for review May 8, 2026 14:51
Copilot AI review requested due to automatic review settings May 8, 2026 14:51
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-473.eastasia.1.azurestaticapps.net

@stackia stackia changed the title [codex] Fix M3U catchup seek parameter rewrite fix(m3u): preserve catchup seek parameter names May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes a regression in M3U catchup URL rewriting where single “range” seek parameters (e.g., tvdr=begin-end) were being rewritten to playseek=... before reaching the built-in web player, while keeping playseek as the carrier for path templates and unrecognized query-template params. Also ensures URL-supplied r2h-token does not leak upstream (HTTP/RTSP) case-insensitively.

Changes:

  • Extend URL template analysis to detect “single range seek param in query” and preserve the original/bound seek parameter name when appropriate (tvdr or explicitly declared via r2h-seek-name).
  • Update M3U catchup query injection to use the preserved seek param name (falling back to playseek).
  • Strip r2h-token from upstream HTTP/RTSP URLs case-insensitively; add E2E coverage for seek-name semantics and token stripping.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
src/url_template.h Adds analysis fields to track query range param + chosen seek param name.
src/url_template.c Detects range templates in a single query param; selects seek carrier name based on builtin/explicit seek-name.
src/m3u.c Uses analyzed seek param name when generating catchup template query (tvdr=... vs playseek=...).
src/service.c Makes query-param matching case-insensitive and strips r2h-token from upstream RTSP/HTTP URLs.
e2e/test_url_template.py Adds tests ensuring tvdr and explicit custom seek names are preserved in rewritten M3U catchup-source URLs.
e2e/test_rtsp_seek_mode.py Adds tests ensuring configured seek-name doesn’t remap request playseek, and r2h-token doesn’t leak to RTSP upstream.
e2e/test_http_proxy.py Adds test ensuring r2h-token is stripped before upstream HTTP requests.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/url_template.c Outdated
- Remove copy_query_param_name, reuse copy_template_value instead
- Move query_param_name and query_param_has_range out of public struct
  into locals — they are internal bookkeeping for seek_param_name
- Treat overlong param names as "skip" instead of hard failure so
  analysis falls back to playseek gracefully
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-473.eastasia.1.azurestaticapps.net

1 similar comment
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 8, 2026

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-473.eastasia.1.azurestaticapps.net

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 7 out of 7 changed files in this pull request and generated no new comments.

@stackia stackia merged commit 00d8f91 into main May 8, 2026
5 checks passed
@stackia stackia deleted the codex/fix-catchup-seek-rewrite branch May 8, 2026 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3.12.0回看失效了

2 participants