100% open-source IoT Platform - Integrate your devices, add intelligence, build custom apps
Java asset-managementbuildingdashboarddataplatformdevice-managementedge-computingenergyenergy-managementenergy-monitorfleet-managementfleet-telematicsiotiot-applicationiot-platformmodbusmqttmqtt-brokerota-updaterules-enginesmartcity
Added hostConfiguration property to or-app and or-app-security (removed managerHost)
Rich Turner3bbecd1dec46
diff --git a/client/src/main/webapp/src/or-app/or-app-security.html b/client/src/main/webapp/src/or-app/or-app-security.htmlindex a8de88a03..1ece56d43 100644--- a/client/src/main/webapp/src/or-app/or-app-security.html+++ b/client/src/main/webapp/src/or-app/or-app-security.html@@ -332,15 +332,8 @@this.logout();}- var managerHost = '';- var hostURI = this.importPath;- if (hostURI) {- managerHost = '//' + new URL(hostURI).host;- }-let keycloakConfig = {-- url: managerHost + "/auth",+ url: this.hostConfiguration.protocol + "//" + this.hostConfiguration.host + "/auth",realm: realm,clientId: "openremote"};@@ -357,7 +350,7 @@// Require login and enable invisible login status iframe of Keycloak: This sets a cookie that// expires when the max session lifespan has been reached, then logs you out when the// cookie disappears.- this.keycloak.init({onLoad: "login-required", checkLoginIframe: true, checkLoginIframeInterval: 5})+ this.keycloak.init({onLoad: "login-required", checkLoginIframe: true, checkLoginIframeInterval: 5, }).success((authenticated) => {if (authenticated) {this.onKeycloakAuthSuccess()diff --git a/client/src/main/webapp/src/or-app/or-app.html b/client/src/main/webapp/src/or-app/or-app.htmlindex 1e604cc21..b6e11f999 100644--- a/client/src/main/webapp/src/or-app/or-app.html+++ b/client/src/main/webapp/src/or-app/or-app.html@@ -35,6 +35,7 @@<or-shell-native id="shellNative"></or-shell-native><or-app-security id="appSecurity"+ host-configuration="[[hostConfiguration]]"login="{{login}}"realm="{{tenantRealm}}"authenticated="{{authenticated}}"@@ -186,8 +187,10 @@function _load(tag, rel) {return function (url) {return new Promise(function (resolve, reject) {+ if (url.startsWith("/")) {+ url = openremote.INSTANCE.hostConfiguration.protocol + "//" + openremote.INSTANCE.hostConfiguration.host + url;+ }- url = openremote.INSTANCE.managerHost + url;var element = window.document.createElement(tag);// Append loading tags to the bodyvar parent = 'body';@@ -227,7 +230,14 @@}},- managerHost: String+ hostConfiguration: {+ type: Object,+ value: () => {+ let a = document.createElement("a");+ a.href = this.importPath;+ return a;+ }+ }};}@@ -257,15 +267,6 @@// The app should flex and its children should be in a flexbox vertical layoutthis.shadowRoot.host.classList.add("flex", "layout", "vertical");- // Extract manager host URI based on where this component is hosted; it is assumed that the component- // is being hosted in a manager instance and that is the instance you want to connect to.- let managerHost = '';- let hostURI = this.importPath;- if (hostURI) {- managerHost = '//' + new URL(hostURI).host;- }- this.managerHost = managerHost;-if (this.login) {this.getSecurity().set("shellNative", this.$.shellNative);this.getSecurity().startAuthentication();@@ -396,7 +397,7 @@});- requests.configure(this.managerHost + "/" + this.tenantRealm);+ requests.configure(this.hostConfiguration.protocol + "//" + this.hostConfiguration.host + "/" + this.tenantRealm);this.set("requests", requests);}@@ -407,7 +408,7 @@return;}- let serviceUrl = ("https:" === location.protocol ? "wss" : "ws") + ":" + this.managerHost + "/websocket/events";+ let serviceUrl = ("https:" === location.protocol ? "wss" : "ws") + "://" + this.hostConfiguration.host + "/websocket/events";this.getSecurity().authorizeUrl(serviceUrl, (authenticatedServiceUrl) => {this.webSocket = new WebSocket(authenticatedServiceUrl);