mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-10-01 01:05:53 -04:00
Also support editing Jitsi widgets
This commit is contained in:
parent
993dcdac21
commit
eb59940907
@ -60,8 +60,24 @@ export class JitsiWidgetConfigComponent extends WidgetComponent implements Modal
|
|||||||
}
|
}
|
||||||
|
|
||||||
public validateAndAddWidget() {
|
public validateAndAddWidget() {
|
||||||
const conferenceUrl = "https://" + this.integration.jitsiDomain + "/" + this.newWidgetName;
|
const jitsiConfig = this.getJitsiConfig(this.integration.jitsiDomain, this.newWidgetName);
|
||||||
const conferenceId = this.newWidgetName;
|
|
||||||
|
this.newWidgetUrl = jitsiConfig.url;
|
||||||
|
this.newWidgetName = "Jitsi Video Conference";
|
||||||
|
this.addWidget(jitsiConfig.data);
|
||||||
|
}
|
||||||
|
|
||||||
|
public validateAndSaveWidget(widget: Widget) {
|
||||||
|
const jitsiUrl = url.parse(widget.data.dimConferenceUrl);
|
||||||
|
const jitsiConfig = this.getJitsiConfig(jitsiUrl.host, jitsiUrl.path.substring(1));
|
||||||
|
|
||||||
|
widget.newUrl = jitsiConfig.url;
|
||||||
|
widget.data = jitsiConfig.data;
|
||||||
|
this.saveWidget(widget);
|
||||||
|
}
|
||||||
|
|
||||||
|
private getJitsiConfig(domain: string, conferenceId: string): {url: string, data: any} {
|
||||||
|
const conferenceUrl = "https://" + domain + "/" + encodeURIComponent(conferenceId);
|
||||||
const data = {
|
const data = {
|
||||||
dimOriginalConferenceUrl: conferenceUrl,
|
dimOriginalConferenceUrl: conferenceUrl,
|
||||||
dimConferenceUrl: conferenceUrl,
|
dimConferenceUrl: conferenceUrl,
|
||||||
@ -70,7 +86,7 @@ export class JitsiWidgetConfigComponent extends WidgetComponent implements Modal
|
|||||||
let widgetQueryString = url.format({
|
let widgetQueryString = url.format({
|
||||||
query: {
|
query: {
|
||||||
//"scriptUrl": this.integration.scriptUrl, // handled in wrapper
|
//"scriptUrl": this.integration.scriptUrl, // handled in wrapper
|
||||||
"domain": this.integration.jitsiDomain,
|
"domain": domain,
|
||||||
"conferenceId": conferenceId,
|
"conferenceId": conferenceId,
|
||||||
"displayName": "$matrix_display_name",
|
"displayName": "$matrix_display_name",
|
||||||
"avatarUrl": "$matrix_avatar_url",
|
"avatarUrl": "$matrix_avatar_url",
|
||||||
@ -79,13 +95,10 @@ export class JitsiWidgetConfigComponent extends WidgetComponent implements Modal
|
|||||||
});
|
});
|
||||||
widgetQueryString = this.unformatParams(widgetQueryString, data);
|
widgetQueryString = this.unformatParams(widgetQueryString, data);
|
||||||
|
|
||||||
this.newWidgetUrl = window.location.origin + "/widgets/jitsi" + widgetQueryString;
|
return {
|
||||||
this.newWidgetName = "Jitsi Video Conference";
|
url: window.location.origin + "/widgets/jitsi" + widgetQueryString,
|
||||||
this.addWidget(data);
|
data: data,
|
||||||
}
|
};
|
||||||
|
|
||||||
public validateAndSaveWidget(widget: Widget) {
|
|
||||||
console.log(widget);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected widgetAdded() {
|
protected widgetAdded() {
|
||||||
|
Loading…
Reference in New Issue
Block a user