refactor(config): rename Cookies to Session

as requested in PR #1155
This commit is contained in:
Panagiotis Papadopoulos 2025-02-10 19:07:21 +01:00
parent b6d73df92e
commit 62f8f8f1a7
4 changed files with 6 additions and 6 deletions

View File

@ -29,7 +29,7 @@ keyPath=
trustedReverseProxy=false
[Cookies]
[Session]
# Use this setting to constrain the current instance's "Path" value for the set cookies
# This can be useful, when you have several instances running on the same domain, under different paths (e.g. by using a reverse proxy).
# It prevents your instances from overwriting each others' cookies.

View File

@ -6,7 +6,7 @@ import config from "../services/config.js";
const doubleCsrfUtilities = doubleCsrf({
getSecret: () => sessionSecret,
cookieOptions: {
path: config.Cookies.cookiePath,
path: config.Session.cookiePath,
secure: false,
sameSite: "strict",
httpOnly: !isElectron // set to false for Electron, see https://github.com/TriliumNext/Notes/pull/966

View File

@ -10,7 +10,7 @@ const sessionParser = session({
resave: false, // true forces the session to be saved back to the session store, even if the session was never modified during the request.
saveUninitialized: false, // true forces a session that is "uninitialized" to be saved to the store. A session is uninitialized when it is new but not modified.
cookie: {
path: config.Cookies.cookiePath,
path: config.Session.cookiePath,
httpOnly: true,
maxAge: 24 * 60 * 60 * 1000 // in milliseconds
},

View File

@ -32,7 +32,7 @@ export interface TriliumConfig {
keyPath: string;
trustedReverseProxy: boolean | string;
};
Cookies: {
Session: {
cookiePath: string;
}
Sync: {
@ -79,9 +79,9 @@ const config: TriliumConfig = {
process.env.TRILIUM_NETWORK_TRUSTEDREVERSEPROXY || iniConfig.Network.trustedReverseProxy || false
},
Cookies: {
Session: {
cookiePath:
process.env.TRILIUM_COOKIES_COOKIEPATH || iniConfig?.Cookies?.cookiePath || "/"
process.env.TRILIUM_SESSION_COOKIEPATH || iniConfig?.Session?.cookiePath || "/"
},
Sync: {