Migrate to SQLCipher for messages/cache

Quite a few other fixes, including:
  - Sending to contact with no avatar yet (not synced from mobile)
  - Left pane doesn't update quickly or at all on new message
  - Left pane doesn't show sent or error status

Also:
 - Contributing.md: Ensure set of linux dev dependencies is complete
This commit is contained in:
Scott Nonnenberg 2018-07-26 18:13:56 -07:00
parent fc461c82ce
commit 3105b77475
29 changed files with 2006 additions and 716 deletions

36
app/attachment_channel.js Normal file
View file

@ -0,0 +1,36 @@
const electron = require('electron');
const Attachments = require('./attachments');
const rimraf = require('rimraf');
const { ipcMain } = electron;
module.exports = {
initialize,
};
let initialized = false;
const ERASE_ATTACHMENTS_KEY = 'erase-attachments';
async function initialize({ configDir }) {
if (initialized) {
throw new Error('initialze: Already initialized!');
}
initialized = true;
console.log('Ensure attachments directory exists');
await Attachments.ensureDirectory(configDir);
const attachmentsDir = Attachments.getPath(configDir);
ipcMain.on(ERASE_ATTACHMENTS_KEY, async event => {
try {
rimraf.sync(attachmentsDir);
event.sender.send(`${ERASE_ATTACHMENTS_KEY}-done`);
} catch (error) {
const errorForDisplay = error && error.stack ? error.stack : error;
console.log(`sql-erase error: ${errorForDisplay}`);
event.sender.send(`${ERASE_ATTACHMENTS_KEY}-done`, error);
}
});
}