You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-07-16 00:14:34 +02:00
Electron: E2EE config
This commit is contained in:
@ -346,6 +346,37 @@ class BaseItem extends BaseModel {
|
||||
return output;
|
||||
}
|
||||
|
||||
static async encryptedItemsStats() {
|
||||
const classNames = this.encryptableItemClassNames();
|
||||
let encryptedCount = 0;
|
||||
let totalCount = 0;
|
||||
|
||||
for (let i = 0; i < classNames.length; i++) {
|
||||
const ItemClass = this.getClass(classNames[i]);
|
||||
encryptedCount += await ItemClass.count({ where: 'encryption_applied = 1' });
|
||||
totalCount += await ItemClass.count();
|
||||
}
|
||||
|
||||
return {
|
||||
encrypted: encryptedCount,
|
||||
total: totalCount,
|
||||
};
|
||||
}
|
||||
|
||||
static async encryptedItemsCount() {
|
||||
const classNames = this.encryptableItemClassNames();
|
||||
let output = 0;
|
||||
|
||||
for (let i = 0; i < classNames.length; i++) {
|
||||
const className = classNames[i];
|
||||
const ItemClass = this.getClass(className);
|
||||
const count = await ItemClass.count({ where: 'encryption_applied = 1' });
|
||||
output += count;
|
||||
}
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
static async hasEncryptedItems() {
|
||||
const classNames = this.encryptableItemClassNames();
|
||||
|
||||
|
@ -280,16 +280,11 @@ class EncryptionService {
|
||||
|
||||
await destination.append(this.encodeHeader_(header));
|
||||
|
||||
let fromIndex = 0;
|
||||
|
||||
while (true) {
|
||||
const block = await source.read(this.chunkSize_);
|
||||
if (!block) break;
|
||||
|
||||
fromIndex += block.length;
|
||||
|
||||
const encrypted = await this.encrypt(method, masterKeyPlainText, block);
|
||||
|
||||
await destination.append(padLeft(encrypted.length.toString(16), 6, '0'));
|
||||
await destination.append(encrypted);
|
||||
}
|
||||
|
Reference in New Issue
Block a user