mirror of
https://github.com/turt2live/matrix-dimension.git
synced 2024-09-04 16:12:11 +00:00
Use template variables and proper data attributes for Jitsi
Fixes https://github.com/turt2live/matrix-dimension/issues/176 Part of https://github.com/turt2live/matrix-dimension/issues/141
This commit is contained in:
parent
a529fc5f9f
commit
5f6658a194
@ -26,23 +26,34 @@ export class JitsiWidgetConfigComponent extends WidgetComponent {
|
|||||||
const confId = parsedUrl.query["confId"];
|
const confId = parsedUrl.query["confId"];
|
||||||
const domain = parsedUrl.query["domain"];
|
const domain = parsedUrl.query["domain"];
|
||||||
let isAudioConf: string | boolean = <string>parsedUrl.query["isAudioConf"];
|
let isAudioConf: string | boolean = <string>parsedUrl.query["isAudioConf"];
|
||||||
|
let isAudioOnly: string | boolean = <string>parsedUrl.query["isAudioOnly"];
|
||||||
|
|
||||||
// Convert isAudioConf to boolean
|
// Convert isAudioConf to boolean
|
||||||
if (isAudioConf === "true") isAudioConf = true;
|
if (isAudioConf === "true") isAudioConf = true;
|
||||||
else if (isAudioConf === "false") isAudioConf = false;
|
else if (isAudioConf === "false") isAudioConf = false;
|
||||||
else if (isAudioConf && isAudioConf[0] === '$') isAudioConf = widget.data[isAudioConf];
|
else if (isAudioConf && isAudioConf[0] === '$') isAudioConf = widget.data["isAudioConf"];
|
||||||
else isAudioConf = false; // default
|
else isAudioConf = null; // default
|
||||||
|
|
||||||
if (conferenceId) {
|
// Convert isAudioOnly to boolean
|
||||||
|
if (isAudioOnly === "true") isAudioOnly = true;
|
||||||
|
else if (isAudioOnly === "false") isAudioOnly = false;
|
||||||
|
else if (isAudioOnly && isAudioOnly[0] === '$') isAudioOnly = widget.data["isAudioOnly"];
|
||||||
|
else isAudioOnly = null; // default
|
||||||
|
|
||||||
|
if (confId) {
|
||||||
// It's a legacy Dimension widget
|
// It's a legacy Dimension widget
|
||||||
widget.data.confId = conferenceId;
|
widget.data.conferenceId = confId;
|
||||||
} else widget.data.confId = confId;
|
} else widget.data.conferenceId = conferenceId;
|
||||||
|
|
||||||
if (domain) widget.data.domain = domain;
|
if (domain) widget.data.domain = domain;
|
||||||
else widget.data.domain = "jitsi.riot.im";
|
else widget.data.domain = "jitsi.riot.im";
|
||||||
|
|
||||||
widget.data.isAudioConf = isAudioConf;
|
if (isAudioConf !== null) {
|
||||||
widget.data.conferenceUrl = "https://" + widget.data.domain + "/" + widget.data.confId;
|
// It's a legacy Dimension widget
|
||||||
|
widget.data.isAudioOnly = isAudioConf;
|
||||||
|
} else widget.data.isAudioOnly = !!isAudioOnly;
|
||||||
|
|
||||||
|
widget.data.conferenceUrl = "https://" + widget.data.domain + "/" + widget.data.conferenceId;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -68,15 +79,14 @@ export class JitsiWidgetConfigComponent extends WidgetComponent {
|
|||||||
private setJitsiUrl(widget: EditableWidget) {
|
private setJitsiUrl(widget: EditableWidget) {
|
||||||
const jitsiUrl = url.parse(widget.dimension.newData.conferenceUrl);
|
const jitsiUrl = url.parse(widget.dimension.newData.conferenceUrl);
|
||||||
widget.dimension.newData.domain = jitsiUrl.host;
|
widget.dimension.newData.domain = jitsiUrl.host;
|
||||||
widget.dimension.newData.confId = jitsiUrl.path.substring(1);
|
widget.dimension.newData.conferenceId = jitsiUrl.path.substring(1);
|
||||||
widget.dimension.newData.isAudioConf = false;
|
widget.dimension.newData.isAudioOnly = false;
|
||||||
|
|
||||||
let widgetQueryString = url.format({
|
let widgetQueryString = url.format({
|
||||||
query: {
|
query: {
|
||||||
// TODO: Use templating when mobile riot supports it
|
"conferenceId": "$conferenceId",
|
||||||
"confId": widget.dimension.newData.confId,
|
"domain": "$domain",
|
||||||
"domain": widget.dimension.newData.domain,
|
"isAudioOnly": "$isAudioOnly",
|
||||||
"isAudioConf": widget.dimension.newData.isAudioConf,
|
|
||||||
"displayName": "$matrix_display_name",
|
"displayName": "$matrix_display_name",
|
||||||
"avatarUrl": "$matrix_avatar_url",
|
"avatarUrl": "$matrix_avatar_url",
|
||||||
"userId": "$matrix_user_id",
|
"userId": "$matrix_user_id",
|
||||||
|
@ -33,7 +33,7 @@ export class JitsiWidgetWrapperComponent extends CapableWidget implements OnInit
|
|||||||
let params: any = activatedRoute.snapshot.queryParams;
|
let params: any = activatedRoute.snapshot.queryParams;
|
||||||
|
|
||||||
this.domain = params.domain;
|
this.domain = params.domain;
|
||||||
this.conferenceId = params.confId || params.conferenceId;
|
this.conferenceId = params.conferenceId || params.confId;
|
||||||
this.displayName = params.displayName;
|
this.displayName = params.displayName;
|
||||||
this.avatarUrl = params.avatarUrl;
|
this.avatarUrl = params.avatarUrl;
|
||||||
this.userId = params.userId || params.email; // Riot uses `email` when placing a conference call
|
this.userId = params.userId || params.email; // Riot uses `email` when placing a conference call
|
||||||
|
Loading…
Reference in New Issue
Block a user