Jitsi Meet - Secure, Simple and Scalable Video Conferences that you use as a standalone app or embed in your web application.
TypeScript debiandeep-videojitsijitsi-meetscalable-video-conferencessfuvideovideo-communicationvideo-conferencingwebrtc
feat(api): notify of password required
Leonard Kimae3b70eb139d
diff --git a/doc/api.md b/doc/api.mdindex 826bd3b23a..a5551f68d6 100644--- a/doc/api.md+++ b/doc/api.md@@ -192,6 +192,11 @@ The `command` parameter is String object with the name of the command. The folloapi.executeCommand('displayName', 'New Nickname');```+* **password** - Sets the password for the room. This command requires one argument - the password name to be set.+```javascript+api.executeCommand('password', 'The Password');+```+* **subject** - Sets the subject of the conference. This command requires one argument - the new subject to be set.```javascriptapi.executeCommand('subject', 'New Conference Subject');@@ -389,6 +394,8 @@ changes. The listener will receive an object with the following structure:}```+* **passwordRequired** - event notifications fired when failing to join a room because it has a password.+* **videoConferenceJoined** - event notifications fired when the local user has joined the video conference. The listener will receive an object with the following structure:```javascript{diff --git a/modules/API/API.js b/modules/API/API.jsindex 14c4f31756..f851d5167e 100644--- a/modules/API/API.js+++ b/modules/API/API.js@@ -5,7 +5,7 @@ import {createApiEvent,sendAnalytics} from '../../react/features/analytics';-import { setSubject } from '../../react/features/base/conference';+import { setPassword, setSubject } from '../../react/features/base/conference';import { parseJWTFromURLParams } from '../../react/features/base/jwt';import { invite } from '../../react/features/invite';import { toggleTileView } from '../../react/features/video-layout';@@ -65,6 +65,28 @@ function initCommands() {sendAnalytics(createApiEvent('display.name.changed'));APP.conference.changeLocalDisplayName(displayName);},+ 'password': password => {+ const { conference, passwordRequired }+ = APP.store.getState()['features/base/conference'];++ if (passwordRequired) {+ sendAnalytics(createApiEvent('submit.password'));++ APP.store.dispatch(setPassword(+ passwordRequired,+ passwordRequired.join,+ password+ ));+ } else {+ sendAnalytics(createApiEvent('password.changed'));++ APP.store.dispatch(setPassword(+ conference,+ conference.lock,+ password+ ));+ }+ },'proxy-connection-event': event => {APP.conference.onProxyConnectionEvent(event);},@@ -627,6 +649,16 @@ class API {});}+ /**+ * Notify external application of the current meeting requiring a password+ * to join.+ *+ * @returns {void}+ */+ notifyOnPasswordRequired() {+ this._sendEvent({ name: 'password-required' });+ }+/*** Notify external application (if API is enabled) that the screen sharing* has been turned on/off.diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.jsindex 9bef21501d..0651c2b180 100644--- a/modules/API/external/external_api.js+++ b/modules/API/external/external_api.js@@ -33,6 +33,7 @@ const commands = {displayName: 'display-name',email: 'email',hangup: 'video-hangup',+ password: 'password',subject: 'subject',submitFeedback: 'submit-feedback',toggleAudio: 'toggle-audio',@@ -63,6 +64,7 @@ const events = {'outgoing-message': 'outgoingMessage','participant-joined': 'participantJoined','participant-left': 'participantLeft',+ 'password-required': 'passwordRequired','proxy-connection-event': 'proxyConnectionEvent','video-ready-to-close': 'readyToClose','video-conference-joined': 'videoConferenceJoined',diff --git a/react/features/external-api/middleware.js b/react/features/external-api/middleware.jsindex 0f3ad0fb23..21b57ba541 100644--- a/react/features/external-api/middleware.js+++ b/react/features/external-api/middleware.js@@ -1,6 +1,8 @@// @flow+import { CONFERENCE_FAILED } from '../base/conference';import { NOTIFY_CAMERA_ERROR, NOTIFY_MIC_ERROR } from '../base/devices';+import { JitsiConferenceErrors } from '../base/lib-jitsi-meet';import { MiddlewareRegistry } from '../base/redux';declare var APP: Object;@@ -12,6 +14,14 @@ declare var APP: Object;*/MiddlewareRegistry.register((/* store */) => next => action => {switch (action.type) {+ case CONFERENCE_FAILED: {+ if (action.conference+ && action.error.name === JitsiConferenceErrors.PASSWORD_REQUIRED) {+ APP.API.notifyOnPasswordRequired();+ }+ break;+ }+case NOTIFY_CAMERA_ERROR:if (action.error) {APP.API.notifyOnCameraError(