Skip to content

Commit

Permalink
fix(flags): Init flags before creating XMPP conn.
Browse files Browse the repository at this point in the history
This allows us to set defaults through jitsi-meet. Also remove undocumented setting enableJoinAsVisitor that is no longer needed.
  • Loading branch information
jallamsetty1 committed Mar 28, 2024
1 parent b564cbf commit 9b11d09
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 19 deletions.
5 changes: 5 additions & 0 deletions JitsiConnection.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import JitsiConference from './JitsiConference';
import * as JitsiConnectionEvents from './JitsiConnectionEvents';
import FeatureFlags from './modules/flags/FeatureFlags';
import Statistics from './modules/statistics/statistics';
import XMPP from './modules/xmpp/xmpp';
import {
Expand All @@ -21,6 +22,10 @@ export default function JitsiConnection(appID, token, options) {
this.appID = appID;
this.token = token;
this.options = options;

// Initialize the feature flags so that they are advertised through the disco-info.
FeatureFlags.init(options.flags || {});

this.xmpp = new XMPP(options, token);

/* eslint-disable max-params */
Expand Down
4 changes: 0 additions & 4 deletions JitsiMeetJS.ts
Original file line number Diff line number Diff line change
Expand Up @@ -150,10 +150,6 @@ export default {

Settings.init(options.externalStorage);
Statistics.init(options);
const flags = options.flags || {};

// Configure the feature flags.
FeatureFlags.init(flags);

// Initialize global window.connectionTimes
// FIXME do not use 'window'
Expand Down
10 changes: 0 additions & 10 deletions modules/flags/FeatureFlags.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,10 @@ class FeatureFlags {
* @param {object} flags - The feature flags.
* @param {boolean=} flags.runInLiteMode - Enables lite mode for testing to disable media decoding.
* @param {boolean=} flags.ssrcRewritingEnabled - Use SSRC rewriting.
* @param {boolean=} flags.enableJoinAsVisitor - Enable joining as a visitor.
*/
init(flags) {
this._runInLiteMode = Boolean(flags.runInLiteMode);
this._ssrcRewriting = Boolean(flags.ssrcRewritingEnabled);
this._joinAsVisitor = Boolean(flags.enableJoinAsVisitor ?? true);
}

/**
Expand All @@ -37,14 +35,6 @@ class FeatureFlags {
isSsrcRewritingSupported() {
return this._ssrcRewriting;
}

/**
* Checks if the clients supports joining as a visitor.
* @returns {boolean}
*/
isJoinAsVisitorSupported() {
return this._joinAsVisitor;
}
}

export default new FeatureFlags();
3 changes: 1 addition & 2 deletions modules/xmpp/moderator.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import $ from 'jquery';
import { $iq } from 'strophe.js';

import { CONNECTION_REDIRECTED } from '../../JitsiConnectionEvents';
import FeatureFlags from '../flags/FeatureFlags';
import Settings from '../settings/Settings';
import Listenable from '../util/Listenable';

Expand Down Expand Up @@ -190,7 +189,7 @@ export default class Moderator extends Listenable {
conferenceRequest.sessionId = sessionId;
}

if (FeatureFlags.isJoinAsVisitorSupported() && !config.iAmRecorder && !config.iAmSipGateway) {
if (!config.iAmRecorder && !config.iAmSipGateway) {
conferenceRequest.properties['visitors-version'] = 1;

if (this.options.preferVisitor) {
Expand Down
4 changes: 1 addition & 3 deletions modules/xmpp/xmpp.js
Original file line number Diff line number Diff line change
Expand Up @@ -263,9 +263,7 @@ export default class XMPP extends Listenable {
// the version added in moderator.js, this one here is mostly defined
// for keeping stats, since it is not made available to jocofo at
// the time of the initial conference-request.
if (FeatureFlags.isJoinAsVisitorSupported()) {
this.caps.addFeature('http://jitsi.org/visitors-1');
}
this.caps.addFeature('http://jitsi.org/visitors-1');
}

/**
Expand Down

0 comments on commit 9b11d09

Please sign in to comment.