mirror of
https://github.com/zadam/trilium.git
synced 2024-11-11 01:23:57 +08:00
using global one setInterval instead of scheduling setTimeout after each encryption operation (there can be many of them)
This commit is contained in:
parent
fe3d3c1995
commit
aebcabf77d
1 changed files with 14 additions and 14 deletions
|
@ -111,26 +111,26 @@ $("#encryptionPasswordForm").submit(function() {
|
|||
return false;
|
||||
});
|
||||
|
||||
function getAes() {
|
||||
globalLastEncryptionOperationDate = new Date();
|
||||
setInterval(function() {
|
||||
if (globalLastEncryptionOperationDate !== null && new Date().getTime() - globalLastEncryptionOperationDate.getTime() > globalEncryptionKeyTimeToLive) {
|
||||
globalEncryptionKey = null;
|
||||
|
||||
setTimeout(function() {
|
||||
if (new Date().getTime() - globalLastEncryptionOperationDate.getTime() > globalEncryptionKeyTimeToLive) {
|
||||
globalEncryptionKey = null;
|
||||
if (globalNote.detail.encryption > 0) {
|
||||
loadNote(globalNote.detail.note_id);
|
||||
|
||||
if (globalNote.detail.encryption > 0) {
|
||||
loadNote(globalNote.detail.note_id);
|
||||
for (const noteId of globalAllNoteIds) {
|
||||
const note = getNodeByKey(noteId);
|
||||
|
||||
for (const noteId of globalAllNoteIds) {
|
||||
const note = getNodeByKey(noteId);
|
||||
|
||||
if (note.data.encryption > 0) {
|
||||
note.setTitle("[encrypted]");
|
||||
}
|
||||
if (note.data.encryption > 0) {
|
||||
note.setTitle("[encrypted]");
|
||||
}
|
||||
}
|
||||
}
|
||||
}, globalEncryptionKeyTimeToLive + 1000);
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
function getAes() {
|
||||
globalLastEncryptionOperationDate = new Date();
|
||||
|
||||
return new aesjs.ModeOfOperation.ctr(globalEncryptionKey, new aesjs.Counter(5));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue