mirror of
https://github.com/element-hq/element-web
synced 2024-11-28 20:38:55 +03:00
Merge pull request #4255 from matrix-org/t3chguy/fix_local_jitsi
Fix local jitsi build url fail and missing argument
This commit is contained in:
commit
4ab53607a0
1 changed files with 6 additions and 9 deletions
|
@ -474,7 +474,7 @@ export default class WidgetUtils {
|
||||||
return encodeURIComponent(`${widgetLocation}::${widgetUrl}`);
|
return encodeURIComponent(`${widgetLocation}::${widgetUrl}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
static getLocalJitsiWrapperUrl(opts: {forLocalRender?: boolean}) {
|
static getLocalJitsiWrapperUrl(opts: {forLocalRender?: boolean}={}) {
|
||||||
// NB. we can't just encodeURIComponent all of these because the $ signs need to be there
|
// NB. we can't just encodeURIComponent all of these because the $ signs need to be there
|
||||||
const queryString = [
|
const queryString = [
|
||||||
'conferenceDomain=$domain',
|
'conferenceDomain=$domain',
|
||||||
|
@ -485,19 +485,16 @@ export default class WidgetUtils {
|
||||||
'userId=$matrix_user_id',
|
'userId=$matrix_user_id',
|
||||||
].join('&');
|
].join('&');
|
||||||
|
|
||||||
let currentUrl = window.location.href.split('#')[0];
|
let baseUrl = window.location;
|
||||||
if (!currentUrl.startsWith("https://") && !opts.forLocalRender) {
|
if (window.location.protocol !== "https:" && !opts.forLocalRender) {
|
||||||
// Use an external wrapper if we're not locally rendering the widget. This is usually
|
// Use an external wrapper if we're not locally rendering the widget. This is usually
|
||||||
// the URL that will end up in the widget event, so we want to make sure it's relatively
|
// the URL that will end up in the widget event, so we want to make sure it's relatively
|
||||||
// safe to send.
|
// safe to send.
|
||||||
// We'll end up using a local render URL when we see a Jitsi widget anyways, so this is
|
// We'll end up using a local render URL when we see a Jitsi widget anyways, so this is
|
||||||
// really just for backwards compatibility and to appease the spec.
|
// really just for backwards compatibility and to appease the spec.
|
||||||
currentUrl = "https://riot.im/app";
|
baseUrl = "https://riot.im/app";
|
||||||
}
|
}
|
||||||
if (!currentUrl.endsWith('/')) {
|
const url = new URL("jitsi.html#" + queryString, baseUrl); // this strips hash fragment from baseUrl
|
||||||
currentUrl = `${currentUrl}/`;
|
return url.href;
|
||||||
}
|
|
||||||
|
|
||||||
return currentUrl + "jitsi.html#" + queryString;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue