diff --git a/src/js/client.js b/src/js/client.js index 2f71f1942..96a445c1c 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -31,22 +31,6 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N function defaultErrorHandler(callback) { return function (data, status) { if (status === 401) return client.login(); - if (status === 503) { - // this could indicate a update/upgrade/restore/migration - client.progress(function (error, result) { - if (error) { - client.error(error); - return callback(new ClientError(status, data)); - } - - if (result.update && result.update.percent !== -1) window.location.href = '/update.html'; - else callback(new ClientError(status, data)); - }, function (data, status) { - client.error(data); - return callback(new ClientError(status, data)); - }); - return; - } if (status >= 500) { client.error(data); return callback(new ClientError(status, data)); @@ -435,16 +419,6 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N }).error(defaultErrorHandler(callback)); }; - Client.prototype.progress = function (callback, errorCallback) { - // this is used in the defaultErrorHandler itself, and avoids a loop - if (typeof errorCallback !== 'function') errorCallback = defaultErrorHandler(callback); - - get('/api/v1/cloudron/progress').success(function(data, status) { - if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data)); - callback(null, data); - }).error(errorCallback); - }; - Client.prototype.version = function (callback) { get('/api/v1/cloudron/status').success(function(data, status) { if (status !== 200 || typeof data !== 'object') return callback(new ClientError(status, data)); diff --git a/src/js/main.js b/src/js/main.js index 8f49b4abf..bba911ad4 100644 --- a/src/js/main.js +++ b/src/js/main.js @@ -201,11 +201,6 @@ angular.module('Application').controller('MainController', ['$scope', '$route', }); Client.onConfig(function (config) { - // check if we are actually updating - // if (config.progress.update && config.progress.update.percent !== -1) { - // window.location.href = '/update.html'; - // } - if (config.cloudronName) { document.title = config.cloudronName; } diff --git a/src/js/update.js b/src/js/update.js deleted file mode 100644 index 251fccac9..000000000 --- a/src/js/update.js +++ /dev/null @@ -1,69 +0,0 @@ -'use strict'; - -// create main application module -var app = angular.module('Application', []); - -app.controller('Controller', ['$scope', '$http', '$interval', function ($scope, $http, $interval) { - $scope.title = ''; - $scope.percent = 0; - $scope.message = ''; - $scope.error = false; - - $scope.loadWebadmin = function () { - window.location.href = '/'; - }; - - function fetchProgress() { - $http.get('/api/v1/cloudron/progress').success(function(data, status) { - if (status === 404) return; // just wait until we create the progress.json on the server side - if (status !== 200 || typeof data !== 'object') return console.error('Invalid response for progress', status, data); - if (!data.update && !data.migrate) return $scope.loadWebadmin(); - - if (data.update) { - if (data.update.percent >= 100) { - return $scope.loadWebadmin(); - } else if (data.update.percent === -1) { - $scope.title = 'Update Error'; - $scope.error = true; - $scope.message = data.update.message; - } else { - if (data.backup && data.backup.percent < 100) { - $scope.title = 'Backup in progress...'; - $scope.percent = data.backup.percent < 0 ? 5 : (data.backup.percent / 100) * 50; // never show 0 as it looks like nothing happens - $scope.message = data.backup.message; - } else { - $scope.title = 'Update in progress...'; - $scope.percent = 50 + ((data.update.percent / 100) * 50); // first half is backup - $scope.message = data.update.message; - } - } - } else { // migrating - if (data.migrate.percent === -1) { - $scope.title = 'Migration Error'; - $scope.error = true; - $scope.message = data.migrate.message; - } else { - $scope.title = 'Migration in progress...'; - $scope.percent = data.migrate.percent; - $scope.message = data.migrate.message; - - if (!data.migrate.info) return; - - // check if the new domain is available via the appstore (cannot use cloudron - // directly as we might hit NXDOMAIN) - $http.get(data.apiServerOrigin + '/api/v1/boxes/' + data.migrate.info.domain + '/status').success(function(data2, status) { - if (status === 200 && data2.status === 'ready') { - window.location = 'https://my.' + data.migrate.info.domain; - } - }); - } - } - }).error(function (data, status) { - console.error('Error getting progress', status, data); - }); - } - - $interval(fetchProgress, 2000); - - fetchProgress(); -}]); diff --git a/src/update.html b/src/update.html deleted file mode 100644 index a0ceb82c8..000000000 --- a/src/update.html +++ /dev/null @@ -1,69 +0,0 @@ - - -
- - - - -Changes:
{{ update.error.generic }}
-