mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
renamed encryption session timeout to protected session timeout
This commit is contained in:
parent
4aa70d3574
commit
892aa39d46
@ -0,0 +1 @@
|
||||
UPDATE options SET opt_name = 'protected_session_timeout' WHERE opt_name = 'encryption_session_timeout';
|
@ -108,19 +108,19 @@ settings.addModule((function() {
|
||||
})());
|
||||
|
||||
settings.addModule((function() {
|
||||
const formEl = $("#encryption-timeout-form");
|
||||
const encryptionTimeoutEl = $("#encryption-timeout-in-seconds");
|
||||
const settingName = 'encryption_session_timeout';
|
||||
const formEl = $("#protected-session-timeout-form");
|
||||
const protectedSessionTimeoutEl = $("#protected-session-timeout-in-seconds");
|
||||
const settingName = 'protected_session_timeout';
|
||||
|
||||
function settingsLoaded(settings) {
|
||||
encryptionTimeoutEl.val(settings[settingName]);
|
||||
protectedSessionTimeoutEl.val(settings[settingName]);
|
||||
}
|
||||
|
||||
formEl.submit(() => {
|
||||
const encryptionTimeout = encryptionTimeoutEl.val();
|
||||
const protectedSessionTimeout = protectedSessionTimeoutEl.val();
|
||||
|
||||
settings.saveSettings(settingName, encryptionTimeout).then(() => {
|
||||
protected_session.setEncryptionSessionTimeout(encryptionTimeout);
|
||||
settings.saveSettings(settingName, protectedSessionTimeout).then(() => {
|
||||
protected_session.setProtectedSessionTimeout(protectedSessionTimeout);
|
||||
});
|
||||
|
||||
return false;
|
||||
|
@ -7,7 +7,7 @@ const protected_session = (function() {
|
||||
|
||||
let protectedSessionDeferred = null;
|
||||
let lastProtectedSessionOperationDate = null;
|
||||
let encryptionSessionTimeout = null;
|
||||
let protectedSessionTimeout = null;
|
||||
let protectedSessionId = null;
|
||||
|
||||
$.ajax({
|
||||
@ -15,11 +15,11 @@ const protected_session = (function() {
|
||||
type: 'GET',
|
||||
error: () => showError("Error getting encryption settings.")
|
||||
}).then(settings => {
|
||||
encryptionSessionTimeout = settings.encryption_session_timeout;
|
||||
protectedSessionTimeout = settings.protected_session_timeout;
|
||||
});
|
||||
|
||||
function setEncryptionSessionTimeout(encSessTimeout) {
|
||||
encryptionSessionTimeout = encSessTimeout;
|
||||
function setProtectedSessionTimeout(encSessTimeout) {
|
||||
protectedSessionTimeout = encSessTimeout;
|
||||
}
|
||||
|
||||
function ensureProtectedSession(requireProtectedSession, modal) {
|
||||
@ -140,13 +140,13 @@ const protected_session = (function() {
|
||||
});
|
||||
|
||||
setInterval(() => {
|
||||
if (lastProtectedSessionOperationDate !== null && new Date().getTime() - lastProtectedSessionOperationDate.getTime() > encryptionSessionTimeout * 1000) {
|
||||
if (lastProtectedSessionOperationDate !== null && new Date().getTime() - lastProtectedSessionOperationDate.getTime() > protectedSessionTimeout * 1000) {
|
||||
resetProtectedSession();
|
||||
}
|
||||
}, 5000);
|
||||
|
||||
return {
|
||||
setEncryptionSessionTimeout,
|
||||
setProtectedSessionTimeout,
|
||||
ensureProtectedSession,
|
||||
resetProtectedSession,
|
||||
isProtectedSessionAvailable,
|
||||
|
@ -10,7 +10,7 @@ const utils = require('../../services/utils');
|
||||
const build = require('../../services/build');
|
||||
|
||||
// options allowed to be updated directly in settings dialog
|
||||
const ALLOWED_OPTIONS = ['encryption_session_timeout', 'history_snapshot_time_interval'];
|
||||
const ALLOWED_OPTIONS = ['protected_session_timeout', 'history_snapshot_time_interval'];
|
||||
|
||||
router.get('/all', auth.checkApiAuth, async (req, res, next) => {
|
||||
const settings = await sql.getMap("SELECT opt_name, opt_value FROM options");
|
||||
|
@ -4,7 +4,7 @@ const options = require('./options');
|
||||
const fs = require('fs-extra');
|
||||
const log = require('./log');
|
||||
|
||||
const APP_DB_VERSION = 28;
|
||||
const APP_DB_VERSION = 29;
|
||||
const MIGRATIONS_DIR = "./migrations";
|
||||
|
||||
async function migrate() {
|
||||
|
@ -1,7 +1,7 @@
|
||||
const sql = require('./sql');
|
||||
const utils = require('./utils');
|
||||
|
||||
const SYNCED_OPTIONS = [ 'username', 'password_verification_hash', 'encrypted_data_key', 'encryption_session_timeout',
|
||||
const SYNCED_OPTIONS = [ 'username', 'password_verification_hash', 'encrypted_data_key', 'protected_session_timeout',
|
||||
'history_snapshot_time_interval' ];
|
||||
|
||||
async function getOption(optName) {
|
||||
|
@ -151,7 +151,7 @@
|
||||
<div id="settings-tabs">
|
||||
<ul>
|
||||
<li><a href="#change-password">Change password</a></li>
|
||||
<li><a href="#encryption-timeout">Encryption timeout</a></li>
|
||||
<li><a href="#protected-session-timeout">Protected session</a></li>
|
||||
<li><a href="#history-snapshot-time-interval">History snapshots</a></li>
|
||||
<li><a href="#about">About Trilium</a></li>
|
||||
</ul>
|
||||
@ -175,14 +175,14 @@
|
||||
<button class="btn btn-sm">Change password</button>
|
||||
</form>
|
||||
</div>
|
||||
<div id="encryption-timeout">
|
||||
<p>Encryption timeout is a time period after which the encryption key and encrypted data is wiped out from
|
||||
browser's memory. This is measured from the last encryption / decryption activity.</p>
|
||||
<div id="protected-session-timeout">
|
||||
<p>Protected session timeout is a time period after which the protected session is wiped out from
|
||||
browser's memory. This is measured from the last interaction with protected notes.</p>
|
||||
|
||||
<form id="encryption-timeout-form">
|
||||
<form id="protected-session-timeout-form">
|
||||
<div class="form-group">
|
||||
<label for="encryption-timeout-in-seconds">Encryption timeout (in seconds)</label>
|
||||
<input class="form-control" id="encryption-timeout-in-seconds" type="number">
|
||||
<label for="protected-session-timeout-in-seconds">Protected session timeout (in seconds)</label>
|
||||
<input class="form-control" id="protected-session-timeout-in-seconds" type="number">
|
||||
</div>
|
||||
|
||||
<button class="btn btn-sm">Save</button>
|
||||
|
Loading…
x
Reference in New Issue
Block a user