From 815fa0586afb008b6e4f641567c598e31bd3d8e1 Mon Sep 17 00:00:00 2001 From: Alessandro Ros Date: Wed, 21 Jun 2023 15:44:04 +0200 Subject: [PATCH] webrtc: fix using inline credentials in URLs (#1919) (#1966) --- internal/core/webrtc_publish_index.html | 6 +++--- internal/core/webrtc_read_index.html | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/internal/core/webrtc_publish_index.html b/internal/core/webrtc_publish_index.html index b9d7feb8..2251412b 100644 --- a/internal/core/webrtc_publish_index.html +++ b/internal/core/webrtc_publish_index.html @@ -190,7 +190,7 @@ class Transmitter { start() { console.log("requesting ICE servers"); - fetch('whip', { + fetch(new URL('whip', window.location.href), { method: 'OPTIONS', }) .then((res) => this.onIceServers(res)) @@ -227,7 +227,7 @@ class Transmitter { '&audio_codec=' + audioCodec + '&video_bitrate=' + videoBitrate; - fetch('whip' + params, { + fetch(new URL('whip', window.location.href) + params, { method: 'POST', headers: { 'Content-Type': 'application/sdp', @@ -293,7 +293,7 @@ class Transmitter { } sendLocalCandidates(candidates) { - fetch('whip', { + fetch(new URL('whip', window.location.href), { method: 'PATCH', headers: { 'Content-Type': 'application/trickle-ice-sdpfrag', diff --git a/internal/core/webrtc_read_index.html b/internal/core/webrtc_read_index.html index e91510d1..05845b8b 100644 --- a/internal/core/webrtc_read_index.html +++ b/internal/core/webrtc_read_index.html @@ -104,7 +104,7 @@ class WHEPClient { start() { console.log("requesting ICE servers"); - fetch('whep', { + fetch(new URL('whep', window.location.href), { method: 'OPTIONS', }) .then((res) => this.onIceServers(res)) @@ -138,7 +138,7 @@ class WHEPClient { console.log("sending offer"); - fetch('whep', { + fetch(new URL('whep', window.location.href), { method: 'POST', headers: { 'Content-Type': 'application/sdp', @@ -204,7 +204,7 @@ class WHEPClient { } sendLocalCandidates(candidates) { - fetch('whep', { + fetch(new URL('whep', window.location.href), { method: 'PATCH', headers: { 'Content-Type': 'application/trickle-ice-sdpfrag',