webrtc: fix exception in browser when webrtcICEServers is empty (#1817) (#1821)

this fixes a regression introduced in v0.23.0.
This commit is contained in:
Alessandro Ros 2023-05-18 14:58:19 +02:00 committed by GitHub
parent 586df289e2
commit 6b8c65f5d7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 13 deletions

View File

@ -111,7 +111,7 @@ const setState = (newState) => {
const restartPause = 2000; const restartPause = 2000;
const linkToIceServers = (links) => ( const linkToIceServers = (links) => (
links.split(', ').map((link) => { (links !== null) ? links.split(', ').map((link) => {
const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i); const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i);
const ret = { const ret = {
urls: [m[1]], urls: [m[1]],
@ -124,7 +124,7 @@ const linkToIceServers = (links) => (
} }
return ret; return ret;
}) }) : []
); );
const parseOffer = (offer) => { const parseOffer = (offer) => {

View File

@ -26,8 +26,8 @@ html, body {
const restartPause = 2000; const restartPause = 2000;
const linkToIceServers = (links) => ( const linkToIceServers = (links) => (
links.split(', ').map((link) => { (links !== null) ? links.split(', ').map((link) => {
const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.+?)"; credential="(.+?)"; credential-type="password")?/i); const m = link.match(/^<(.+?)>; rel="ice-server"(; username="(.*?)"; credential="(.*?)"; credential-type="password")?/i);
const ret = { const ret = {
urls: [m[1]], urls: [m[1]],
}; };
@ -39,7 +39,7 @@ const linkToIceServers = (links) => (
} }
return ret; return ret;
}) }) : []
); );
const parseOffer = (offer) => { const parseOffer = (offer) => {

View File

@ -199,25 +199,27 @@ webrtcAllowOrigin: '*'
# If the server receives a request from one of these entries, IP in logs # If the server receives a request from one of these entries, IP in logs
# will be taken from the X-Forwarded-For header. # will be taken from the X-Forwarded-For header.
webrtcTrustedProxies: [] webrtcTrustedProxies: []
# List of ICE servers, in format type:user:pass:host:port or type:host:port. # List of ICE servers, in format type:user:password:host:port or type:host:port.
# type can be "stun", "turn" or "turns". # type can be "stun", "turn" or "turns".
# STUN servers are used to get the public IP of both server and clients. # STUN servers are used to obtain the public IP of server and clients. They are
# TURN/TURNS servers are used as relay when a direct connection between server and clients is not possible. # needed when server and clients are on different LANs.
# TURN servers are needed when a direct connection between server and clients
# is not possible. All traffic is routed through the chosen TURN server.
# if user is "AUTH_SECRET", then authentication is secret based. # if user is "AUTH_SECRET", then authentication is secret based.
# the secret must be inserted into the pass field. # the secret must be inserted into the password field.
webrtcICEServers: [stun:stun.l.google.com:19302] webrtcICEServers: [stun:stun.l.google.com:19302]
# List of public IP addresses that are to be used as a host. # List of public IP addresses that are to be used as a host.
# This is used typically for servers that are behind 1:1 D-NAT. # This is used typically for servers that are behind 1:1 D-NAT.
webrtcICEHostNAT1To1IPs: [] webrtcICEHostNAT1To1IPs: []
# Address of a ICE UDP listener in format host:port. # Address of a ICE UDP listener in format host:port.
# If filled, ICE traffic will come through a single UDP port, # If filled, ICE traffic will pass through a single UDP port,
# allowing the deployment of the server inside a container or behind a NAT. # allowing the deployment of the server inside a container or behind a NAT.
webrtcICEUDPMuxAddress: webrtcICEUDPMuxAddress:
# Address of a ICE TCP listener in format host:port. # Address of a ICE TCP listener in format host:port.
# If filled, ICE traffic will come through a single TCP port, # If filled, ICE traffic will pass through a single TCP port,
# allowing the deployment of the server inside a container or behind a NAT. # allowing the deployment of the server inside a container or behind a NAT.
# At the moment, setting this parameter forces usage of the TCP protocol, # Setting this parameter forces usage of the TCP protocol, which is not
# which is not optimal for WebRTC. # optimal for WebRTC.
webrtcICETCPMuxAddress: webrtcICETCPMuxAddress:
############################################### ###############################################