add archives api

This commit is contained in:
Girish Ramakrishnan
2024-12-09 21:33:26 +01:00
parent 5907975c02
commit 9200e6fc63
7 changed files with 189 additions and 2 deletions

View File

@@ -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
};