Skip to content

Build your personal knowledge base with Trilium Notes

refreshing protected session when loading and saving protected notes

azivner98a2322b370e
diff --git a/public/javascripts/note_editor.js b/public/javascripts/note_editor.js
index 2309fe821a..36d8b9edb2 100644
--- a/public/javascripts/note_editor.js
+++ b/public/javascripts/note_editor.js
@@ -60,6 +60,10 @@ const noteEditor = (function() {
updateNoteFromInputs(note);
await saveNoteToServer(note);
+
+ if (note.detail.is_protected) {
+ protected_session.touchProtectedSession();
+ }
}
function parseHtml(contents, note) {
@@ -196,6 +200,10 @@ const noteEditor = (function() {
await protected_session.ensureProtectedSession(currentNote.detail.is_protected, false);
+ if (currentNote.detail.is_protected) {
+ protected_session.touchProtectedSession();
+ }
+
noteDetailWrapperEl.show();
// this may fal if the dialog has not been previously opened
@@ -260,8 +268,6 @@ const noteEditor = (function() {
createNewTopLevelNote,
createNote,
setNoteBackgroundIfProtected,
- setTreeBasedOnProtectedStatus,
- loadNoteToEditor,
loadNote,
getCurrentNote,
getCurrentNoteId,
diff --git a/public/javascripts/protected_session.js b/public/javascripts/protected_session.js
index 9032cc4822..5e32e94ae7 100644
--- a/public/javascripts/protected_session.js
+++ b/public/javascripts/protected_session.js
@@ -133,6 +133,12 @@ const protected_session = (function() {
noteEditor.setNoteBackgroundIfProtected(note);
}
+ function touchProtectedSession() {
+ if (isProtectedSessionAvailable()) {
+ lastProtectedSessionOperationDate = new Date();
+ }
+ }
+
passwordFormEl.submit(() => {
setupProtectedSession();
@@ -152,6 +158,7 @@ const protected_session = (function() {
isProtectedSessionAvailable,
protectNoteAndSendToServer,
unprotectNoteAndSendToServer,
- getProtectedSessionId
+ getProtectedSessionId,
+ touchProtectedSession
};
})();
\ No newline at end of file