1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-12 22:57:38 +02:00

All: Allow disabling encryption and added more test cases

This commit is contained in:
Laurent Cozic
2017-12-20 20:45:25 +01:00
parent cc02c1d585
commit 18846c11ed
9 changed files with 281 additions and 68 deletions

View File

@ -217,7 +217,6 @@ class Synchronizer {
if (donePaths.indexOf(path) > 0) throw new Error(sprintf('Processing a path that has already been done: %s. sync_time was not updated?', path));
let remote = await this.api().stat(path);
//let content = await ItemClass.serializeForSync(local);
let action = null;
let updateSyncTimeOnly = true;
let reason = '';
@ -561,9 +560,9 @@ class Synchronizer {
await BaseItem.deleteOrphanSyncItems();
}
} catch (error) {
if (error && error.code === 'noActiveMasterKey') {
// Don't log an error for this as this is a common
// condition that the UI should report anyway.
if (error && ['cannotEncryptEncrypted', 'noActiveMasterKey'].indexOf(error.code) >= 0) {
// Only log an info statement for this since this is a common condition that is reported
// in the application, and needs to be resolved by the user
this.logger().info(error.message);
} else {
this.logger().error(error);
@ -583,7 +582,7 @@ class Synchronizer {
const mk = await MasterKey.latest();
if (mk) {
this.logger().info('Using master key: ', mk);
await this.encryptionService().initializeEncryption(mk);
await this.encryptionService().enableEncryption(mk);
await this.encryptionService().loadMasterKeysFromSettings();
this.logger().info('Encryption has been enabled with downloaded master key as active key. However, note that no password was initially supplied. It will need to be provided by user.');
}