Skip to content

feat(config): add relative M3U path option#575

Merged
stackia merged 4 commits into
mainfrom
codex/use-relative-path-in-m3u
Jun 25, 2026
Merged

feat(config): add relative M3U path option#575
stackia merged 4 commits into
mainfrom
codex/use-relative-path-in-m3u

Conversation

@stackia

@stackia stackia commented Jun 25, 2026

Copy link
Copy Markdown
Owner

Summary

Adds a new use-relative-path-in-m3u config option and matching --use-relative-path-in-m3u CLI flag. When enabled, generated playlist.m3u output and HTTP proxy M3U/HLS rewrites omit the http://host prefix and emit root-relative paths, preserving app-path-prefix when configured.

This also wires the option through OpenWrt UCI/LuCI, LuCI translations, iKuai packaging, sample config files, and the Chinese/English configuration docs.

Validation

  • cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_AGGRESSIVE_OPT=ON
  • cmake --build build -j$(getconf _NPROCESSORS_ONLN)
  • uv run pytest e2e/test_config.py::TestOptionSourcesAndPriority -v -n auto --dist loadscope
  • uv run pytest e2e/test_m3u.py::TestM3UURLRewriting e2e/test_http_proxy_m3u_rewrite.py::TestM3URewriteAbsoluteHTTP -v -n auto --dist loadscope
  • pnpm run docs:build
  • msgfmt -c -o /tmp/rtp2httpd.zh_Hans.mo openwrt-support/luci-app-rtp2httpd/po/zh_Hans/rtp2httpd.po
  • git diff --check

@stackia stackia requested a review from Copilot June 25, 2026 09:10
@stackia stackia marked this pull request as ready for review June 25, 2026 09:10
@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

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

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a new configuration/CLI toggle to make generated and rewritten M3U/HLS playlist URLs root-relative (optionally under app-path-prefix), instead of emitting absolute http://host/... URLs—affecting both /playlist.m3u generation and HTTP proxy playlist rewriting.

Changes:

  • Add use-relative-path-in-m3u config option and --use-relative-path-in-m3u CLI flag, wired through config parsing and defaults.
  • Update base URL/path generation so playlist rendering and proxy rewrites can emit root-relative paths (preserving app-path-prefix).
  • Propagate the option through OpenWrt (init/UCI/LuCI + i18n), iKuai packaging, sample configs, docs, and add E2E coverage.

Reviewed changes

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

Show a summary per file
File Description
src/utils.h Document build_proxy_base_url() behavior when relative-path mode is enabled.
src/utils.c Implement relative base path return in build_proxy_base_url() when the new option is enabled.
src/http_proxy_rewrite.h Clarify base_url can be an absolute URL or a root-relative base path.
src/configuration.h Add use_relative_path_in_m3u to global config struct.
src/configuration.c Parse INI option, add CLI long option, default init, and command-line override tracking.
rtp2httpd.conf Add sample config entry + explanation for use-relative-path-in-m3u.
openwrt-support/rtp2httpd/files/rtp2httpd.init Append --use-relative-path-in-m3u based on UCI boolean.
openwrt-support/rtp2httpd/files/rtp2httpd.conf Document the new UCI option in the sample config.
openwrt-support/luci-app-rtp2httpd/po/zh_Hans/rtp2httpd.po Add Simplified Chinese LuCI strings for the new toggle.
openwrt-support/luci-app-rtp2httpd/po/templates/rtp2httpd.pot Add template strings for translators.
openwrt-support/luci-app-rtp2httpd/htdocs/luci-static/resources/view/rtp2httpd.js Add LuCI UI flag for use_relative_path_in_m3u.
ikuai-support/rtp2httpd/scripts/start.sh Add env var -> CLI wiring for RTP2HTTPD_USE_RELATIVE_PATH_IN_M3U.
ikuai-support/rtp2httpd/app/option.json Add iKuai config schema entry for the new env var.
e2e/test_m3u.py Add E2E test verifying /playlist.m3u emits root-relative URLs under app-path-prefix.
e2e/test_http_proxy_m3u_rewrite.py Add E2E coverage for relative-path mode in HTTP proxy M3U segment rewrite output.
e2e/test_config.py Extend option source/priority tests to include the new flag/INI setting.
docs/reference/configuration.md Document the new CLI flag and config key (Chinese source).
docs/en/reference/configuration.md Update English configuration reference to match the new option.

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@github-actions

Copy link
Copy Markdown
Contributor

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

@stackia stackia merged commit 7f7e07f into main Jun 25, 2026
10 checks passed
@stackia stackia deleted the codex/use-relative-path-in-m3u branch June 25, 2026 09:40
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.

2 participants