mirror of
https://github.com/legop3/MultiRoombaRover.git
synced 2026-09-16 17:40:46 -04:00
AAAHGHG
This commit is contained in:
@@ -14,7 +14,14 @@ function buildWhepUrl(roverId) {
|
|||||||
if (!base) {
|
if (!base) {
|
||||||
return '';
|
return '';
|
||||||
}
|
}
|
||||||
const cleanBase = base.replace(/\/$/, '');
|
let origin;
|
||||||
|
try {
|
||||||
|
const parsed = new URL(base);
|
||||||
|
origin = parsed.origin;
|
||||||
|
} catch (err) {
|
||||||
|
origin = base.replace(/\/.*$/, '');
|
||||||
|
}
|
||||||
|
const cleanBase = origin.replace(/\/$/, '');
|
||||||
const encodedId = encodeURIComponent(roverId);
|
const encodedId = encodeURIComponent(roverId);
|
||||||
return `${cleanBase}/${encodedId}/whep`;
|
return `${cleanBase}/${encodedId}/whep`;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user