Disable import/export outside of test mode; not currently used

This commit is contained in:
Scott Nonnenberg 2019-02-19 12:14:05 -08:00
parent 77ae717b9b
commit d4eacda649

View file

@ -1211,6 +1211,11 @@ function deleteAll(pattern) {
const ARCHIVE_NAME = 'messages.tar.gz';
async function exportToDirectory(directory, options) {
const env = window.getEnvironment();
if (env !== 'test') {
throw new Error('export is only supported in test mode');
}
options = options || {};
if (!options.key) {
@ -1278,6 +1283,11 @@ async function importFromDirectory(directory, options) {
const archivePath = path.join(directory, ARCHIVE_NAME);
if (fs.existsSync(archivePath)) {
const env = window.getEnvironment();
if (env !== 'test') {
throw new Error('import is only supported in test mode');
}
// we're in the world of an encrypted, zipped backup
if (!options.key) {
throw new Error(