"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "js/modules/backup.js" between
Signal-Desktop-1.35.2.tar.gz and Signal-Desktop-1.36.1.tar.gz

About: Signal-Desktop is a cross-platform encrypted messaging service (also available for mobile devices).

backup.js  (Signal-Desktop-1.35.2):backup.js  (Signal-Desktop-1.36.1)
skipping to change at line 462 skipping to change at line 462
dir, dir,
}); });
} }
async function writeQuoteThumbnails(quotedAttachments, options) { async function writeQuoteThumbnails(quotedAttachments, options) {
const { name } = options; const { name } = options;
try { try {
await Promise.all( await Promise.all(
_.map(quotedAttachments, (attachment, index) => _.map(quotedAttachments, (attachment, index) =>
writeQuoteThumbnail( writeQuoteThumbnail(attachment, { ...options, index })
attachment,
Object.assign({}, options, {
index,
})
)
) )
); );
} catch (error) { } catch (error) {
window.log.error( window.log.error(
'writeThumbnails: error exporting conversation', 'writeThumbnails: error exporting conversation',
name, name,
':', ':',
error && error.stack ? error.stack : error error && error.stack ? error.stack : error
); );
throw error; throw error;
skipping to change at line 534 skipping to change at line 529
dir, dir,
} }
); );
} }
} }
async function writeAttachments(attachments, options) { async function writeAttachments(attachments, options) {
const { name } = options; const { name } = options;
const promises = _.map(attachments, (attachment, index) => const promises = _.map(attachments, (attachment, index) =>
writeAttachment( writeAttachment(attachment, { ...options, index })
attachment,
Object.assign({}, options, {
index,
})
)
); );
try { try {
await Promise.all(promises); await Promise.all(promises);
} catch (error) { } catch (error) {
window.log.error( window.log.error(
'writeAttachments: error exporting conversation', 'writeAttachments: error exporting conversation',
name, name,
':', ':',
error && error.stack ? error.stack : error error && error.stack ? error.stack : error
); );
skipping to change at line 578 skipping to change at line 568
filename, filename,
dir, dir,
}); });
} }
async function writeContactAvatars(contact, options) { async function writeContactAvatars(contact, options) {
const { name } = options; const { name } = options;
try { try {
await Promise.all( await Promise.all(
_.map(contact, (item, index) => _.map(contact, (item, index) => writeAvatar(item, { ...options, index }))
writeAvatar(
item,
Object.assign({}, options, {
index,
})
)
)
); );
} catch (error) { } catch (error) {
window.log.error( window.log.error(
'writeContactAvatars: error exporting conversation', 'writeContactAvatars: error exporting conversation',
name, name,
':', ':',
error && error.stack ? error.stack : error error && error.stack ? error.stack : error
); );
throw error; throw error;
} }
skipping to change at line 623 skipping to change at line 606
dir, dir,
}); });
} }
async function writePreviews(preview, options) { async function writePreviews(preview, options) {
const { name } = options; const { name } = options;
try { try {
await Promise.all( await Promise.all(
_.map(preview, (item, index) => _.map(preview, (item, index) =>
writePreviewImage( writePreviewImage(item, { ...options, index })
item,
Object.assign({}, options, {
index,
})
)
) )
); );
} catch (error) { } catch (error) {
window.log.error( window.log.error(
'writePreviews: error exporting conversation', 'writePreviews: error exporting conversation',
name, name,
':', ':',
error && error.stack ? error.stack : error error && error.stack ? error.stack : error
); );
throw error; throw error;
skipping to change at line 1239 skipping to change at line 1217
let stagingDir; let stagingDir;
let encryptionDir; let encryptionDir;
try { try {
stagingDir = await createTempDir(); stagingDir = await createTempDir();
encryptionDir = await createTempDir(); encryptionDir = await createTempDir();
const attachmentsDir = await createDirectory(directory, 'attachments'); const attachmentsDir = await createDirectory(directory, 'attachments');
await exportConversationListToFile(stagingDir); await exportConversationListToFile(stagingDir);
await exportConversations( await exportConversations({
Object.assign({}, options, { ...options,
messagesDir: stagingDir, messagesDir: stagingDir,
attachmentsDir, attachmentsDir,
}) });
);
const archivePath = path.join(directory, ARCHIVE_NAME); const archivePath = path.join(directory, ARCHIVE_NAME);
await compressArchive(archivePath, stagingDir); await compressArchive(archivePath, stagingDir);
await encryptFile(archivePath, path.join(directory, ARCHIVE_NAME), options); await encryptFile(archivePath, path.join(directory, ARCHIVE_NAME), options);
window.log.info('done backing up!'); window.log.info('done backing up!');
return directory; return directory;
} catch (error) { } catch (error) {
window.log.error( window.log.error(
'The backup went wrong!', 'The backup went wrong!',
skipping to change at line 1284 skipping to change at line 1261
async function importFromDirectory(directory, options) { async function importFromDirectory(directory, options) {
options = options || {}; options = options || {};
try { try {
const lookups = await Promise.all([ const lookups = await Promise.all([
loadMessagesLookup(), loadMessagesLookup(),
loadConversationLookup(), loadConversationLookup(),
]); ]);
const [messageLookup, conversationLookup] = lookups; const [messageLookup, conversationLookup] = lookups;
options = Object.assign({}, options, { options = { ...options, messageLookup, conversationLookup };
messageLookup,
conversationLookup,
});
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(); const env = window.getEnvironment();
if (env !== 'test') { if (env !== 'test') {
throw new Error('import is only supported in test mode'); 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) {
skipping to change at line 1315 skipping to change at line 1289
try { try {
stagingDir = await createTempDir(); stagingDir = await createTempDir();
decryptionDir = await createTempDir(); decryptionDir = await createTempDir();
const attachmentsDir = path.join(directory, 'attachments'); const attachmentsDir = path.join(directory, 'attachments');
const decryptedArchivePath = path.join(decryptionDir, ARCHIVE_NAME); const decryptedArchivePath = path.join(decryptionDir, ARCHIVE_NAME);
await decryptFile(archivePath, decryptedArchivePath, options); await decryptFile(archivePath, decryptedArchivePath, options);
await decompressArchive(decryptedArchivePath, stagingDir); await decompressArchive(decryptedArchivePath, stagingDir);
options = Object.assign({}, options, { options = { ...options, attachmentsDir };
attachmentsDir,
});
const result = await importNonMessages(stagingDir, options); const result = await importNonMessages(stagingDir, options);
await importConversations(stagingDir, Object.assign({}, options)); await importConversations(stagingDir, { ...options });
window.log.info('Done importing from backup!'); window.log.info('Done importing from backup!');
return result; return result;
} finally { } finally {
if (stagingDir) { if (stagingDir) {
await deleteAll(stagingDir); await deleteAll(stagingDir);
} }
if (decryptionDir) { if (decryptionDir) {
await deleteAll(decryptionDir); await deleteAll(decryptionDir);
} }
 End of changes. 8 change blocks. 
40 lines changed or deleted 12 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)