diff --git a/dashboard/src/js/client.js b/dashboard/src/js/client.js index 099e2fa7d..fefc036d1 100644 --- a/dashboard/src/js/client.js +++ b/dashboard/src/js/client.js @@ -1217,22 +1217,6 @@ angular.module('Application').service('Client', ['$http', '$interval', '$timeout }); }; - Client.prototype.setUnstableAppsConfig = function (enabled, callback) { - post('/api/v1/settings/unstable_apps', { enabled: enabled }, null, function (error, data, status) { - if (error) return callback(error); - if (status !== 200) return callback(new ClientError(status, data)); - callback(null); - }); - }; - - Client.prototype.getUnstableAppsConfig = function (callback) { - get('/api/v1/settings/unstable_apps', null, function (error, data, status) { - if (error) return callback(error); - if (status !== 200) return callback(new ClientError(status, data)); - callback(null, data.enabled); - }); - }; - Client.prototype.setRegistryConfig = function (rc, callback) { post('/api/v1/settings/registry_config', rc, null, function (error, data, status) { if (error) return callback(error); diff --git a/dashboard/src/views/appstore.js b/dashboard/src/views/appstore.js index 8d46955dd..9aa83aeb9 100644 --- a/dashboard/src/views/appstore.js +++ b/dashboard/src/views/appstore.js @@ -25,7 +25,6 @@ angular.module('Application').controller('AppStoreController', ['$scope', '$tran $scope.cachedCategory = ''; // used to cache the selected category while searching $scope.searchString = ''; $scope.validSubscription = false; - $scope.unstableApps = false; $scope.subscription = {}; $scope.memory = null; // { memory, swap } diff --git a/src/appstore.js b/src/appstore.js index e680313f6..e8729fec6 100644 --- a/src/appstore.js +++ b/src/appstore.js @@ -397,10 +397,8 @@ async function getApps() { const token = await settings.getAppstoreApiToken(); if (!token) throw new BoxError(BoxError.LICENSE_ERROR, 'Missing token'); - const unstable = await settings.getUnstableAppsConfig(); - const [error, response] = await safe(superagent.get(`${settings.apiServerOrigin()}/api/v1/apps`) - .query({ accessToken: token, boxVersion: constants.VERSION, unstable }) + .query({ accessToken: token, boxVersion: constants.VERSION, unstable: true }) .timeout(30 * 1000) .ok(() => true)); diff --git a/src/routes/settings.js b/src/routes/settings.js index 5aab1b9f9..db23e5014 100644 --- a/src/routes/settings.js +++ b/src/routes/settings.js @@ -217,24 +217,6 @@ async function setIPv6Config(req, res, next) { next(new HttpSuccess(200, {})); } -async function getUnstableAppsConfig(req, res, next) { - const [error, enabled] = await safe(settings.getUnstableAppsConfig()); - if (error) return next(BoxError.toHttpError(error)); - - next(new HttpSuccess(200, { enabled })); -} - -async function setUnstableAppsConfig(req, res, next) { - assert.strictEqual(typeof req.body, 'object'); - - if (typeof req.body.enabled !== 'boolean') return next(new HttpError(400, 'enabled boolean is required')); - - const [error] = await safe(settings.setUnstableAppsConfig(req.body.enabled)); - if (error) return next(BoxError.toHttpError(error)); - - next(new HttpSuccess(200, {})); -} - async function getRegistryConfig(req, res, next) { const [error, registryConfig] = await safe(settings.getRegistryConfig()); if (error) return next(BoxError.toHttpError(error)); @@ -324,7 +306,6 @@ function get(req, res, next) { case settings.BACKUP_CONFIG_KEY: return getBackupConfig(req, res, next); case settings.EXTERNAL_LDAP_KEY: return getExternalLdapConfig(req, res, next); case settings.DIRECTORY_SERVER_KEY: return getDirectoryServerConfig(req, res, next); - case settings.UNSTABLE_APPS_KEY: return getUnstableAppsConfig(req, res, next); case settings.REGISTRY_CONFIG_KEY: return getRegistryConfig(req, res, next); case settings.SYSINFO_CONFIG_KEY: return getSysinfoConfig(req, res, next); case settings.LANGUAGE_KEY: return getLanguage(req, res, next); @@ -348,7 +329,6 @@ function set(req, res, next) { case settings.IPV6_CONFIG_KEY: return setIPv6Config(req, res, next); case settings.EXTERNAL_LDAP_KEY: return setExternalLdapConfig(req, res, next); case settings.DIRECTORY_SERVER_KEY: return setDirectoryServerConfig(req, res, next); - case settings.UNSTABLE_APPS_KEY: return setUnstableAppsConfig(req, res, next); case settings.REGISTRY_CONFIG_KEY: return setRegistryConfig(req, res, next); case settings.SYSINFO_CONFIG_KEY: return setSysinfoConfig(req, res, next); case settings.LANGUAGE_KEY: return setLanguage(req, res, next); diff --git a/src/settings.js b/src/settings.js index a6968f6dc..f5f5f2043 100644 --- a/src/settings.js +++ b/src/settings.js @@ -22,9 +22,6 @@ exports = module.exports = { getIPv6Config, setIPv6Config, - getUnstableAppsConfig, - setUnstableAppsConfig, - getBackupPolicy, setBackupPolicy, @@ -99,7 +96,6 @@ exports = module.exports = { // booleans. if you add an entry here, be sure to fix list() DYNAMIC_DNS_KEY: 'dynamic_dns', - UNSTABLE_APPS_KEY: 'unstable_apps', DEMO_KEY: 'demo', // json. if you add an entry here, be sure to fix list() @@ -183,7 +179,6 @@ const gDefaults = (function () { result[exports.IPV6_CONFIG_KEY] = { provider: 'noop' }; - result[exports.UNSTABLE_APPS_KEY] = true; result[exports.LANGUAGE_KEY] = 'en'; result[exports.CLOUDRON_ID_KEY] = ''; result[exports.APPSTORE_API_TOKEN_KEY] = ''; @@ -409,19 +404,6 @@ async function setIPv6Config(ipv6Config) { notifyChange(exports.IPV6_CONFIG_KEY, ipv6Config); } -async function getUnstableAppsConfig() { - const result = await get(exports.UNSTABLE_APPS_KEY); - if (result === null) return gDefaults[exports.UNSTABLE_APPS_KEY]; - return !!result; // db holds string values only -} - -async function setUnstableAppsConfig(enabled) { - assert.strictEqual(typeof enabled, 'boolean'); - - await set(exports.UNSTABLE_APPS_KEY, enabled ? 'enabled' : ''); // db holds string values only - notifyChange(exports.UNSTABLE_APPS_KEY, enabled); -} - async function getBackupPolicy() { const result = await get(exports.BACKUP_POLICY_KEY); if (result === null) return gDefaults[exports.BACKUP_POLICY_KEY]; @@ -723,7 +705,6 @@ async function list() { // convert booleans result[exports.DYNAMIC_DNS_KEY] = !!result[exports.DYNAMIC_DNS_KEY]; - result[exports.UNSTABLE_APPS_KEY] = !!result[exports.UNSTABLE_APPS_KEY]; result[exports.DEMO_KEY] = !!result[exports.DEMO_KEY]; // convert JSON objects diff --git a/src/test/settings-test.js b/src/test/settings-test.js index 52ebfd210..11563fbed 100644 --- a/src/test/settings-test.js +++ b/src/test/settings-test.js @@ -72,18 +72,6 @@ describe('Settings', function () { await settings.setBackupPolicy({ schedule: '00 00 2,23 * * 0,1,2', retention: { keepWithinSecs: 1 }}); }); - it('can get default unstable apps setting', async function () { - const enabled = await settings.getUnstableAppsConfig(); - expect(enabled).to.be(true); - }); - - it('can set unstable apps setting', async function () { - await settings.setUnstableAppsConfig(false); - - const enabled = await settings.getUnstableAppsConfig(); - expect(enabled).to.be(false); - }); - it('can get default IPv6 setting', async function () { const config = await settings.getIPv6Config(); expect(config.provider).to.be('noop'); @@ -117,7 +105,6 @@ describe('Settings', function () { expect(allSettings[settings.TIME_ZONE_KEY]).to.be.a('string'); expect(allSettings[settings.AUTOUPDATE_PATTERN_KEY]).to.be.a('string'); expect(allSettings[settings.CLOUDRON_NAME_KEY]).to.be.a('string'); - expect(allSettings[settings.UNSTABLE_APPS_KEY]).to.be.a('boolean'); expect(allSettings[settings.IPV6_CONFIG_KEY]).to.be.an('object'); }); });