settings: remove licenseKey

this is unused
This commit is contained in:
Girish Ramakrishnan
2022-03-31 12:31:35 -07:00
parent c4689a8385
commit 3295d2b727
4 changed files with 13 additions and 25 deletions
+1 -3
View File
@@ -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}`);
}
+3 -4
View File
@@ -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 })
-18
View File
@@ -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];