mirror of
https://github.com/element-hq/element-web
synced 2024-11-27 19:56:47 +03:00
Fix Jitsi wellknown hooks
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>
This commit is contained in:
parent
5156388fc6
commit
a674131a8c
2 changed files with 13 additions and 10 deletions
|
@ -619,7 +619,7 @@ async function startMatrixClient(startSyncing=true) {
|
|||
}
|
||||
|
||||
// Now that we have a MatrixClientPeg, update the Jitsi info
|
||||
await Jitsi.getInstance().update();
|
||||
await Jitsi.getInstance().start();
|
||||
|
||||
// dispatch that we finished starting up to wire up any other bits
|
||||
// of the matrix client that cannot be set prior to starting up.
|
||||
|
|
|
@ -34,17 +34,20 @@ export class Jitsi {
|
|||
return this.domain || 'jitsi.riot.im';
|
||||
}
|
||||
|
||||
public async update(): Promise<any> {
|
||||
public start() {
|
||||
const cli = MatrixClientPeg.get();
|
||||
cli.on("WellKnown.client", this.update);
|
||||
const discoveryResponse = cli.getClientWellKnown();
|
||||
if (discoveryResponse) {
|
||||
// if we missed the first WellKnown.client event then call update anyway
|
||||
this.update(discoveryResponse);
|
||||
}
|
||||
}
|
||||
|
||||
private update = async (discoveryResponse): Promise<any> => {
|
||||
// Start with a default of the config's domain
|
||||
let domain = (SdkConfig.get()['jitsi'] || {})['preferredDomain'] || 'jitsi.riot.im';
|
||||
|
||||
const cli = MatrixClientPeg.get();
|
||||
const discoveryResponse = cli && MatrixClientPeg.get().getClientWellKnown();
|
||||
|
||||
if (cli) {
|
||||
cli.on("WellKnown.client", () => this.update);
|
||||
}
|
||||
|
||||
console.log("Attempting to get Jitsi conference information from homeserver");
|
||||
if (discoveryResponse && discoveryResponse[JITSI_WK_PROPERTY]) {
|
||||
const wkPreferredDomain = discoveryResponse[JITSI_WK_PROPERTY]['preferredDomain'];
|
||||
|
@ -54,7 +57,7 @@ export class Jitsi {
|
|||
// Put the result into memory for us to use later
|
||||
this.domain = domain;
|
||||
console.log("Jitsi conference domain:", this.preferredDomain);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Parses the given URL into the data needed for a Jitsi widget, if the widget
|
||||
|
|
Loading…
Reference in a new issue