Bladeren bron

Add a feature flag and xmpp-caps entry for joining as a visitor. (#2247)

* Add a feature flag and xmpp-caps entry for joining as a visitor.

* Default to enabled, use for the confernece-request flag too.
master
bgrozev 2 jaren geleden
bovenliggende
commit
28d5f6b2c2
No account linked to committer's email address
3 gewijzigde bestanden met toevoegingen van 24 en 3 verwijderingen
  1. 10
    0
      modules/flags/FeatureFlags.js
  2. 6
    3
      modules/xmpp/moderator.js
  3. 8
    0
      modules/xmpp/xmpp.js

+ 10
- 0
modules/flags/FeatureFlags.js Bestand weergeven

@@ -11,10 +11,12 @@ class FeatureFlags {
11 11
      * @param {object} flags - The feature flags.
12 12
      * @param {boolean=} flags.runInLiteMode - Enables lite mode for testing to disable media decoding.
13 13
      * @param {boolean=} flags.ssrcRewritingEnabled - Use SSRC rewriting. Requires sourceNameSignaling to be enabled.
14
+     * @param {boolean=} flags.enableJoinAsVisitor - Enable joining as a visitor.
14 15
      */
15 16
     init(flags) {
16 17
         this._runInLiteMode = Boolean(flags.runInLiteMode);
17 18
         this._ssrcRewriting = Boolean(flags.ssrcRewritingEnabled);
19
+        this._joinAsVisitor = Boolean(flags.enableJoinAsVisitor ?? true);
18 20
     }
19 21
 
20 22
     /**
@@ -44,6 +46,14 @@ class FeatureFlags {
44 46
     isSsrcRewritingSupported() {
45 47
         return this._ssrcRewriting;
46 48
     }
49
+
50
+    /**
51
+     * Checks if the clients supports joining as a visitor.
52
+     * @returns {boolean}
53
+     */
54
+    isJoinAsVisitorSupported() {
55
+        return this._joinAsVisitor;
56
+    }
47 57
 }
48 58
 
49 59
 export default new FeatureFlags();

+ 6
- 3
modules/xmpp/moderator.js Bestand weergeven

@@ -3,6 +3,7 @@ import { getLogger } from '@jitsi/logger';
3 3
 import $ from 'jquery';
4 4
 import { $iq, Strophe } from 'strophe.js';
5 5
 
6
+import FeatureFlags from '../flags/FeatureFlags';
6 7
 import Settings from '../settings/Settings';
7 8
 
8 9
 const AuthenticationEvents
@@ -216,9 +217,11 @@ Moderator.prototype._createConferenceIq = function() {
216 217
                 }).up();
217 218
         }
218 219
     }
219
-    elem.c('property', {
220
-        name: 'visitors-version',
221
-        value: 1 }).up();
220
+    if (FeatureFlags.isJoinAsVisitorSupported()) {
221
+        elem.c('property', {
222
+            name: 'visitors-version',
223
+            value: 1 }).up();
224
+    }
222 225
 
223 226
     return elem;
224 227
 };

+ 8
- 0
modules/xmpp/xmpp.js Bestand weergeven

@@ -265,6 +265,14 @@ export default class XMPP extends Listenable {
265 265
         if (FeatureFlags.isSsrcRewritingSupported()) {
266 266
             this.caps.addFeature('http://jitsi.org/ssrc-rewriting-1');
267 267
         }
268
+
269
+        // Use "-1" as a version that we can bump later. This should match
270
+        // the version added in moderator.js, this one here is mostly defined
271
+        // for keeping stats, since it is not made available to jocofo at
272
+        // the time of the initial conference-request.
273
+        if (FeatureFlags.isJoinAsVisitorSupported()) {
274
+            this.caps.addFeature('http://jitsi.org/visitors-1');
275
+        }
268 276
     }
269 277
 
270 278
     /**

Laden…
Annuleren
Opslaan