From a8267fc78390902ada55e6a1b88e5df38e2dfdab Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Fri, 10 May 2024 16:13:28 +0200 Subject: [PATCH 01/19] added DRIVE_NEW_API_URL env variable --- .env.template | 3 ++- .../authentication/internxt/types/config.types.ts | 1 + react/features/base/connection/options8x8.ts | 15 ++++++++++++--- 3 files changed, 15 insertions(+), 4 deletions(-) diff --git a/.env.template b/.env.template index 10f9a55355f5..9f8a6d08bffe 100644 --- a/.env.template +++ b/.env.template @@ -1,4 +1,5 @@ -DRIVE_API_URL=http://drive-server:8000 +DRIVE_API_URL=http://drive-server:8000/api +DRIVE_NEW_API_URL=http://drive-server-wip:3004/api CRYPTO_SECRET=6KYQBP847D4ATSFA MAGIC_IV=d139cb9a2cd17092e79e1861cf9d7023 MAGIC_SALT=38dce0391b49efba88dbc8c39ebf868f0267eb110bb0012ab27dc52a528d61b1d1ed9d76f400ff58e3240028442b1eab9bb84e111d9dadd997982dbde9dbd25e diff --git a/react/features/authentication/internxt/types/config.types.ts b/react/features/authentication/internxt/types/config.types.ts index d1064655ab83..777979c951b1 100644 --- a/react/features/authentication/internxt/types/config.types.ts +++ b/react/features/authentication/internxt/types/config.types.ts @@ -1,5 +1,6 @@ export interface ConfigKeys { readonly DRIVE_API_URL: string; + readonly DRIVE_NEW_API_URL: string; readonly CRYPTO_SECRET: string; readonly MAGIC_IV: string; readonly MAGIC_SALT: string; diff --git a/react/features/base/connection/options8x8.ts b/react/features/base/connection/options8x8.ts index 89e93831cb52..af43b7176d47 100644 --- a/react/features/base/connection/options8x8.ts +++ b/react/features/base/connection/options8x8.ts @@ -2,16 +2,25 @@ import { ConfigService } from "../../authentication/internxt/config.service"; import { doGetJSON } from "../util/httpUtils"; import { IOptions } from "./actions.any"; -export async function get8x8JWT(inxtNewToken: string) { +export async function get8x8UserJWT(room: string) { //A Jitsi JWT, can be manually generated here: https://jaas.8x8.vc/#/apikeys //more documentation: https://developer.8x8.com/jaas/docs/api-keys-jwt - const res = await doGetJSON('https://api.internxt.com/drive/users/meet-token', false, { + const res = await doGetJSON(ConfigService.instance.get('DRIVE_NEW_API_URL') + '/users/meet-token?room=' + room, false, { + method: 'get', + }); + return res; +} + +export async function get8x8CreatorJWT(inxtNewToken: string) { + //A Jitsi JWT, can be manually generated here: https://jaas.8x8.vc/#/apikeys + //more documentation: https://developer.8x8.com/jaas/docs/api-keys-jwt + const res = await doGetJSON(ConfigService.instance.get('DRIVE_NEW_API_URL') + '/users/meet-token/creator', false, { method: 'get', headers: new Headers({ 'Authorization': 'Bearer ' + inxtNewToken, }), }); - return res.token || ''; + return res; } export function get8x8AppId() { From d3e776783f7a5b3a7c08e19bdcbc03fb30f7daa5 Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Fri, 10 May 2024 16:14:14 +0200 Subject: [PATCH 02/19] some naming fixes --- lang/main-es.json | 2 +- lang/main.json | 2 +- react/features/app/actions.web.ts | 2 +- react/features/base/react/components/web/Watermarks.tsx | 2 +- react/features/conference/components/web/SubjectText.tsx | 2 +- title.html | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) diff --git a/lang/main-es.json b/lang/main-es.json index 0e0ab29875c8..fab932ab0d19 100644 --- a/lang/main-es.json +++ b/lang/main-es.json @@ -1465,7 +1465,7 @@ "roomnameHint": "Introduce el nombre o URL de la sala a la que deseas unirte. Puedes inventar un nombre, simplemente infórmaselo a las personas con las que te reunirás para que introduzcan el mismo nombre.", "sendFeedback": "Enviar sugerencias", "settings": "Ajustes", - "startMeeting": "Iniciar la reunión", + "startMeeting": "Iniciar nueva reunión", "terms": "Términos", "title": "Videoconferencias seguras, con gran variedad de funcionalidades y completamente gratuitas", "upcomingMeetings": "Tus próximas reuniones" diff --git a/lang/main.json b/lang/main.json index f2be6218d00e..aa24545df3e1 100644 --- a/lang/main.json +++ b/lang/main.json @@ -1534,7 +1534,7 @@ "roomnameHint": "Enter the name or URL of the room you want to join. You may make a name up, just let the people you are meeting know it so that they enter the same name.", "sendFeedback": "Send feedback", "settings": "Settings", - "startMeeting": "Start meeting", + "startMeeting": "Start new meeting", "terms": "Terms", "title": "Secure, fully featured, and completely free video conferencing", "upcomingMeetings": "Your upcoming meetings" diff --git a/react/features/app/actions.web.ts b/react/features/app/actions.web.ts index 9c482a33ba9f..dc25b5a0a191 100644 --- a/react/features/app/actions.web.ts +++ b/react/features/app/actions.web.ts @@ -142,7 +142,7 @@ export function maybeRedirectToWelcomePage(options: { feedbackSubmitted?: boolea // else: show thankYou dialog only if there is no feedback if (options.showThankYou) { dispatch(showNotification({ - titleArguments: { appName: getName() }, + titleArguments: { appName: 'Internxt Meet' }, titleKey: 'dialog.thankYou' }, NOTIFICATION_TIMEOUT_TYPE.STICKY)); } diff --git a/react/features/base/react/components/web/Watermarks.tsx b/react/features/base/react/components/web/Watermarks.tsx index b6b7d923b439..22d36eb801ec 100644 --- a/react/features/base/react/components/web/Watermarks.tsx +++ b/react/features/base/react/components/web/Watermarks.tsx @@ -256,7 +256,7 @@ function _mapStateToProps(state: IReduxState, ownProps: any) { } return { - _logoLink, + _logoLink: 'https://internxt.com', _logoUrl, _showJitsiWatermark }; diff --git a/react/features/conference/components/web/SubjectText.tsx b/react/features/conference/components/web/SubjectText.tsx index c21868876f11..d255eda663cc 100644 --- a/react/features/conference/components/web/SubjectText.tsx +++ b/react/features/conference/components/web/SubjectText.tsx @@ -46,7 +46,7 @@ const SubjectText = () => { content = { subject } position = 'bottom'>
-
{subject}
+
Internxt Meet
); diff --git a/title.html b/title.html index 01c19d93f713..435f5afe5740 100644 --- a/title.html +++ b/title.html @@ -3,7 +3,7 @@ - + \ No newline at end of file From 702b4b9ece0103949c1b4c330c8a50dd824c3f54 Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Fri, 10 May 2024 16:15:16 +0200 Subject: [PATCH 03/19] renew jwt jitsi token if its not valid --- react/features/base/connection/actions.any.ts | 7 +- react/features/base/jwt/functions.ts | 80 +++++++++++++++++++ react/features/jaas/functions.ts | 46 +++-------- 3 files changed, 97 insertions(+), 36 deletions(-) diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts index 4852ff7664f1..a2e9e93cd4f4 100644 --- a/react/features/base/connection/actions.any.ts +++ b/react/features/base/connection/actions.any.ts @@ -223,9 +223,12 @@ export function _connectInternal(id?: string, password?: string) { const { locationURL } = state['features/base/connection']; const room = state['features/base/conference'].room || ''; + let jwt = localStorage.getItem('jToken'); + + if (!jwt || !isJwtValid(jwt)) { + jwt = (await get8x8UserJWT(room)).token; + } - const inxtToken = localStorage.getItem('xNewToken') || ''; - const jwt = await get8x8JWT(inxtToken); const appId = get8x8AppId(); const newOptions = get8x8Options(options, appId, room); diff --git a/react/features/base/jwt/functions.ts b/react/features/base/jwt/functions.ts index a500103adefd..886a715a7584 100644 --- a/react/features/base/jwt/functions.ts +++ b/react/features/base/jwt/functions.ts @@ -206,3 +206,83 @@ export function getJwtExpirationDate(jwt: string | undefined) { return new Date(exp * 1000); } } + + +/** + * Extracts and returns the expiration date of jwt. + * + * @param {string|undefined} jwt - The jwt to check. + * @returns {Date} The expiration date of the jwt. + */ +export function isJwtValid(jwt: string | undefined) { + if (!jwt) { + return false; + } + + const currentTimestamp = new Date().getTime(); + try { + const header = jwtDecode(jwt, { header: true }); + const payload = jwtDecode(jwt); + + if (!header) { + return false; + } + if (!payload) { + return false; + } + + const { + aud, + context, + exp, + iss, + nbf, + sub + } = payload; + + // JaaS only + if (sub?.startsWith('vpaas-magic-cookie')) { + const { kid } = header; + + // if Key ID is missing, we return the error immediately without further validations. + if (!kid) { + return false; + } + + if (kid.substring(0, kid.indexOf('/')) !== sub) { + return false; + } + + if (aud !== 'jitsi') { + return false; + } + + if (iss !== 'chat') { + return false; + } + + if (!context?.features) { + return false; + } + } + + if (!isValidUnixTimestamp(nbf)) { + return false; + } else if (currentTimestamp < nbf * 1000) { + return false; + } + + if (!isValidUnixTimestamp(exp)) { + return false; + } else if (currentTimestamp > exp * 1000) { + return false; + } + + if (!context) { + return false; + } + } catch (e: any) { + return false; + } + return true; +} diff --git a/react/features/jaas/functions.ts b/react/features/jaas/functions.ts index 89ac44a59982..264ddadc3f07 100644 --- a/react/features/jaas/functions.ts +++ b/react/features/jaas/functions.ts @@ -1,5 +1,6 @@ import { IReduxState } from '../app/types'; import { IJitsiConference } from '../base/conference/reducer'; +import { get8x8UserJWT } from '../base/connection/options8x8'; import { VPAAS_TENANT_PREFIX } from './constants'; import logger from './logger'; @@ -120,26 +121,10 @@ export function isFeatureDisabled(state: IReduxState, feature: string) { * @param {string} reqData.baseUrl - The base url for the request. * @returns {void} */ -export async function sendGetJWTRequest({ appId, baseUrl }: { - appId: string; - baseUrl: string; +export async function sendGetJWTRequest({ room }: { + room: string; }) { - const fullUrl = `${baseUrl}/v1/public/token/${encodeURIComponent(appId)}`; - - try { - const res = await fetch(fullUrl, { - method: 'GET' - }); - - if (res.ok) { - return res.json(); - } - - throw new Error('Request not successful'); - } catch (err: any) { - throw new Error(err); - - } + return await get8x8UserJWT(room); } /** @@ -149,21 +134,14 @@ export async function sendGetJWTRequest({ appId, baseUrl }: { * @returns {string} The JWT. */ export async function getJaasJWT(state: IReduxState) { - const baseUrl = state['features/base/config'].jaasTokenUrl; - const appId = getVpaasTenant(state); - - const shouldSendRequest = Boolean(baseUrl && appId); - - if (shouldSendRequest) { - try { - const jwt = await sendGetJWTRequest({ - appId, - baseUrl: baseUrl ?? '' - }); + const room = state['features/base/conference'].room || ''; + try { + const jwt = await sendGetJWTRequest({ + room, + }); - return jwt.token; - } catch (err) { - logger.error('Could not send request', err); - } + return jwt.token; + } catch (err) { + logger.error('Could not send request', err); } } From 5f4eceaeb80020dabcabe11cf3240bb0a7804f0d Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Fri, 10 May 2024 16:16:59 +0200 Subject: [PATCH 04/19] added jitsi creator token when creating new room --- .../welcome/components/AbstractWelcomePage.ts | 21 ++++------ .../features/welcome/components/LoginPage.tsx | 35 +++++++++++----- .../welcome/components/WelcomePage.web.tsx | 41 +++++-------------- 3 files changed, 44 insertions(+), 53 deletions(-) diff --git a/react/features/welcome/components/AbstractWelcomePage.ts b/react/features/welcome/components/AbstractWelcomePage.ts index f714169c6984..e646671a52c5 100644 --- a/react/features/welcome/components/AbstractWelcomePage.ts +++ b/react/features/welcome/components/AbstractWelcomePage.ts @@ -12,6 +12,7 @@ import isInsecureRoomName from '../../base/util/isInsecureRoomName'; import { isCalendarEnabled } from '../../calendar-sync/functions'; import { isUnsafeRoomWarningEnabled } from '../../prejoin/functions'; import { isRecentListEnabled } from '../../recent-list/functions'; +import { get8x8CreatorJWT } from '../../base/connection/options8x8'; /** * {@code AbstractWelcomePage}'s React {@code Component} prop types. @@ -206,24 +207,20 @@ export class AbstractWelcomePage

extends Component * @protected * @returns {void} */ - _onJoin() { - const room = this.state.room || this.state.generatedRoomName; + async _onJoin() { + this.setState({ joining: true }); - sendAnalytics( - createWelcomePageEvent('clicked', 'joinButton', { - isGenerated: !this.state.room, - room - })); - - if (room) { - this.setState({ joining: true }); + const meetTokenCreator = await get8x8CreatorJWT(localStorage.getItem('xNewToken') || ''); + if (meetTokenCreator?.token && meetTokenCreator?.room) { // By the time the Promise of appNavigate settles, this component // may have already been unmounted. const onAppNavigateSettled = () => this._mounted && this.setState({ joining: false }); - this.props.dispatch(appNavigate(room)) + localStorage.setItem('jToken', meetTokenCreator.token); + + this.props.dispatch(appNavigate(meetTokenCreator.room)) .then(onAppNavigateSettled, onAppNavigateSettled); } } @@ -284,7 +281,7 @@ export class AbstractWelcomePage

extends Component * @protected * @returns {void} */ - _updateInxtToken = (inxtToken: string) =>{ + _updateInxtToken = (inxtToken: string) => { this.setState( { inxtToken, diff --git a/react/features/welcome/components/LoginPage.tsx b/react/features/welcome/components/LoginPage.tsx index 9d8ecfcc05e4..d8307907e945 100644 --- a/react/features/welcome/components/LoginPage.tsx +++ b/react/features/welcome/components/LoginPage.tsx @@ -1,6 +1,7 @@ import React, { useState } from 'react'; import { ValidationService } from '../../authentication/internxt/validation.service'; import { AuthService } from '../../authentication/internxt/auth.service'; +import { get8x8CreatorJWT } from '../../base/connection/options8x8'; const Login = (props: { _updateInxtToken: (token: string) => void }) => { const [email, setEmail] = useState(''); @@ -29,19 +30,31 @@ const Login = (props: { _updateInxtToken: (token: string) => void }) => { return; } - const is2FANeeded = await AuthService.instance.is2FANeeded(email); - let twoFactorCode: string | undefined; - if (is2FANeeded) { - twoFactorCode = ''; - } + try { + const is2FANeeded = await AuthService.instance.is2FANeeded(email); + let twoFactorCode: string | undefined; + if (is2FANeeded) { + twoFactorCode = ''; + } + + const loginCredentials = await AuthService.instance.doLogin(email, password, twoFactorCode); - const loginCredentials = await AuthService.instance.doLogin(email, password, twoFactorCode); + if (loginCredentials?.newToken && loginCredentials?.user) { + const meetTokenCreator = await get8x8CreatorJWT(loginCredentials.newToken); - localStorage.setItem('xToken', loginCredentials.token); - localStorage.setItem('xMnemonic', loginCredentials.mnemonic); - localStorage.setItem('xNewToken', loginCredentials.newToken); - localStorage.setItem('xUser', JSON.stringify(loginCredentials.user)); - props._updateInxtToken(loginCredentials.newToken); + if (meetTokenCreator?.token && meetTokenCreator?.room) { + localStorage.setItem('xToken', loginCredentials.token); + localStorage.setItem('xMnemonic', loginCredentials.mnemonic); + localStorage.setItem('xNewToken', loginCredentials.newToken); + localStorage.setItem('xUser', JSON.stringify(loginCredentials.user)); + + props._updateInxtToken(loginCredentials.newToken); + } else { + // user can not create meetings + } + } + } catch (err) { + } }; return ( diff --git a/react/features/welcome/components/WelcomePage.web.tsx b/react/features/welcome/components/WelcomePage.web.tsx index d83272c8805c..2f19122b6afb 100644 --- a/react/features/welcome/components/WelcomePage.web.tsx +++ b/react/features/welcome/components/WelcomePage.web.tsx @@ -235,36 +235,17 @@ class WelcomePage extends AbstractWelcomePage { {t('welcomepage.headerSubtitle')} -

-
-
-
- -
-
- - -
+
+
{this._titleHasNotAllowCharacter && (
Date: Fri, 10 May 2024 16:17:25 +0200 Subject: [PATCH 05/19] added missing imports --- react/features/base/connection/actions.any.ts | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts index a2e9e93cd4f4..7d3986f45027 100644 --- a/react/features/base/connection/actions.any.ts +++ b/react/features/base/connection/actions.any.ts @@ -23,7 +23,8 @@ import { import { JITSI_CONNECTION_URL_KEY } from './constants'; import logger from './logger'; import { ConnectionFailedError, IIceServers } from './types'; -import { get8x8AppId, get8x8JWT, get8x8Options } from './options8x8'; +import { get8x8AppId, get8x8UserJWT, get8x8Options } from './options8x8'; +import { isJwtValid } from '../jwt/functions'; /** * The options that will be passed to the JitsiConnection instance. From 4319bcd45f37b6f72a1a5ffc4381935f0a31b812 Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Tue, 14 May 2024 12:12:44 +0200 Subject: [PATCH 06/19] improved meet token management --- react/features/base/connection/actions.any.ts | 10 ++------- react/features/base/connection/options8x8.ts | 22 ++++++++++++++++--- react/features/jaas/functions.ts | 6 ++--- .../welcome/components/AbstractWelcomePage.ts | 8 +++---- .../features/welcome/components/LoginPage.tsx | 4 ++-- 5 files changed, 29 insertions(+), 21 deletions(-) diff --git a/react/features/base/connection/actions.any.ts b/react/features/base/connection/actions.any.ts index 7d3986f45027..c1d99e3214c5 100644 --- a/react/features/base/connection/actions.any.ts +++ b/react/features/base/connection/actions.any.ts @@ -23,8 +23,7 @@ import { import { JITSI_CONNECTION_URL_KEY } from './constants'; import logger from './logger'; import { ConnectionFailedError, IIceServers } from './types'; -import { get8x8AppId, get8x8UserJWT, get8x8Options } from './options8x8'; -import { isJwtValid } from '../jwt/functions'; +import { get8x8AppId, get8x8Options, get8x8JWT } from './options8x8'; /** * The options that will be passed to the JitsiConnection instance. @@ -224,12 +223,7 @@ export function _connectInternal(id?: string, password?: string) { const { locationURL } = state['features/base/connection']; const room = state['features/base/conference'].room || ''; - let jwt = localStorage.getItem('jToken'); - - if (!jwt || !isJwtValid(jwt)) { - jwt = (await get8x8UserJWT(room)).token; - } - + const jwt = await get8x8JWT(room); const appId = get8x8AppId(); const newOptions = get8x8Options(options, appId, room); diff --git a/react/features/base/connection/options8x8.ts b/react/features/base/connection/options8x8.ts index af43b7176d47..58a171f78a5f 100644 --- a/react/features/base/connection/options8x8.ts +++ b/react/features/base/connection/options8x8.ts @@ -5,16 +5,16 @@ import { IOptions } from "./actions.any"; export async function get8x8UserJWT(room: string) { //A Jitsi JWT, can be manually generated here: https://jaas.8x8.vc/#/apikeys //more documentation: https://developer.8x8.com/jaas/docs/api-keys-jwt - const res = await doGetJSON(ConfigService.instance.get('DRIVE_NEW_API_URL') + '/users/meet-token?room=' + room, false, { + const res = await doGetJSON(`${ConfigService.instance.get('DRIVE_NEW_API_URL')}/users/meet-token/anon?room=${room}`, false, { method: 'get', }); return res; } -export async function get8x8CreatorJWT(inxtNewToken: string) { +export async function get8x8BetaJWT(inxtNewToken: string, room?: string) { //A Jitsi JWT, can be manually generated here: https://jaas.8x8.vc/#/apikeys //more documentation: https://developer.8x8.com/jaas/docs/api-keys-jwt - const res = await doGetJSON(ConfigService.instance.get('DRIVE_NEW_API_URL') + '/users/meet-token/creator', false, { + const res = await doGetJSON(`${ConfigService.instance.get('DRIVE_NEW_API_URL')}/users/meet-token/beta${room ? '?room=' : ''}`, false, { method: 'get', headers: new Headers({ 'Authorization': 'Bearer ' + inxtNewToken, @@ -23,6 +23,22 @@ export async function get8x8CreatorJWT(inxtNewToken: string) { return res; } +export async function get8x8JWT(room?: string) { + let jwt: string | undefined; + let inxtUserToken = localStorage.getItem('xNewToken'); + if (inxtUserToken) { + try { + jwt = (await get8x8BetaJWT(inxtUserToken, room)).token; + } catch { } + } + if (!jwt) { + try { + jwt = (await get8x8UserJWT(room || '')).token; + } catch { } + } + return jwt; +} + export function get8x8AppId() { //AppID is an unique user ID, can be aquired from https://jaas.8x8.vc/#/apikeys const appId = ConfigService.instance.get('JITSI_APP_ID'); diff --git a/react/features/jaas/functions.ts b/react/features/jaas/functions.ts index 264ddadc3f07..2f2e24883365 100644 --- a/react/features/jaas/functions.ts +++ b/react/features/jaas/functions.ts @@ -1,6 +1,6 @@ import { IReduxState } from '../app/types'; import { IJitsiConference } from '../base/conference/reducer'; -import { get8x8UserJWT } from '../base/connection/options8x8'; +import { get8x8JWT } from '../base/connection/options8x8'; import { VPAAS_TENANT_PREFIX } from './constants'; import logger from './logger'; @@ -124,7 +124,7 @@ export function isFeatureDisabled(state: IReduxState, feature: string) { export async function sendGetJWTRequest({ room }: { room: string; }) { - return await get8x8UserJWT(room); + return await get8x8JWT(room); } /** @@ -140,7 +140,7 @@ export async function getJaasJWT(state: IReduxState) { room, }); - return jwt.token; + return jwt; } catch (err) { logger.error('Could not send request', err); } diff --git a/react/features/welcome/components/AbstractWelcomePage.ts b/react/features/welcome/components/AbstractWelcomePage.ts index e646671a52c5..b650116a4215 100644 --- a/react/features/welcome/components/AbstractWelcomePage.ts +++ b/react/features/welcome/components/AbstractWelcomePage.ts @@ -12,7 +12,7 @@ import isInsecureRoomName from '../../base/util/isInsecureRoomName'; import { isCalendarEnabled } from '../../calendar-sync/functions'; import { isUnsafeRoomWarningEnabled } from '../../prejoin/functions'; import { isRecentListEnabled } from '../../recent-list/functions'; -import { get8x8CreatorJWT } from '../../base/connection/options8x8'; +import { get8x8BetaJWT } from '../../base/connection/options8x8'; /** * {@code AbstractWelcomePage}'s React {@code Component} prop types. @@ -210,16 +210,14 @@ export class AbstractWelcomePage

extends Component async _onJoin() { this.setState({ joining: true }); - const meetTokenCreator = await get8x8CreatorJWT(localStorage.getItem('xNewToken') || ''); + const meetTokenCreator = await get8x8BetaJWT(localStorage.getItem('xNewToken') || ''); - if (meetTokenCreator?.token && meetTokenCreator?.room) { + if (meetTokenCreator?.room) { // By the time the Promise of appNavigate settles, this component // may have already been unmounted. const onAppNavigateSettled = () => this._mounted && this.setState({ joining: false }); - localStorage.setItem('jToken', meetTokenCreator.token); - this.props.dispatch(appNavigate(meetTokenCreator.room)) .then(onAppNavigateSettled, onAppNavigateSettled); } diff --git a/react/features/welcome/components/LoginPage.tsx b/react/features/welcome/components/LoginPage.tsx index d8307907e945..02f9181c70c3 100644 --- a/react/features/welcome/components/LoginPage.tsx +++ b/react/features/welcome/components/LoginPage.tsx @@ -1,7 +1,7 @@ import React, { useState } from 'react'; import { ValidationService } from '../../authentication/internxt/validation.service'; import { AuthService } from '../../authentication/internxt/auth.service'; -import { get8x8CreatorJWT } from '../../base/connection/options8x8'; +import { get8x8BetaJWT } from '../../base/connection/options8x8'; const Login = (props: { _updateInxtToken: (token: string) => void }) => { const [email, setEmail] = useState(''); @@ -40,7 +40,7 @@ const Login = (props: { _updateInxtToken: (token: string) => void }) => { const loginCredentials = await AuthService.instance.doLogin(email, password, twoFactorCode); if (loginCredentials?.newToken && loginCredentials?.user) { - const meetTokenCreator = await get8x8CreatorJWT(loginCredentials.newToken); + const meetTokenCreator = await get8x8BetaJWT(loginCredentials.newToken); if (meetTokenCreator?.token && meetTokenCreator?.room) { localStorage.setItem('xToken', loginCredentials.token); From e3c10b55f3961f8604fb24347a9b2fb7e08aa4b8 Mon Sep 17 00:00:00 2001 From: larry-internxt Date: Tue, 14 May 2024 13:48:09 +0200 Subject: [PATCH 07/19] fixed room beta jwt and added logout button --- react/features/base/connection/options8x8.ts | 3 ++- .../base/ui/components/web/DialogWithTabs.tsx | 12 ++++++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/react/features/base/connection/options8x8.ts b/react/features/base/connection/options8x8.ts index 58a171f78a5f..2d7418c2cb8a 100644 --- a/react/features/base/connection/options8x8.ts +++ b/react/features/base/connection/options8x8.ts @@ -14,7 +14,8 @@ export async function get8x8UserJWT(room: string) { export async function get8x8BetaJWT(inxtNewToken: string, room?: string) { //A Jitsi JWT, can be manually generated here: https://jaas.8x8.vc/#/apikeys //more documentation: https://developer.8x8.com/jaas/docs/api-keys-jwt - const res = await doGetJSON(`${ConfigService.instance.get('DRIVE_NEW_API_URL')}/users/meet-token/beta${room ? '?room=' : ''}`, false, { + const roomString = room ? `?room=${room}` : ''; + const res = await doGetJSON(`${ConfigService.instance.get('DRIVE_NEW_API_URL')}/users/meet-token/beta${roomString}`, false, { method: 'get', headers: new Headers({ 'Authorization': 'Bearer ' + inxtNewToken, diff --git a/react/features/base/ui/components/web/DialogWithTabs.tsx b/react/features/base/ui/components/web/DialogWithTabs.tsx index 5d5929e74f4d..dfe515f532be 100644 --- a/react/features/base/ui/components/web/DialogWithTabs.tsx +++ b/react/features/base/ui/components/web/DialogWithTabs.tsx @@ -12,6 +12,7 @@ import BaseDialog, { IProps as IBaseProps } from './BaseDialog'; import Button from './Button'; import ClickableIcon from './ClickableIcon'; import ContextMenuItem from './ContextMenuItem'; +import { redirectToStaticPage } from '../../../../app/actions.any'; const MOBILE_BREAKPOINT = 607; @@ -214,6 +215,11 @@ const DialogWithTabs = ({ } }, [ isMobile, userSelected, selectedTab ]); + const onLogout = () => { + localStorage.setItem('xNewToken', ''); + dispatch(redirectToStaticPage('/')); + }; + const onClose = useCallback((isCancel = true) => { if (isCancel) { tabs.forEach(({ cancel }) => { @@ -398,6 +404,12 @@ const DialogWithTabs = ({ )}

+