From b0e6447af5fd4df0096a79767b679ff7fd5ea0cd Mon Sep 17 00:00:00 2001 From: "a.schulz" Date: Wed, 3 Apr 2024 15:58:01 +0200 Subject: [PATCH 1/2] feat(external-api): expose authentication adopted login/authenticate process from LoginDialog to trigger state changes via exposed IFrame API authentication --- modules/API/API.js | 13 +++++++++++++ modules/API/external/external_api.js | 1 + 2 files changed, 14 insertions(+) diff --git a/modules/API/API.js b/modules/API/API.js index 6999e99aed41..0c58940b4a6a 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -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, @@ -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'; @@ -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); diff --git a/modules/API/external/external_api.js b/modules/API/external/external_api.js index 0938cf9d2454..befea7f38ecd 100644 --- a/modules/API/external/external_api.js +++ b/modules/API/external/external_api.js @@ -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', From 95542d99ed7b580d58937887025628473a9f6cea Mon Sep 17 00:00:00 2001 From: "a.schulz" Date: Thu, 4 Apr 2024 07:38:35 +0200 Subject: [PATCH 2/2] fix: solved linter errors --- modules/API/API.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/API/API.js b/modules/API/API.js index 0c58940b4a6a..4b8f6484e0df 100644 --- a/modules/API/API.js +++ b/modules/API/API.js @@ -3,7 +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 { authenticateAndUpgradeRole } from '../../react/features/authentication/actions.any'; import { approveParticipantAudio, approveParticipantVideo, @@ -98,7 +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 { 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'; @@ -492,7 +492,7 @@ function initCommands() { const conference = getCurrentConference(state); if (conference) { - APP.store.dispatch(authenticateAndUpgradeRole(jid, password, 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));