archive: download the config

This commit is contained in:
Girish Ramakrishnan
2024-12-11 10:54:51 +01:00
parent 96f2c6e2aa
commit 6993cbeb9f
3 changed files with 10 additions and 4 deletions
+8 -2
View File
@@ -501,7 +501,7 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
document.body.removeChild(element);
}
$scope.downloadConfig = function (backup) { // can also be a archive object
$scope.downloadConfig = function (backup, isArchive) { // can also be a archive object
// secrets and tokens already come with placeholder characters we remove them
var tmp = {
remotePath: backup.remotePath,
@@ -512,7 +512,13 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
if ($scope.backupConfig[k] !== SECRET_PLACEHOLDER) tmp[k] = $scope.backupConfig[k];
});
var filename = 'cloudron-backup-config-' + (new Date()).toISOString().replace(/:|T/g,'-').replace(/\..*/,'') + ' (' + $scope.config.adminFqdn + ')' + '.json';
let filename;
if (isArchive) {
filename = `${backup.appConfig.fqdn}-archive-config-${(new Date(backup.creationTime)).toISOString().split('T')[0]}.json`;
} else {
filename = `${$scope.config.adminFqdn}-backup-config-${(new Date(backup.creationTime)).toISOString().split('T')[0]}.json`;
}
download(filename, JSON.stringify(tmp, null, 4));
};