feat(web): add app path prefix support#573
Conversation
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-573.eastasia.1.azurestaticapps.net |
There was a problem hiding this comment.
Pull request overview
This PR adds an app-path-prefix option that lets rtp2httpd serve all public HTTP resources (status, player, assets, playlist/EPG, proxy, redirects, auth cookie scope) under a configurable URL prefix, which is useful behind reverse proxies that do not strip the forwarded path prefix.
Changes:
- Add
app-path-prefixto config/CLI and update request routing + URL generation to consistently include/strip the prefix. - Update embedded Web UI delivery to support prefixed mounting (relative asset base + runtime-injected
<base>+ config values). - Extend OpenWrt integration, docs, and E2E coverage for prefixed deployments.
Reviewed changes
Copilot reviewed 31 out of 32 changed files in this pull request and generated 6 comments.
Show a summary per file
| File | Description |
|---|---|
| web-ui/vite.config.ts | Sets Vite build base to relative (./) for prefix-friendly asset URLs. |
| web-ui/status.html | Switches favicon path to relative to work under a mounted prefix. |
| web-ui/src/pages/player.tsx | Uses buildAppPath() when fetching/displaying the playlist endpoint. |
| web-ui/src/lib/url.ts | Adds runtime config + helpers to normalize and build prefixed paths. |
| web-ui/player.html | Switches icon paths to relative for prefixed mounting. |
| src/utils.c | Includes app path prefix when building proxy base URLs. |
| src/service.h | Makes UDPxy URL parser accept const char *. |
| src/service.c | Updates UDPxy URL parser signature accordingly. |
| src/m3u.c | Adds app-path-prefix support to generated server base URLs and wrapped URL extraction. |
| src/http.c | Scopes r2h-token cookie Path= to the configured prefix. |
| src/http_proxy.c | Rewrites redirect Location and cookie path handling to include the prefix. |
| src/embedded_web.h | Tracks whether an embedded file is gzip encoded. |
| src/embedded_web.c | Injects <base> + runtime config into embedded HTML; conditionally emits gzip headers. |
| src/connection.c | Strips configured prefix from incoming URLs and routes only prefixed requests. |
| src/configuration.h | Adds app_path_prefix + app_path_route fields to global config. |
| src/configuration.c | Implements parsing/normalization for app-path-prefix (INI + CLI) and cleanup/init wiring. |
| scripts/embed-dist.js | Stops gzipping HTML to allow runtime HTML injection; records gzip flag per file. |
| rtp2httpd.conf | Documents the new app-path-prefix option. |
| openwrt-support/rtp2httpd/files/rtp2httpd.init | Passes app_path_prefix from UCI to --app-path-prefix. |
| openwrt-support/rtp2httpd/files/rtp2httpd.conf | Adds a sample app_path_prefix UCI option. |
| openwrt-support/luci-app-rtp2httpd/po/zh_Hans/rtp2httpd.po | Adds Chinese translations for the new LuCI field/help text. |
| openwrt-support/luci-app-rtp2httpd/po/templates/rtp2httpd.pot | Adds template strings for the new LuCI field/help text. |
| openwrt-support/luci-app-rtp2httpd/htdocs/luci-static/resources/view/rtp2httpd.js | Adds LuCI UI field and URL preview logic for the prefix. |
| e2e/test_pages.py | Adds E2E coverage for prefixed status/player/assets/playlist/EPG/SSE + cookie path. |
| e2e/test_http_proxy.py | Adds E2E coverage for redirect Location rewriting under prefix. |
| e2e/test_http_proxy_m3u_rewrite.py | Adds E2E coverage for M3U segment URL rewriting under prefix. |
| e2e/test_config.py | Adds option precedence tests for app-path-prefix (config vs CLI). |
| docs/reference/configuration.md | Documents --app-path-prefix and behavior in Chinese reference docs. |
| docs/guide/url-formats.md | Notes that all paths must be prefixed when app-path-prefix is set (Chinese). |
| docs/en/reference/configuration.md | Documents --app-path-prefix in English reference docs. |
| docs/en/guide/url-formats.md | Notes that all paths must be prefixed when app-path-prefix is set (English). |
💡 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-573.eastasia.1.azurestaticapps.net |
1 similar comment
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-573.eastasia.1.azurestaticapps.net |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c454a546c8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
b8b48ff to
a838444
Compare
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-573.eastasia.1.azurestaticapps.net |
|
Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-573.eastasia.1.azurestaticapps.net |
Summary
Adds
app-path-prefixsupport across the daemon, embedded Web UI, generated URLs, OpenWrt integration, and documentation.The new config/CLI option normalizes optional leading/trailing slashes, mounts all public HTTP resources under the configured prefix, injects runtime Web UI base/config values into HTML, and ensures generated playlist, EPG, HTTP proxy, redirect, and auth cookie paths include the prefix.
Validation
pnpm run web-ui:buildcmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_AGGRESSIVE_OPT=ONcmake --build build -j$(getconf _NPROCESSORS_ONLN)./scripts/run-e2e.sh test_config.py./scripts/run-e2e.sh test_pages.py./scripts/run-e2e.sh test_http_proxy.py./scripts/run-e2e.sh test_http_proxy_m3u_rewrite.pypnpm run lintpnpm run type-checkpnpm run docs:build