Backup: All exports are now 'light' exports
This commit is contained in:
parent
e583434366
commit
c0c758d459
1 changed files with 15 additions and 22 deletions
|
@ -102,31 +102,24 @@ function createOutputStream(writer) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportNonMessages(db, parent, options) {
|
async function exportNonMessages(db, parent) {
|
||||||
const writer = await createFileAndWriter(parent, 'db.json');
|
const writer = await createFileAndWriter(parent, 'db.json');
|
||||||
return exportToJsonFile(db, writer, options);
|
return exportToJsonFile(db, writer);
|
||||||
}
|
}
|
||||||
|
|
||||||
function exportToJsonFile(db, fileWriter, options) {
|
function exportToJsonFile(db, fileWriter) {
|
||||||
options = options || {};
|
|
||||||
_.defaults(options, { excludeClientConfig: false });
|
|
||||||
|
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
let storeNames = db.objectStoreNames;
|
let storeNames = db.objectStoreNames;
|
||||||
storeNames = _.without(storeNames, 'messages');
|
storeNames = _.without(
|
||||||
|
storeNames,
|
||||||
if (options.excludeClientConfig) {
|
'messages',
|
||||||
console.log('exportToJsonFile: excluding client config from export');
|
'items',
|
||||||
storeNames = _.without(
|
'signedPreKeys',
|
||||||
storeNames,
|
'preKeys',
|
||||||
'items',
|
'identityKeys',
|
||||||
'signedPreKeys',
|
'sessions',
|
||||||
'preKeys',
|
'unprocessed'
|
||||||
'identityKeys',
|
);
|
||||||
'sessions',
|
|
||||||
'unprocessed' // since we won't be able to decrypt them anyway
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
const exportedStoreNames = [];
|
const exportedStoreNames = [];
|
||||||
if (storeNames.length === 0) {
|
if (storeNames.length === 0) {
|
||||||
|
@ -908,12 +901,12 @@ function getDirectoryForExport() {
|
||||||
return getDirectory(options);
|
return getDirectory(options);
|
||||||
}
|
}
|
||||||
|
|
||||||
async function exportToDirectory(directory, options) {
|
async function exportToDirectory(directory) {
|
||||||
const name = `Signal Export ${getTimestamp()}`;
|
const name = `Signal Export ${getTimestamp()}`;
|
||||||
try {
|
try {
|
||||||
const db = await Whisper.Database.open();
|
const db = await Whisper.Database.open();
|
||||||
const dir = await createDirectory(directory, name);
|
const dir = await createDirectory(directory, name);
|
||||||
await exportNonMessages(db, dir, options);
|
await exportNonMessages(db, dir);
|
||||||
await exportConversations(db, dir);
|
await exportConversations(db, dir);
|
||||||
|
|
||||||
console.log('done backing up!');
|
console.log('done backing up!');
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue