From 53576f5578295f8a81c4406e2732033d5b0d37a6 Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Mon, 10 Feb 2025 19:50:30 +0100 Subject: [PATCH] feat(config): add Session.cookieMaxAge allows users to control how long their session will be live, before it expires and they are forced to login again defaults to 1 day ("24 * 60 * 60 * 1000") as previously set in sessionParser --- config-sample.ini | 1 + src/services/config.ts | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/config-sample.ini b/config-sample.ini index 939eaa7a5..49222b1fa 100644 --- a/config-sample.ini +++ b/config-sample.ini @@ -36,6 +36,7 @@ trustedReverseProxy=false # e.g. if you have https://your-domain.com/triliumNext/instanceA and https://your-domain.com/triliumNext/instanceB # you would want to set the cookiePath value to "/triliumNext/instanceA" for your first and "/triliumNext/instanceB" for your second instance cookiePath=/ +cookieMaxAge= [Sync] #syncServerHost= diff --git a/src/services/config.ts b/src/services/config.ts index b529d4792..28b598b53 100644 --- a/src/services/config.ts +++ b/src/services/config.ts @@ -34,6 +34,7 @@ export interface TriliumConfig { }; Session: { cookiePath: string; + cookieMaxAge: number; } Sync: { syncServerHost: string; @@ -81,7 +82,10 @@ const config: TriliumConfig = { Session: { cookiePath: - process.env.TRILIUM_SESSION_COOKIEPATH || iniConfig?.Session?.cookiePath || "/" + process.env.TRILIUM_SESSION_COOKIEPATH || iniConfig?.Session?.cookiePath || "/", + + cookieMaxAge: + process.env.TRILIUM_SESSION_COOKIEMAXAGE || iniConfig?.Session?.cookieMaxAge || "24 * 60 * 60 * 1000" // 24 hours in Milliseconds }, Sync: {