diff --git a/webadmin/src/appstatus.html b/webadmin/src/appstatus.html index 766460b3d..746823b69 100644 --- a/webadmin/src/appstatus.html +++ b/webadmin/src/appstatus.html @@ -30,23 +30,14 @@ // create main application module var app = angular.module('Application', []); - // FIXME this does not work with custom domains! - function detectApiOrigin() { - var host = window.location.host; - var tmp = host.split('.')[0]; - if (tmp.indexOf('-') === -1) return 'https://my-' + host; - else return 'https://my' + tmp.slice(tmp.indexOf('-')) + host.slice(tmp.length); - } - app.controller('Controller', ['$scope', '$http', function ($scope, $http) { var search = decodeURIComponent(window.location.search).slice(1).split('&').map(function (item) { return item.split('='); }).reduce(function (o, k) { o[k[0]] = k[1]; return o; }, {}); - $scope.apiOrigin = detectApiOrigin(); $scope.cloudronName = 'Cloudron'; $scope.referrer = search.referrer || null; // try to fetch cloudron status - $http.get($scope.apiOrigin + '/api/v1/cloudron/status').success(function(data, status) { + $http.get('/api/v1/cloudron/status').success(function(data, status) { if (status !== 200 || typeof data !== 'object') return console.error(status, data); $scope.cloudronName = data.cloudronName; document.title = $scope.cloudronName + ' App Error'; diff --git a/webadmin/src/error.html b/webadmin/src/error.html index 7d38e6fc9..b54640f61 100644 --- a/webadmin/src/error.html +++ b/webadmin/src/error.html @@ -30,23 +30,13 @@ // create main application module var app = angular.module('Application', []); - // FIXME this does not work with custom domains! - function detectApiOrigin() { - var host = window.location.host; - var tmp = host.split('.')[0]; - if (tmp.indexOf('-') === -1) return 'https://my-' + host; - else return 'https://my' + tmp.slice(tmp.indexOf('-')) + host.slice(tmp.length); - } - app.controller('Controller', ['$scope', '$http', function ($scope, $http) { - $scope.apiOrigin = detectApiOrigin(); - $scope.cloudronAvatar = $scope.apiOrigin + '/api/v1/cloudron/avatar'; $scope.cloudronName = 'Cloudron'; $scope.webServerOriginLink = '/'; $scope.errorMessage = ''; // try to fetch at least config.json to get appstore url - $http.get($scope.apiOrigin + '/config.json').success(function(data, status) { + $http.get('/config.json').success(function(data, status) { if (status !== 200 || typeof data !== 'object') return console.error(status, data); $scope.webServerOriginLink = data.webServerOrigin + '/console.html'; }).error(function (data, status) { @@ -55,7 +45,7 @@ }); // try to fetch cloudron status - $http.get($scope.apiOrigin + '/api/v1/cloudron/status').success(function(data, status) { + $http.get('/api/v1/cloudron/status').success(function(data, status) { if (status !== 200 || typeof data !== 'object') return console.error(status, data); $scope.cloudronName = data.cloudronName; document.title = $scope.cloudronName + ' Error'; @@ -77,7 +67,7 @@
- +

{{cloudronName}}