Merge pull request #4252 from matrix-org/travis/jitsi-mobile

Support Jitsi conferences sent/received on Riot Mobile and older Riot Webs
pull/21833/head
Travis Ralston 2020-03-24 08:56:22 -06:00 committed by GitHub
commit 26bda5933b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 23 additions and 6 deletions

View File

@ -433,7 +433,13 @@ async function _startCallApp(roomId, type) {
const confId = `JitsiConference_${generateHumanReadableId()}`;
const jitsiDomain = SdkConfig.get()['jitsi']['preferredDomain'];
const widgetUrl = WidgetUtils.getLocalJitsiWrapperUrl();
let widgetUrl = WidgetUtils.getLocalJitsiWrapperUrl();
// TODO: Remove URL hacks when the mobile clients eventually support v2 widgets
const parsedUrl = new URL(widgetUrl);
parsedUrl.search = ''; // set to empty string to make the URL class use searchParams instead
parsedUrl.searchParams.set('confId', confId);
widgetUrl = parsedUrl.toString();
const widgetData = {
conferenceId: confId,

View File

@ -422,6 +422,22 @@ export default class WidgetUtils {
app.eventId = eventId;
app.name = app.name || app.type;
if (app.type === 'jitsi') {
console.log("Replacing Jitsi widget URL with local wrapper");
if (!app.data || !app.data.conferenceId) {
// Assumed to be a v1 widget: add a data object for visibility on the wrapper
// TODO: Remove this once mobile supports v2 widgets
console.log("Replacing v1 Jitsi widget with v2 equivalent");
const parsed = new URL(app.url);
app.data = {
conferenceId: parsed.searchParams.get("confId"),
domain: "jitsi.riot.im", // v1 widgets have this hardcoded
};
}
app.url = WidgetUtils.getLocalJitsiWrapperUrl({forLocalRender: true});
}
if (app.data) {
Object.keys(app.data).forEach((key) => {
params['$' + key] = app.data[key];
@ -430,11 +446,6 @@ export default class WidgetUtils {
app.waitForIframeLoad = (app.data.waitForIframeLoad === 'false' ? false : true);
}
if (app.type === 'jitsi') {
console.log("Replacing Jitsi widget URL with local wrapper");
app.url = WidgetUtils.getLocalJitsiWrapperUrl({forLocalRender: true});
}
app.url = encodeUri(app.url, params);
return app;