Remove secret values and add encryption flag in restore config json

This commit is contained in:
Johannes Zellner
2020-05-14 23:19:17 +02:00
parent 8f0a76ecef
commit babe0adffb

View File

@@ -2,6 +2,7 @@
/* global angular:false */
/* global $:false */
/* global SECRET_PLACEHOLDER */
angular.module('Application').controller('BackupsController', ['$scope', '$location', '$rootScope', '$timeout', 'Client', function ($scope, $location, $rootScope, $timeout, Client) {
Client.onReady(function () { if (!Client.getUserInfo().isAtLeastAdmin) $location.path('/'); });
@@ -225,8 +226,16 @@ angular.module('Application').controller('BackupsController', ['$scope', '$locat
}
$scope.downloadConfig = function () {
// secrets and tokens already come with placeholder characters
download('cloudron_backup.json', JSON.stringify($scope.backupConfig));
// secrets and tokens already come with placeholder characters we remove them
var tmp = {
encrypted: !!$scope.backupConfig.password // we add this just to help the import UI
};
Object.keys($scope.backupConfig).forEach(function (k) {
if ($scope.backupConfig[k] !== SECRET_PLACEHOLDER) tmp[k] = $scope.backupConfig[k];
});
download('cloudron_backup.json', JSON.stringify(tmp));
};
$scope.configureBackup = {