mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
delay protected session expiration check after DB init, fixes #2855
This commit is contained in:
parent
c51e6107a1
commit
04379b4e1f
@ -3,6 +3,7 @@
|
|||||||
const log = require('./log');
|
const log = require('./log');
|
||||||
const dataEncryptionService = require('./data_encryption');
|
const dataEncryptionService = require('./data_encryption');
|
||||||
const options = require("./options");
|
const options = require("./options");
|
||||||
|
const sqlInit = require("./sql_init");
|
||||||
|
|
||||||
let dataKey = null;
|
let dataKey = null;
|
||||||
|
|
||||||
@ -63,17 +64,19 @@ function touchProtectedSession() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
setInterval(() => {
|
sqlInit.dbReady.then(() => {
|
||||||
const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout');
|
setInterval(() => {
|
||||||
if (isProtectedSessionAvailable()
|
const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout');
|
||||||
&& lastProtectedSessionOperationDate
|
if (isProtectedSessionAvailable()
|
||||||
&& Date.now() - lastProtectedSessionOperationDate > protectedSessionTimeout * 1000) {
|
&& lastProtectedSessionOperationDate
|
||||||
|
&& Date.now() - lastProtectedSessionOperationDate > protectedSessionTimeout * 1000) {
|
||||||
|
|
||||||
resetDataKey();
|
resetDataKey();
|
||||||
|
|
||||||
require('./ws').reloadFrontend();
|
require('./ws').reloadFrontend();
|
||||||
}
|
}
|
||||||
}, 30000);
|
}, 30000);
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user