diff --git a/README.md b/README.md index 5a9d4c48..a614d218 100644 --- a/README.md +++ b/README.md @@ -79,7 +79,7 @@ The script must be executed via `sudo` from the user that owns the repo. It will Publishing rovers lives on a trusted network, so the shipped config (tracked at `server/mediamtx/mediamtx.yml`) skips HTTP auth for SRT ingest and whitelists any path that matches `rover-*`. The installer overwrites `/etc/mediamtx/mediamtx.yml` every time you run it—if you need to tweak ports or add TURN servers, edit the template in the repo and rerun `install_server.sh` so every box stays in sync automatically. -Once finished, update `server/config.yaml` with your admin passwords and `media.whepBaseUrl` (`http://192.168.0.86:8889`). The client automatically requests `http:////whep`, so you never have to embed IDs or path templates. Restart `multirover.service` whenever you edit the config. To pull updates later, just `git pull`, re-run `npm install --production` inside `server/`, and restart the service—no need to rerun the installer. +Once finished, update `server/config.yaml` with your admin passwords and `media.whepBaseUrl` (for example `http://192.168.0.86:8889/video`). The client automatically requests `http:////whep`, so include whatever path prefix your reverse proxy exposes (e.g. `/video`). Restart `multirover.service` whenever you edit the config. To pull updates later, just `git pull`, re-run `npm install --production` inside `server/`, and restart the service—no need to rerun the installer. ### Video handshake + diagnostics diff --git a/server/config.example.yaml b/server/config.example.yaml index 06d2ffe5..2934c1d6 100644 --- a/server/config.example.yaml +++ b/server/config.example.yaml @@ -8,6 +8,7 @@ admins: discord_id: "0987654321" lockdown: true media: - # Base address for mediaMTX (scheme + host + optional port). The UI will always request + # Base address for mediaMTX (scheme + host + optional port/path). The UI will always request # http:////whep - whepBaseUrl: "http://192.168.0.86:8889" + # Example: http://192.168.0.86:8889/video + whepBaseUrl: "http://192.168.0.86:8889/video" diff --git a/server/src/services/videoSocketService.js b/server/src/services/videoSocketService.js index 28de934a..276700d7 100644 --- a/server/src/services/videoSocketService.js +++ b/server/src/services/videoSocketService.js @@ -14,14 +14,14 @@ function buildWhepUrl(roverId) { if (!base) { return ''; } - let origin; + let prefix = base; try { const parsed = new URL(base); - origin = parsed.origin; + prefix = `${parsed.origin}${parsed.pathname}`; } catch (err) { - origin = base.replace(/\/.*$/, ''); + // leave prefix as-is when URL parsing fails; fall back to string cleanup below } - const cleanBase = origin.replace(/\/$/, ''); + const cleanBase = prefix.replace(/\/+$/, ''); const encodedId = encodeURIComponent(roverId); return `${cleanBase}/${encodedId}/whep`; }