Skip to content

Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.

fix(features): Allow checking features when jwt is not available. (#15906)

Дамян Минков6903ccf009bc
diff --git a/react/features/base/jwt/functions.ts b/react/features/base/jwt/functions.ts
index fe0948edcd..5c8ecb0d01 100644
--- a/react/features/base/jwt/functions.ts
+++ b/react/features/base/jwt/functions.ts
@@ -53,7 +53,6 @@ export function isJwtFeatureEnabled(
feature: ParticipantFeaturesKey,
ifNotInFeatures: boolean
) {
- const { jwt } = state['features/base/jwt'];
let { features } = getLocalParticipant(state) || {};
if (typeof features === 'undefined' && isVpaasMeeting(state)) {
@@ -62,7 +61,6 @@ export function isJwtFeatureEnabled(
}
return isJwtFeatureEnabledStateless({
- jwt,
localParticipantFeatures: features,
feature,
ifNotInFeatures
@@ -79,7 +77,6 @@ interface IIsJwtFeatureEnabledStatelessParams {
/**
* Check if the given JWT feature is enabled.
*
- * @param {string | undefined} jwt - The jwt token.
* @param {ILocalParticipant} localParticipantFeatures - The features of the local participant.
* @param {string} feature - The feature we want to check.
* @param {boolean} ifNotInFeatures - Default value if features is missing
@@ -87,12 +84,11 @@ interface IIsJwtFeatureEnabledStatelessParams {
* @returns {boolean}
*/
export function isJwtFeatureEnabledStateless({
- jwt,
localParticipantFeatures: features,
feature,
ifNotInFeatures
}: IIsJwtFeatureEnabledStatelessParams) {
- if (!jwt || typeof features?.[feature] === 'undefined') {
+ if (typeof features?.[feature] === 'undefined') {
return ifNotInFeatures;
}
diff --git a/react/features/toolbox/components/web/Toolbox.tsx b/react/features/toolbox/components/web/Toolbox.tsx
index 60c07ca2ec..5c3743ed66 100644
--- a/react/features/toolbox/components/web/Toolbox.tsx
+++ b/react/features/toolbox/components/web/Toolbox.tsx
@@ -89,12 +89,11 @@ export default function Toolbox({
const toolbarButtonsToUse = toolbarButtons || reduxToolbarButtons;
const chatOpen = useSelector((state: IReduxState) => state['features/chat'].isOpen);
const isDialogVisible = useSelector((state: IReduxState) => Boolean(state['features/base/dialog'].component));
- const jwt = useSelector((state: IReduxState) => state['features/base/jwt'].jwt);
const localParticipant = useSelector(getLocalParticipant);
const transcribing = useSelector(isTranscribing);
// Do not convert to selector, it returns new array and will cause re-rendering of toolbox on every action.
- const jwtDisabledButtons = getJwtDisabledButtons(transcribing, jwt, localParticipant?.features);
+ const jwtDisabledButtons = getJwtDisabledButtons(transcribing, localParticipant?.features);
const reactionsButtonEnabled = useSelector(isReactionsButtonEnabled);
const _shouldDisplayReactionsButtons = useSelector(shouldDisplayReactionsButtons);
diff --git a/react/features/toolbox/functions.any.ts b/react/features/toolbox/functions.any.ts
index ff0a7e48a6..b00d904afe 100644
--- a/react/features/toolbox/functions.any.ts
+++ b/react/features/toolbox/functions.any.ts
@@ -27,18 +27,15 @@ export function isAudioMuteButtonDisabled(state: IReduxState) {
* This function is stateless as it returns a new array and may cause re-rendering.
*
* @param {boolean} isTranscribing - Whether there is currently a transcriber in the meeting.
- * @param {string | undefined} jwt - The jwt token.
* @param {ILocalParticipant} localParticipantFeatures - The features of the local participant.
* @returns {string[]} - The disabled by jwt buttons array.
*/
export function getJwtDisabledButtons(
isTranscribing: boolean,
- jwt: string | undefined,
localParticipantFeatures?: IParticipantFeatures) {
const acc = [];
if (!isJwtFeatureEnabledStateless({
- jwt,
localParticipantFeatures,
feature: 'livestreaming',
ifNotInFeatures: false
@@ -47,7 +44,6 @@ export function getJwtDisabledButtons(
}
if (!isTranscribing && !isJwtFeatureEnabledStateless({
- jwt,
localParticipantFeatures,
feature: 'transcription',
ifNotInFeatures: false
diff --git a/resources/prosody-plugins/mod_jitsi_permissions.lua b/resources/prosody-plugins/mod_jitsi_permissions.lua
index 1e0899c14a..507f1ef008 100644
--- a/resources/prosody-plugins/mod_jitsi_permissions.lua
+++ b/resources/prosody-plugins/mod_jitsi_permissions.lua
@@ -1,7 +1,6 @@
-- this is auto loaded by meeting_id
local filters = require 'util.filters';
local jid = require 'util.jid';
-local modulemanager = require "prosody.core.modulemanager";
local util = module:require 'util';
local is_admin = util.is_admin;