This commit is contained in:
legop3
2025-11-18 16:56:55 -05:00
parent 080c9c8fce
commit d812a1fc6c
3 changed files with 8 additions and 7 deletions
+3 -2
View File
@@ -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://<base>/<roverId>/whep
whepBaseUrl: "http://192.168.0.86:8889"
# Example: http://192.168.0.86:8889/video
whepBaseUrl: "http://192.168.0.86:8889/video"
+4 -4
View File
@@ -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`;
}