You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-06-15 23:00:36 +02:00
All: Optimised encryption and decryption of items so that it doesn't freeze the UI, especially on mobile
This commit is contained in:
@ -73,7 +73,12 @@ class Resource extends BaseItem {
|
||||
}
|
||||
|
||||
try {
|
||||
await this.encryptionService().decryptFile(encryptedPath, plainTextPath);
|
||||
// const stat = await this.fsDriver().stat(encryptedPath);
|
||||
await this.encryptionService().decryptFile(encryptedPath, plainTextPath, {
|
||||
// onProgress: (progress) => {
|
||||
// console.info('Decryption: ', progress.doneSize / stat.size);
|
||||
// },
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.code === 'invalidIdentifier') {
|
||||
// As the identifier is invalid it most likely means that this is not encrypted data
|
||||
@ -108,7 +113,12 @@ class Resource extends BaseItem {
|
||||
if (resource.encryption_blob_encrypted) return { path: encryptedPath, resource: resource };
|
||||
|
||||
try {
|
||||
await this.encryptionService().encryptFile(plainTextPath, encryptedPath);
|
||||
// const stat = await this.fsDriver().stat(plainTextPath);
|
||||
await this.encryptionService().encryptFile(plainTextPath, encryptedPath, {
|
||||
// onProgress: (progress) => {
|
||||
// console.info(progress.doneSize / stat.size);
|
||||
// },
|
||||
});
|
||||
} catch (error) {
|
||||
if (error.code === 'ENOENT') throw new JoplinError('File not found:' + error.toString(), 'fileNotFound');
|
||||
throw error;
|
||||
|
Reference in New Issue
Block a user