diff --git a/migrations/20220331193223-settings-delete-licenseKey.js b/migrations/20220331193223-settings-delete-licenseKey.js new file mode 100644 index 000000000..80b052271 --- /dev/null +++ b/migrations/20220331193223-settings-delete-licenseKey.js @@ -0,0 +1,9 @@ +'use strict'; + +exports.up = function(db, callback) { + db.runSql('DELETE FROM settings WHERE name=?', [ 'license_key' ], callback); +}; + +exports.down = function(db, callback) { + callback(); +}; diff --git a/src/appstore.js b/src/appstore.js index 4e419f8a6..90d050088 100644 --- a/src/appstore.js +++ b/src/appstore.js @@ -318,14 +318,12 @@ async function registerCloudron(data) { if (error) throw new BoxError(BoxError.NETWORK_ERROR, error.message); if (response.status !== 201) throw new BoxError(BoxError.EXTERNAL_ERROR, `Unable to register cloudron: ${response.statusCode} ${error.message}`); - // cloudronId, token, licenseKey + // cloudronId, token if (!response.body.cloudronId) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Invalid response - no cloudron id'); if (!response.body.cloudronToken) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Invalid response - no token'); - if (!response.body.licenseKey) throw new BoxError(BoxError.EXTERNAL_ERROR, 'Invalid response - no license'); await settings.setCloudronId(response.body.cloudronId); await settings.setCloudronToken(response.body.cloudronToken); - await settings.setLicenseKey(response.body.licenseKey); debug(`registerCloudron: Cloudron registered with id ${response.body.cloudronId}`); } diff --git a/src/routes/test/appstore-test.js b/src/routes/test/appstore-test.js index 2c043e493..d2464cf77 100644 --- a/src/routes/test/appstore-test.js +++ b/src/routes/test/appstore-test.js @@ -15,7 +15,6 @@ const common = require('./common.js'), const { setup, cleanup, serverUrl, owner } = common; describe('Appstore Apps API', function () { - before(setup); after(cleanup); @@ -41,7 +40,7 @@ describe('Appstore Apps API', function () { const scope2 = nock(settings.apiServerOrigin()) .post('/api/v1/register_cloudron', (body) => !!body.domain && body.accessToken === 'SECRET_TOKEN') - .reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN', licenseKey: 'lkey' }); + .reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN' }); const response = await superagent.post(`${serverUrl}/api/v1/appstore/register_cloudron`) .send({ email: 'test@cloudron.io', password: 'secret', signup: false }) @@ -100,7 +99,7 @@ describe('Subscription API - no signup', function () { const scope2 = nock(settings.apiServerOrigin()) .post('/api/v1/register_cloudron', (body) => !!body.domain && body.accessToken === 'SECRET_TOKEN') - .reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN', licenseKey: 'lkey' }); + .reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN' }); const response = await superagent.post(`${serverUrl}/api/v1/appstore/register_cloudron`) .send({ email: 'test@cloudron.io', password: 'secret', signup: false }) @@ -136,7 +135,7 @@ describe('Subscription API - signup', function () { const scope3 = nock(settings.apiServerOrigin()) .post('/api/v1/register_cloudron', (body) => !!body.domain && body.accessToken === 'SECRET_TOKEN') - .reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN', licenseKey: 'lkey' }); + .reply(201, { cloudronId: 'cid', cloudronToken: 'CLOUDRON_TOKEN' }); const response = await superagent.post(`${serverUrl}/api/v1/appstore/register_cloudron`) .send({ email: 'test@cloudron.io', password: 'secret', signup: true }) diff --git a/src/settings.js b/src/settings.js index 6974f3f2e..0634a2f34 100644 --- a/src/settings.js +++ b/src/settings.js @@ -40,9 +40,6 @@ exports = module.exports = { getRegistryConfig, setRegistryConfig, - getLicenseKey, - setLicenseKey, - getLanguage, setLanguage, @@ -113,7 +110,6 @@ exports = module.exports = { AUTOUPDATE_PATTERN_KEY: 'autoupdate_pattern', TIME_ZONE_KEY: 'time_zone', CLOUDRON_NAME_KEY: 'cloudron_name', - LICENSE_KEY: 'license_key', LANGUAGE_KEY: 'language', CLOUDRON_ID_KEY: 'cloudron_id', CLOUDRON_TOKEN_KEY: 'cloudron_token', // apstore token @@ -172,7 +168,6 @@ const gDefaults = (function () { provider: 'noop' }; result[exports.UNSTABLE_APPS_KEY] = true; - result[exports.LICENSE_KEY] = ''; result[exports.LANGUAGE_KEY] = 'en'; result[exports.CLOUDRON_ID_KEY] = ''; result[exports.CLOUDRON_TOKEN_KEY] = ''; @@ -670,19 +665,6 @@ async function getSupportConfig() { return JSON.parse(value); } -async function getLicenseKey() { - const value = get(exports.LICENSE_KEY); - if (value === null) return gDefaults[exports.LICENSE_KEY]; - return value; -} - -async function setLicenseKey(licenseKey) { - assert.strictEqual(typeof licenseKey, 'string'); - - await set(exports.LICENSE_KEY, licenseKey); - notifyChange(exports.LICENSE_KEY, licenseKey); -} - async function getLanguage() { const value = await get(exports.LANGUAGE_KEY); if (value === null) return gDefaults[exports.LANGUAGE_KEY];