Skip to content

Commit

Permalink
feat(external-api): expose authentication
Browse files Browse the repository at this point in the history
adopted login/authenticate process from LoginDialog to trigger state changes via exposed IFrame API authentication
  • Loading branch information
acsc0001 committed Apr 3, 2024
1 parent 4e50546 commit b0e6447
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
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";

Check failure on line 6 in modules/API/API.js

View workflow job for this annotation

GitHub Actions / Lint

Strings must use singlequote
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";

Check failure on line 101 in modules/API/API.js

View workflow job for this annotation

GitHub Actions / Lint

Strings must use singlequote
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))

Check failure on line 495 in modules/API/API.js

View workflow job for this annotation

GitHub Actions / Lint

Missing semicolon
} 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

0 comments on commit b0e6447

Please sign in to comment.