A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: set max editor session duration to 5 minutes
Abdullah Atta0aac2eb1e0a7
diff --git a/apps/web/src/stores/editor-store.ts b/apps/web/src/stores/editor-store.tsindex cc9188292..14f634478 100644--- a/apps/web/src/stores/editor-store.ts+++ b/apps/web/src/stores/editor-store.ts@@ -680,10 +680,7 @@ class EditorStore extends BaseStore<EditorStore> {this.setSaveState(id, 0);try {- const sessionId =- "sessionId" in currentSession- ? currentSession.sessionId- : `${Date.now()}`;+ const sessionId = getSessionId(currentSession);if (isLockedSession(currentSession) && partial.content) {await db.vault.save({@@ -762,7 +759,8 @@ class EditorStore extends BaseStore<EditorStore> {this.updateSession(id, ["default"], {preview: false,attachmentsLength: attachmentsLength,- note+ note,+ sessionId});}@@ -918,3 +916,12 @@ function findSessionIndices(duplicateSessionIndex};}++const MILLISECONDS_IN_A_MINUTE = 60 * 1000;+const SESSION_DURATION = MILLISECONDS_IN_A_MINUTE * 5;+function getSessionId(session: DefaultEditorSession | NewEditorSession) {+ const sessionId =+ "sessionId" in session ? parseInt(session.sessionId) : Date.now();+ if (sessionId + SESSION_DURATION < Date.now()) return `${Date.now()}`;+ return `${sessionId}`;+}