diff --git a/README.md b/README.md index de7df9ca..5a9d4c48 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/whep`). The UI appends the rover ID to whatever you provide; if you prefer a different layout, include `{roverId}` or `{id}` in the URL (for example `http://192.168.0.86:8889/{id}/whep`). 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` (`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. ### Video handshake + diagnostics diff --git a/new_video_pipeline.md b/new_video_pipeline.md index 51662e26..5a2e2be4 100644 --- a/new_video_pipeline.md +++ b/new_video_pipeline.md @@ -23,8 +23,8 @@ 3. **Web clients** - Tiny helper (React hook or vanilla class) that: - 1. Requests a viewer JWT for rover ``. - 2. Issues a `POST` to `/whep/rover-` with `Authorization: Basic base64(token:token)` (token issued by the server when the client calls `video:request`). + 1. Requests a viewer token for rover ``. + 2. Issues a `POST` to `//whep` with `Authorization: Basic base64(token:token)` (token issued by the server when the client calls `video:request`). 3. Maintains auto-reconnect timers on ICE failure so dashboard widgets can come/go without reloading the page. - Operator dashboard mounts one player tied to the assigned rover. The spectator view instantiates one player per tile, muting + pausing hidden elements to keep CPU usage sane even when every rover is shown simultaneously. diff --git a/server/config.example.yaml b/server/config.example.yaml index aac281d7..06d2ffe5 100644 --- a/server/config.example.yaml +++ b/server/config.example.yaml @@ -8,8 +8,6 @@ admins: discord_id: "0987654321" lockdown: true media: - # Base URL for mediaMTX WHEP publishes. Append the rover ID automatically, or embed {roverId}/{id}. - # Examples: - # http://192.168.0.86:8889/whep -> becomes http://192.168.0.86:8889/whep/ - # http://192.168.0.86:8889/{id}/whep -> becomes http://192.168.0.86:8889/Freaky/whep - whepBaseUrl: "http://192.168.0.86:8889/whep" + # Base address for mediaMTX (scheme + host + optional port). The UI will always request + # http:////whep + whepBaseUrl: "http://192.168.0.86:8889" diff --git a/server/mediamtx/mediamtx.yml b/server/mediamtx/mediamtx.yml index b16cfef8..8faf0ca1 100644 --- a/server/mediamtx/mediamtx.yml +++ b/server/mediamtx/mediamtx.yml @@ -21,13 +21,13 @@ webrtcICEServers2: [] srt: yes srtAddress: :9000 -# authMethod: http -# authHTTPAddress: http://127.0.0.1:8080/mediamtx/auth -# authHTTPExclude: -# - action: publish -# - action: api -# - action: metrics -# - action: pprof +authMethod: http +authHTTPAddress: http://127.0.0.1:8080/mediamtx/auth +authHTTPExclude: + - action: publish + - action: api + - action: metrics + - action: pprof paths: all: diff --git a/server/src/services/videoSocketService.js b/server/src/services/videoSocketService.js index e94b6c78..653f158b 100644 --- a/server/src/services/videoSocketService.js +++ b/server/src/services/videoSocketService.js @@ -14,14 +14,9 @@ function buildWhepUrl(roverId) { if (!base) { return ''; } + const cleanBase = base.replace(/\/$/, ''); const encodedId = encodeURIComponent(roverId); - if (base.includes('{roverId}')) { - return base.replace(/\{roverId\}/g, encodedId); - } - if (base.includes('{id}')) { - return base.replace(/\{id\}/g, encodedId); - } - return `${base.replace(/\/$/, '')}/${encodedId}`; + return `${cleanBase}/${encodedId}/whep`; } function canView(socket, roverId) {