add archives api
This commit is contained in:
11
src/apps.js
11
src/apps.js
@@ -1420,8 +1420,15 @@ async function install(data, auditSource) {
|
||||
|
||||
if (constants.DEMO && (await getCount() >= constants.DEMO_APP_LIMIT)) throw new BoxError(BoxError.BAD_STATE, 'Too many installed apps, please uninstall a few and try again');
|
||||
|
||||
let restoreConfig = null;
|
||||
if ('backupId' in data) { // install from archive
|
||||
const backup = await backups.get(data.backupId);
|
||||
if (!backup) throw new BoxError(BoxError.BAD_FIELD, 'Backup not found in archive');
|
||||
restoreConfig = { remotePath: backup.remotePath, backupFormat: backup.format };
|
||||
}
|
||||
|
||||
const appId = uuid.v4();
|
||||
debug('Will install app with id : ' + appId);
|
||||
debug(`Installing app ${appId}`);
|
||||
|
||||
const app = {
|
||||
accessRestriction,
|
||||
@@ -1455,7 +1462,7 @@ async function install(data, auditSource) {
|
||||
await purchaseApp({ appId, appstoreId: appStoreId, manifestId: manifest.id || 'customapp' });
|
||||
|
||||
const task = {
|
||||
args: { restoreConfig: null, skipDnsSetup, overwriteDns },
|
||||
args: { restoreConfig, skipDnsSetup, overwriteDns },
|
||||
values: { },
|
||||
requiredState: app.installationState
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user