diff --git a/src/index.html b/src/index.html index 2b1a06547..a42509e11 100644 --- a/src/index.html +++ b/src/index.html @@ -146,7 +146,7 @@
  • My Apps
  • -
  • +
  • App Store
  • diff --git a/src/js/client.js b/src/js/client.js index 297290da0..52a28b767 100644 --- a/src/js/client.js +++ b/src/js/client.js @@ -123,7 +123,8 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N progress: {}, region: null, size: null, - memory: 0 + memory: 0, + edition: null }; this._installedApps = []; this._installedAppsById = {}; @@ -228,6 +229,7 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N // provide fallback to caas if (!config.provider) config.provider = 'caas'; + config.spaces = config.edition === 'spaces'; angular.copy(config, this._config); @@ -476,20 +478,6 @@ angular.module('Application').service('Client', ['$http', '$interval', 'md5', 'N }).error(defaultErrorHandler(callback)); }; - Client.prototype.setSpacesConfig = function (spacesConfig, callback) { - post('/api/v1/settings/spaces_config', spacesConfig).success(function(data, status) { - if (status !== 200) return callback(new ClientError(status, data)); - callback(null); - }).error(defaultErrorHandler(callback)); - }; - - Client.prototype.getSpacesConfig = function (callback) { - get('/api/v1/settings/spaces_config').success(function(data, status) { - if (status !== 200) return callback(new ClientError(status, data)); - callback(null, data); - }).error(defaultErrorHandler(callback)); - }; - Client.prototype.getUpdateInfo = function (callback) { get('/api/v1/cloudron/update').success(function(data, status) { if (status !== 200) return callback(new ClientError(status, data)); diff --git a/src/views/apps.html b/src/views/apps.html index ef1b37dbb..9c6ce3956 100644 --- a/src/views/apps.html +++ b/src/views/apps.html @@ -511,7 +511,7 @@ -
    + -
    +
    diff --git a/src/views/apps.js b/src/views/apps.js index 66e8ce5e8..328ea1465 100644 --- a/src/views/apps.js +++ b/src/views/apps.js @@ -52,7 +52,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.appConfigure.app = app; if ($scope.user.admin) { $scope.appConfigure.location = app.location; - } else { // strip the trailing username + } else { // strip the trailing username in spaces mode $scope.appConfigure.location = app.location === $scope.spacesSuffix ? '' : app.location.replace(new RegExp('-' + $scope.spacesSuffix + '$'),''); } $scope.appConfigure.domain = $scope.domains.filter(function (d) { return d.domain === app.domain; })[0]; @@ -604,7 +604,7 @@ angular.module('Application').controller('AppsController', ['$scope', '$location $scope.spacesSuffix = $scope.user.username.replace(/\./g, '-'); - if ($scope.user.admin || $scope.config.spaces.enabled) { + if ($scope.user.admin || $scope.config.spaces) { fetchUsers(); fetchGroups(); getDomains(); diff --git a/src/views/appstore.js b/src/views/appstore.js index 99cdf8bad..cd3942b2f 100644 --- a/src/views/appstore.js +++ b/src/views/appstore.js @@ -1,7 +1,7 @@ 'use strict'; angular.module('Application').controller('AppStoreController', ['$scope', '$location', '$timeout', '$routeParams', 'Client', 'AppStore', function ($scope, $location, $timeout, $routeParams, Client, AppStore) { - Client.onReady(function () { if (!Client.getUserInfo().admin && !Client.getConfig().spaces.enabled) $location.path('/'); }); + Client.onReady(function () { if (!Client.getUserInfo().admin && !Client.getConfig().spaces) $location.path('/'); }); $scope.HOST_PORT_MIN = 1024; $scope.HOST_PORT_MAX = 65535; @@ -484,7 +484,7 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$loca } // non admins cannot read appstore settings in spaces mode - if (!$scope.user.admin && $scope.config.spaces.enabled) { + if (!$scope.user.admin && $scope.config.spaces) { $scope.validAppstoreAccount = true; return callback(); } diff --git a/src/views/settings.html b/src/views/settings.html index 8f754b462..b754b41a9 100644 --- a/src/views/settings.html +++ b/src/views/settings.html @@ -325,27 +325,4 @@
    - -
    -

    Cloudron Spaces

    -
    - -
    -
    -
    -

    Cloudron Spaces allows users to install and run apps of their own

    -


    {{ spaces.error }}

    -
    -
    - -
    -
    - -
    -
    -
    -
    diff --git a/src/views/settings.js b/src/views/settings.js index 0634bf9f3..99a931f4c 100644 --- a/src/views/settings.js +++ b/src/views/settings.js @@ -64,23 +64,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca } }; - $scope.spaces = { - error: '', - busy: false, - enabled: false, - - submit: function () { - $scope.spaces.error = null; - $scope.spaces.busy = true; - - Client.setSpacesConfig({ enabled: !$scope.spaces.enabled }, function (error) { - if (error) $scope.spaces.error = error.message; - - getSpacesConfig(); - }); - } - }; - $scope.planChange = { busy: false, error: {}, @@ -313,17 +296,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca }); } - function getSpacesConfig() { - $scope.spaces.busy = true; - - Client.getSpacesConfig(function (error, result) { - if (error) return console.error(error); - - $scope.spaces.busy = false; - $scope.spaces.enabled = result.enabled; - }); - } - function getSubscription() { AppStore.getSubscription($scope.appstoreConfig, function (error, result) { if (error) return console.error(error); @@ -433,7 +405,6 @@ angular.module('Application').controller('SettingsController', ['$scope', '$loca Client.onReady(function () { getAutoupdatePattern(); - getSpacesConfig(); if ($scope.config.provider === 'caas') { Client.getCaasConfig(function (error, caasConfig) {