[FIX] Support Jitsi_URL_Room_Hash (#2905)
This commit is contained in:
parent
3532cb349c
commit
f579641660
|
@ -101,6 +101,9 @@ export default {
|
|||
Jitsi_Enabled_TokenAuth: {
|
||||
type: 'valueAsBoolean'
|
||||
},
|
||||
Jitsi_URL_Room_Hash: {
|
||||
type: 'valueAsBoolean'
|
||||
},
|
||||
Jitsi_URL_Room_Prefix: {
|
||||
type: 'valueAsString'
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ import reduxStore from '../createStore';
|
|||
import Navigation from '../Navigation';
|
||||
import { logEvent, events } from '../../utils/log';
|
||||
|
||||
async function jitsiURL({ rid }) {
|
||||
async function jitsiURL({ room }) {
|
||||
const { settings } = reduxStore.getState();
|
||||
const { Jitsi_Enabled } = settings;
|
||||
|
||||
|
@ -11,31 +11,37 @@ async function jitsiURL({ rid }) {
|
|||
}
|
||||
|
||||
const {
|
||||
Jitsi_Domain, Jitsi_URL_Room_Prefix, Jitsi_SSL, Jitsi_Enabled_TokenAuth, uniqueID
|
||||
Jitsi_Domain, Jitsi_URL_Room_Prefix, Jitsi_SSL, Jitsi_Enabled_TokenAuth, uniqueID, Jitsi_URL_Room_Hash
|
||||
} = settings;
|
||||
|
||||
const domain = `${ Jitsi_Domain }/`;
|
||||
const prefix = Jitsi_URL_Room_Prefix;
|
||||
const uniqueIdentifier = uniqueID || 'undefined';
|
||||
const protocol = Jitsi_SSL ? 'https://' : 'http://';
|
||||
|
||||
let queryString = '';
|
||||
if (Jitsi_Enabled_TokenAuth) {
|
||||
try {
|
||||
const accessToken = await this.methodCallWrapper('jitsi:generateAccessToken', rid);
|
||||
const accessToken = await this.methodCallWrapper('jitsi:generateAccessToken', room?.rid);
|
||||
queryString = `?jwt=${ accessToken }`;
|
||||
} catch {
|
||||
logEvent(events.RA_JITSI_F);
|
||||
}
|
||||
}
|
||||
|
||||
return `${ protocol }${ domain }${ prefix }${ uniqueIdentifier }${ rid }${ queryString }`;
|
||||
let rname;
|
||||
if (Jitsi_URL_Room_Hash) {
|
||||
rname = uniqueID + room?.rid;
|
||||
} else {
|
||||
rname = encodeURIComponent(room.t === 'd' ? room?.usernames?.join?.(' x ') : room?.name);
|
||||
}
|
||||
|
||||
async function callJitsi(rid, onlyAudio = false) {
|
||||
return `${ protocol }${ domain }${ prefix }${ rname }${ queryString }`;
|
||||
}
|
||||
|
||||
async function callJitsi(room, onlyAudio = false) {
|
||||
logEvent(onlyAudio ? events.RA_JITSI_AUDIO : events.RA_JITSI_VIDEO);
|
||||
const url = await jitsiURL.call(this, { rid });
|
||||
Navigation.navigate('JitsiMeetView', { url, onlyAudio, rid });
|
||||
const url = await jitsiURL.call(this, { room });
|
||||
Navigation.navigate('JitsiMeetView', { url, onlyAudio, rid: room?.rid });
|
||||
}
|
||||
|
||||
export default callJitsi;
|
||||
|
|
|
@ -75,7 +75,8 @@ export default async function canOpenRoom({ rid, path, isCall }) {
|
|||
name: room.name,
|
||||
fname: room.fname,
|
||||
prid: room.prid,
|
||||
uids: room.uids
|
||||
uids: room.uids,
|
||||
usernames: room.usernames
|
||||
};
|
||||
} catch (e) {
|
||||
// Do nothing
|
||||
|
|
|
@ -53,7 +53,7 @@ const navigate = function* navigate({ params }) {
|
|||
yield goRoom({ item, isMasterDetail });
|
||||
|
||||
if (params.isCall) {
|
||||
RocketChat.callJitsi(item.rid);
|
||||
RocketChat.callJitsi(item);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
|
|
@ -482,7 +482,7 @@ class RoomActionsView extends React.Component {
|
|||
<List.Separator />
|
||||
<List.Item
|
||||
title='Voice_call'
|
||||
onPress={() => RocketChat.callJitsi(room?.rid, true)}
|
||||
onPress={() => RocketChat.callJitsi(room, true)}
|
||||
testID='room-actions-voice'
|
||||
left={() => <List.Icon name='phone' />}
|
||||
showActionIndicator
|
||||
|
@ -490,7 +490,7 @@ class RoomActionsView extends React.Component {
|
|||
<List.Separator />
|
||||
<List.Item
|
||||
title='Video_call'
|
||||
onPress={() => RocketChat.callJitsi(room?.rid)}
|
||||
onPress={() => RocketChat.callJitsi(room)}
|
||||
testID='room-actions-video'
|
||||
left={() => <List.Icon name='camera' />}
|
||||
showActionIndicator
|
||||
|
|
|
@ -276,7 +276,7 @@ class RoomInfoView extends React.Component {
|
|||
|
||||
videoCall = () => {
|
||||
const { room } = this.state;
|
||||
RocketChat.callJitsi(room.rid);
|
||||
RocketChat.callJitsi(room);
|
||||
}
|
||||
|
||||
renderAvatar = (room, roomUser) => {
|
||||
|
|
|
@ -817,7 +817,7 @@ class RoomView extends React.Component {
|
|||
if (jitsiTimeout < Date.now()) {
|
||||
showErrorAlert(I18n.t('Call_already_ended'));
|
||||
} else {
|
||||
RocketChat.callJitsi(this.rid);
|
||||
RocketChat.callJitsi(room);
|
||||
}
|
||||
};
|
||||
|
||||
|
|
Loading…
Reference in New Issue