feat(session_parser): use seconds for setting maxAge and update default value to 21 days

21 days was used in the login route previously, when "remember me" was set
pull/1156/head
Panagiotis Papadopoulos 2025-02-13 08:39:02 +07:00
parent 04827c0ce1
commit 2a740781cb
2 changed files with 3 additions and 3 deletions

@ -12,11 +12,11 @@ const sessionParser = session({
cookie: {
path: config.Session.cookiePath,
httpOnly: true,
maxAge: config.Session.cookieMaxAge
maxAge: config.Session.cookieMaxAge * 1000 // needs value in milliseconds
},
name: "trilium.sid",
store: new FileStore({
ttl: config.Session.cookieMaxAge / 1000, // needs value in seconds
ttl: config.Session.cookieMaxAge,
path: `${dataDir.TRILIUM_DATA_DIR}/sessions`
})
});

@ -85,7 +85,7 @@ const config: TriliumConfig = {
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
process.env.TRILIUM_SESSION_COOKIEMAXAGE || iniConfig?.Session?.cookieMaxAge || 21 * 24 * 60 * 60 // 21 Days in Seconds
},
Sync: {