Disable import/export outside of test mode; not currently used
This commit is contained in:
parent
77ae717b9b
commit
d4eacda649
1 changed files with 10 additions and 0 deletions
|
@ -1211,6 +1211,11 @@ function deleteAll(pattern) {
|
||||||
const ARCHIVE_NAME = 'messages.tar.gz';
|
const ARCHIVE_NAME = 'messages.tar.gz';
|
||||||
|
|
||||||
async function exportToDirectory(directory, options) {
|
async function exportToDirectory(directory, options) {
|
||||||
|
const env = window.getEnvironment();
|
||||||
|
if (env !== 'test') {
|
||||||
|
throw new Error('export is only supported in test mode');
|
||||||
|
}
|
||||||
|
|
||||||
options = options || {};
|
options = options || {};
|
||||||
|
|
||||||
if (!options.key) {
|
if (!options.key) {
|
||||||
|
@ -1278,6 +1283,11 @@ async function importFromDirectory(directory, options) {
|
||||||
|
|
||||||
const archivePath = path.join(directory, ARCHIVE_NAME);
|
const archivePath = path.join(directory, ARCHIVE_NAME);
|
||||||
if (fs.existsSync(archivePath)) {
|
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
|
// we're in the world of an encrypted, zipped backup
|
||||||
if (!options.key) {
|
if (!options.key) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue