Fix templating for v1 jitsi widgets
Fixes https://github.com/vector-im/element-web/issues/15427
This commit is contained in:
parent
f528a161ad
commit
3e7f117611
1 changed files with 21 additions and 1 deletions
|
@ -19,11 +19,13 @@ import {
|
||||||
ClientWidgetApi,
|
ClientWidgetApi,
|
||||||
IStickerActionRequest,
|
IStickerActionRequest,
|
||||||
IStickyActionRequest,
|
IStickyActionRequest,
|
||||||
|
ITemplateParams,
|
||||||
IWidget,
|
IWidget,
|
||||||
IWidgetApiRequest,
|
IWidgetApiRequest,
|
||||||
IWidgetApiRequestEmptyData,
|
IWidgetApiRequestEmptyData,
|
||||||
IWidgetData,
|
IWidgetData,
|
||||||
MatrixCapabilities,
|
MatrixCapabilities,
|
||||||
|
runTemplate,
|
||||||
Widget,
|
Widget,
|
||||||
WidgetApiFromWidgetAction,
|
WidgetApiFromWidgetAction,
|
||||||
} from "matrix-widget-api";
|
} from "matrix-widget-api";
|
||||||
|
@ -76,15 +78,33 @@ class ElementWidget extends Widget {
|
||||||
let conferenceId = super.rawData['conferenceId'];
|
let conferenceId = super.rawData['conferenceId'];
|
||||||
if (conferenceId === undefined) {
|
if (conferenceId === undefined) {
|
||||||
// we'll need to parse the conference ID out of the URL for v1 Jitsi widgets
|
// we'll need to parse the conference ID out of the URL for v1 Jitsi widgets
|
||||||
const parsedUrl = new URL(this.templateUrl);
|
const parsedUrl = new URL(super.templateUrl); // use super to get the raw widget URL
|
||||||
conferenceId = parsedUrl.searchParams.get("confId");
|
conferenceId = parsedUrl.searchParams.get("confId");
|
||||||
}
|
}
|
||||||
|
let domain = super.rawData['domain'];
|
||||||
|
if (domain === undefined) {
|
||||||
|
// v1 widgets default to jitsi.riot.im regardless of user settings
|
||||||
|
domain = "jitsi.riot.im";
|
||||||
|
}
|
||||||
return {
|
return {
|
||||||
...super.rawData,
|
...super.rawData,
|
||||||
theme: SettingsStore.getValue("theme"),
|
theme: SettingsStore.getValue("theme"),
|
||||||
conferenceId,
|
conferenceId,
|
||||||
|
domain,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public getCompleteUrl(params: ITemplateParams): string {
|
||||||
|
return runTemplate(this.templateUrl, {
|
||||||
|
// we need to supply a whole widget to the template, but don't have
|
||||||
|
// easy access to the definition the superclass is using, so be sad
|
||||||
|
// and gutwrench it.
|
||||||
|
// This isn't a problem when the widget architecture is fixed and this
|
||||||
|
// subclass gets deleted.
|
||||||
|
...super['definition'], // XXX: Private member access
|
||||||
|
data: this.rawData,
|
||||||
|
}, params);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export class StopGapWidget extends EventEmitter {
|
export class StopGapWidget extends EventEmitter {
|
||||||
|
|
Loading…
Reference in a new issue