mirror of
https://github.com/zadam/trilium.git
synced 2025-02-24 15:05:31 +08:00
moved protected session expiration scheduling #2855
This commit is contained in:
parent
c24c807921
commit
37eb16b2f3
2 changed files with 15 additions and 13 deletions
|
@ -3,7 +3,6 @@
|
|||
const log = require('./log');
|
||||
const dataEncryptionService = require('./data_encryption');
|
||||
const options = require("./options");
|
||||
const sqlInit = require("./sql_init");
|
||||
|
||||
let dataKey = null;
|
||||
|
||||
|
@ -64,8 +63,7 @@ function touchProtectedSession() {
|
|||
}
|
||||
}
|
||||
|
||||
sqlInit.dbReady.then(() => {
|
||||
setInterval(() => {
|
||||
function checkProtectedSessionExpiration() {
|
||||
const protectedSessionTimeout = options.getOptionInt('protectedSessionTimeout');
|
||||
if (isProtectedSessionAvailable()
|
||||
&& lastProtectedSessionOperationDate
|
||||
|
@ -73,11 +71,11 @@ sqlInit.dbReady.then(() => {
|
|||
|
||||
resetDataKey();
|
||||
|
||||
log.info("Expiring protected session");
|
||||
|
||||
require('./ws').reloadFrontend();
|
||||
}
|
||||
}, 30000);
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
setDataKey,
|
||||
|
@ -87,5 +85,6 @@ module.exports = {
|
|||
decrypt,
|
||||
decryptString,
|
||||
decryptNotes,
|
||||
touchProtectedSession
|
||||
touchProtectedSession,
|
||||
checkProtectedSessionExpiration
|
||||
};
|
||||
|
|
|
@ -6,6 +6,7 @@ const log = require('./log');
|
|||
const sql = require("./sql");
|
||||
const becca = require("../becca/becca");
|
||||
const specialNotesService = require("../services/special_notes");
|
||||
const protectedSessionService = require("../services/protected_session");
|
||||
|
||||
function getRunAtHours(note) {
|
||||
try {
|
||||
|
@ -59,4 +60,6 @@ sqlInit.dbReady.then(() => {
|
|||
|
||||
setTimeout(cls.wrap(() => specialNotesService.createMissingSpecialNotes()), 10 * 1000);
|
||||
}
|
||||
|
||||
setInterval(() => protectedSessionService.checkProtectedSessionExpiration(), 30000);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue