Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(external-api): expose authentication #14595

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions modules/API/API.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import Logger from '@jitsi/logger';

import { createApiEvent } from '../../react/features/analytics/AnalyticsEvents';
import { sendAnalytics } from '../../react/features/analytics/functions';
import { authenticateAndUpgradeRole } from '../../react/features/authentication/actions.any';
import {
approveParticipantAudio,
approveParticipantVideo,
Expand Down Expand Up @@ -97,6 +98,7 @@ import {
open as openParticipantsPane
} from '../../react/features/participants-pane/actions';
import { getParticipantsPaneOpen, isForceMuted } from '../../react/features/participants-pane/functions';
import { joinConference } from '../../react/features/prejoin/actions.web';
import { startLocalVideoRecording, stopLocalVideoRecording } from '../../react/features/recording/actions.any';
import { RECORDING_TYPES } from '../../react/features/recording/constants';
import { getActiveSession, supportsLocalRecording } from '../../react/features/recording/functions';
Expand Down Expand Up @@ -485,6 +487,17 @@ function initCommands() {
sendAnalytics(createApiEvent('email.changed'));
APP.conference.changeLocalEmail(email);
},
'authenticate': (jid, password) => {
const state = APP.store.getState();
const conference = getCurrentConference(state);

if (conference) {
APP.store.dispatch(authenticateAndUpgradeRole(jid, password, conference));
} else {
// FIXME: Workaround for the web version. To be removed once we get rid of conference.js
APP.store.dispatch(joinConference(undefined, false, jid, password));
}
},
'avatar-url': avatarUrl => {
sendAnalytics(createApiEvent('avatar.url.changed'));
APP.conference.changeLocalAvatarUrl(avatarUrl);
Expand Down
1 change: 1 addition & 0 deletions modules/API/external/external_api.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ const commands = {
displayName: 'display-name',
endConference: 'end-conference',
email: 'email',
authenticate: 'authenticate',
grantModerator: 'grant-moderator',
hangup: 'video-hangup',
hideNotification: 'hide-notification',
Expand Down