Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Use the default integration manager for config options
Browse files Browse the repository at this point in the history
  • Loading branch information
turt2live committed Aug 9, 2019
1 parent 5a15e78 commit 018b4f5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion src/CallHandler.js
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,8 @@ async function _startCallApp(roomId, type) {
// URL, but this will at least allow the integration manager to not be hardcoded.
widgetUrl = SdkConfig.get().integrations_jitsi_widget_url + '?' + queryString;
} else {
widgetUrl = SdkConfig.get().integrations_rest_url + '/widgets/jitsi.html?' + queryString;
const apiUrl = IntegrationManagers.sharedInstance().getPrimaryManager().apiUrl;
widgetUrl = apiUrl + '/widgets/jitsi.html?' + queryString;
}

const widgetData = { widgetSessionId };
Expand Down
4 changes: 3 additions & 1 deletion src/ScalarMessaging.js
Original file line number Diff line number Diff line change
Expand Up @@ -239,6 +239,7 @@ import dis from './dispatcher';
import WidgetUtils from './utils/WidgetUtils';
import RoomViewStore from './stores/RoomViewStore';
import { _t } from './languageHandler';
import {IntegrationManagers} from "./integrations/IntegrationManagers";

function sendResponse(event, res) {
const data = JSON.parse(JSON.stringify(event.data));
Expand Down Expand Up @@ -548,7 +549,8 @@ const onMessage = function(event) {
// (See https://developer.mozilla.org/en-US/docs/Web/API/Window/postMessage)
let configUrl;
try {
configUrl = new URL(SdkConfig.get().integrations_ui_url);
// TODO: Support multiple integration managers
configUrl = new URL(IntegrationManagers.sharedInstance().getPrimaryManager().uiUrl);
} catch (e) {
// No integrations UI URL, ignore silently.
return;
Expand Down
4 changes: 3 additions & 1 deletion src/utils/WidgetUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import WidgetEchoStore from '../stores/WidgetEchoStore';
const WIDGET_WAIT_TIME = 20000;
import SettingsStore from "../settings/SettingsStore";
import ActiveWidgetStore from "../stores/ActiveWidgetStore";
import {IntegrationManagers} from "../integrations/IntegrationManagers";

/**
* Encodes a URI according to a set of template variables. Variables will be
Expand Down Expand Up @@ -102,7 +103,8 @@ export default class WidgetUtils {

let scalarUrls = SdkConfig.get().integrations_widgets_urls;
if (!scalarUrls || scalarUrls.length === 0) {
scalarUrls = [SdkConfig.get().integrations_rest_url];
const defaultManager = IntegrationManagers.sharedInstance().getPrimaryManager();
if (defaultManager) scalarUrls = [defaultManager.apiUrl];
}

for (let i = 0; i < scalarUrls.length; i++) {
Expand Down

0 comments on commit 018b4f5

Please sign in to comment.