feat(config): add relative M3U path option#575
Conversation
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-575.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-575.eastasia.1.azurestaticapps.net |
There was a problem hiding this comment.
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-m3uconfig option and--use-relative-path-in-m3uCLI 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.
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-575.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-575.eastasia.1.azurestaticapps.net |
Summary
Adds a new
use-relative-path-in-m3uconfig option and matching--use-relative-path-in-m3uCLI flag. When enabled, generatedplaylist.m3uoutput and HTTP proxy M3U/HLS rewrites omit thehttp://hostprefix and emit root-relative paths, preservingapp-path-prefixwhen 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=ONcmake --build build -j$(getconf _NPROCESSORS_ONLN)uv run pytest e2e/test_config.py::TestOptionSourcesAndPriority -v -n auto --dist loadscopeuv run pytest e2e/test_m3u.py::TestM3UURLRewriting e2e/test_http_proxy_m3u_rewrite.py::TestM3URewriteAbsoluteHTTP -v -n auto --dist loadscopepnpm run docs:buildmsgfmt -c -o /tmp/rtp2httpd.zh_Hans.mo openwrt-support/luci-app-rtp2httpd/po/zh_Hans/rtp2httpd.pogit diff --check