Skip to content

feat(web): add app path prefix support#573

Merged
stackia merged 5 commits into
mainfrom
codex/app-path-prefix
Jun 24, 2026
Merged

feat(web): add app path prefix support#573
stackia merged 5 commits into
mainfrom
codex/app-path-prefix

Conversation

@stackia

@stackia stackia commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

Adds app-path-prefix support 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:build
  • cmake -B build -DCMAKE_BUILD_TYPE=Release -DENABLE_AGGRESSIVE_OPT=ON
  • cmake --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.py
  • pnpm run lint
  • pnpm run type-check
  • pnpm run docs:build

@stackia stackia requested a review from Copilot June 24, 2026 21:14
@stackia stackia marked this pull request as ready for review June 24, 2026 21:14
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-573.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 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-prefix to 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.

Comment thread src/connection.c
Comment thread src/connection.c Outdated
Comment thread src/m3u.c Outdated
Comment thread src/m3u.c
Comment thread src/m3u.c Outdated
Comment thread src/m3u.c Outdated
@github-actions

Copy link
Copy Markdown
Contributor

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

1 similar comment
@github-actions

Copy link
Copy Markdown
Contributor

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

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 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".

Comment thread src/connection.c Outdated
@github-actions

Copy link
Copy Markdown
Contributor

Azure Static Web Apps: Your stage site is ready! Visit it here: https://thankful-water-0a297bf00-573.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

Copilot reviewed 33 out of 34 changed files in this pull request and generated 2 comments.

Comment thread e2e/test_pages.py
@github-actions

Copy link
Copy Markdown
Contributor

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

@stackia stackia merged commit 2d1eb9a into main Jun 24, 2026
10 checks passed
@stackia stackia deleted the codex/app-path-prefix branch June 24, 2026 21:42
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