mirror of
https://github.com/zadam/trilium.git
synced 2025-06-06 18:08:33 +02: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
@ -111,11 +111,8 @@ $("#encryptionPasswordForm").submit(function() {
|
|||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
function getAes() {
|
setInterval(function() {
|
||||||
globalLastEncryptionOperationDate = new Date();
|
if (globalLastEncryptionOperationDate !== null && new Date().getTime() - globalLastEncryptionOperationDate.getTime() > globalEncryptionKeyTimeToLive) {
|
||||||
|
|
||||||
setTimeout(function() {
|
|
||||||
if (new Date().getTime() - globalLastEncryptionOperationDate.getTime() > globalEncryptionKeyTimeToLive) {
|
|
||||||
globalEncryptionKey = null;
|
globalEncryptionKey = null;
|
||||||
|
|
||||||
if (globalNote.detail.encryption > 0) {
|
if (globalNote.detail.encryption > 0) {
|
||||||
@ -130,7 +127,10 @@ function getAes() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}, globalEncryptionKeyTimeToLive + 1000);
|
}, 5000);
|
||||||
|
|
||||||
|
function getAes() {
|
||||||
|
globalLastEncryptionOperationDate = new Date();
|
||||||
|
|
||||||
return new aesjs.ModeOfOperation.ctr(globalEncryptionKey, new aesjs.Counter(5));
|
return new aesjs.ModeOfOperation.ctr(globalEncryptionKey, new aesjs.Counter(5));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user