Переглянути джерело

feat: Ignore colibri-ws urls if their domain matches ignoreDomain. (#2214)

dev1
bgrozev 2 роки тому
джерело
коміт
eb7a0cfcc0
Аккаунт користувача з таким Email не знайдено
1 змінених файлів з 21 додано та 5 видалено
  1. 21
    5
      JitsiConference.js

+ 21
- 5
JitsiConference.js Переглянути файл

2319
  * to listen for new WebRTC Data Channels (in the 'datachannel' mode).
2319
  * to listen for new WebRTC Data Channels (in the 'datachannel' mode).
2320
  */
2320
  */
2321
 JitsiConference.prototype._setBridgeChannel = function(offerIq, pc) {
2321
 JitsiConference.prototype._setBridgeChannel = function(offerIq, pc) {
2322
+    const ignoreDomain = this.connection?.options?.bridgeChannel?.ignoreDomain;
2322
     let wsUrl = null;
2323
     let wsUrl = null;
2323
-    const webSocket
2324
-        = $(offerIq)
2325
-            .find('>content>transport>web-socket')
2324
+
2325
+    $(offerIq).find('>content>transport>web-socket')
2326
+        .toArray()
2327
+        .map(e => e.getAttribute('url'))
2328
+        .forEach(url => {
2329
+            if (!wsUrl && (!ignoreDomain || ignoreDomain !== new URL(url).hostname)) {
2330
+                wsUrl = url;
2331
+                logger.info(`Using colibri-ws url ${url}`);
2332
+            } else if (!wsUrl) {
2333
+                logger.info(`Ignoring colibri-ws url with domain ${ignoreDomain}`);
2334
+            }
2335
+        });
2336
+
2337
+    if (!wsUrl) {
2338
+        const firstWsUrl = $(offerIq).find('>content>transport>web-socket')
2326
             .first();
2339
             .first();
2327
 
2340
 
2328
-    if (webSocket.length === 1) {
2329
-        wsUrl = webSocket[0].getAttribute('url');
2341
+        if (firstWsUrl.length === 1) {
2342
+            wsUrl = firstWsUrl[0].getAttribute('url');
2343
+            logger.info(`Falling back to ${wsUrl}`);
2344
+        }
2330
     }
2345
     }
2331
 
2346
 
2332
     if (wsUrl) {
2347
     if (wsUrl) {
2334
         this.rtc.initializeBridgeChannel(null, wsUrl);
2349
         this.rtc.initializeBridgeChannel(null, wsUrl);
2335
     } else {
2350
     } else {
2336
         // Otherwise, fall back to an attempt to use SCTP.
2351
         // Otherwise, fall back to an attempt to use SCTP.
2352
+        logger.info('No colibri-ws found.');
2337
         this.rtc.initializeBridgeChannel(pc, null);
2353
         this.rtc.initializeBridgeChannel(pc, null);
2338
     }
2354
     }
2339
 };
2355
 };

Завантаження…
Відмінити
Зберегти