Use random widget IDs for video rooms (#8739)
This commit is contained in:
parent
abfc66a34e
commit
f152310c08
6 changed files with 15 additions and 17 deletions
|
@ -1035,8 +1035,7 @@ export default class CallHandler extends EventEmitter {
|
|||
}
|
||||
|
||||
try {
|
||||
const userId = client.credentials.userId;
|
||||
await WidgetUtils.addJitsiWidget(roomId, type, 'Jitsi', `jitsi_${userId}_${Date.now()}`);
|
||||
await WidgetUtils.addJitsiWidget(roomId, type, 'Jitsi', false);
|
||||
logger.log('Jitsi widget added');
|
||||
} catch (e) {
|
||||
if (e.errcode === 'M_FORBIDDEN') {
|
||||
|
|
|
@ -35,16 +35,15 @@ interface IVideoChannelMemberContent {
|
|||
devices: string[];
|
||||
}
|
||||
|
||||
export const VIDEO_CHANNEL = "io.element.video";
|
||||
export const VIDEO_CHANNEL_MEMBER = "io.element.video.member";
|
||||
|
||||
export const getVideoChannel = (roomId: string): IApp => {
|
||||
const apps = WidgetStore.instance.getApps(roomId);
|
||||
return apps.find(app => WidgetType.JITSI.matches(app.type) && app.id === VIDEO_CHANNEL);
|
||||
return apps.find(app => WidgetType.JITSI.matches(app.type) && app.data.isVideoChannel);
|
||||
};
|
||||
|
||||
export const addVideoChannel = async (roomId: string, roomName: string) => {
|
||||
await WidgetUtils.addJitsiWidget(roomId, CallType.Video, "Video channel", VIDEO_CHANNEL, roomName);
|
||||
await WidgetUtils.addJitsiWidget(roomId, CallType.Video, "Video channel", true, roomName);
|
||||
};
|
||||
|
||||
export const getConnectedMembers = (room: Room, connectedLocalEcho: boolean): Set<RoomMember> => {
|
||||
|
|
|
@ -23,7 +23,7 @@ import { MatrixEvent } from "matrix-js-sdk/src/models/event";
|
|||
import { logger } from "matrix-js-sdk/src/logger";
|
||||
import { ClientEvent, RoomStateEvent } from "matrix-js-sdk/src/matrix";
|
||||
import { CallType } from "matrix-js-sdk/src/webrtc/call";
|
||||
import { randomLowercaseString, randomUppercaseString } from "matrix-js-sdk/src/randomstring";
|
||||
import { randomString, randomLowercaseString, randomUppercaseString } from "matrix-js-sdk/src/randomstring";
|
||||
|
||||
import { MatrixClientPeg } from '../MatrixClientPeg';
|
||||
import SdkConfig from "../SdkConfig";
|
||||
|
@ -35,7 +35,6 @@ import { Jitsi } from "../widgets/Jitsi";
|
|||
import { objectClone } from "./objects";
|
||||
import { _t } from "../languageHandler";
|
||||
import { IApp } from "../stores/WidgetStore";
|
||||
import { VIDEO_CHANNEL } from "./VideoChannelUtils";
|
||||
|
||||
// How long we wait for the state event echo to come back from the server
|
||||
// before waitFor[Room/User]Widget rejects its promise
|
||||
|
@ -444,11 +443,12 @@ export default class WidgetUtils {
|
|||
roomId: string,
|
||||
type: CallType,
|
||||
name: string,
|
||||
widgetId: string,
|
||||
isVideoChannel: boolean,
|
||||
oobRoomName?: string,
|
||||
): Promise<void> {
|
||||
const domain = Jitsi.getInstance().preferredDomain;
|
||||
const auth = await Jitsi.getInstance().getJitsiAuth();
|
||||
const widgetId = randomString(24); // Must be globally unique
|
||||
|
||||
let confId;
|
||||
if (auth === 'openidtoken-jwt') {
|
||||
|
@ -471,7 +471,7 @@ export default class WidgetUtils {
|
|||
conferenceId: confId,
|
||||
roomName: oobRoomName ?? MatrixClientPeg.get().getRoom(roomId)?.name,
|
||||
isAudioOnly: type === CallType.Voice,
|
||||
isVideoChannel: widgetId === VIDEO_CHANNEL,
|
||||
isVideoChannel,
|
||||
domain,
|
||||
auth,
|
||||
});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue