Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
refactor(config): rename Cookies to Session
Panagiotis Papadopoulos62f8f8f1a7c6
diff --git a/config-sample.ini b/config-sample.iniindex 58d5c87bab..939eaa7a5c 100644--- a/config-sample.ini+++ b/config-sample.ini@@ -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.diff --git a/src/routes/csrf_protection.ts b/src/routes/csrf_protection.tsindex e9cd55f267..0ee03d4672 100644--- a/src/routes/csrf_protection.ts+++ b/src/routes/csrf_protection.ts@@ -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/966diff --git a/src/routes/session_parser.ts b/src/routes/session_parser.tsindex b99882d0b1..eaaf0ebe91 100644--- a/src/routes/session_parser.ts+++ b/src/routes/session_parser.ts@@ -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},diff --git a/src/services/config.ts b/src/services/config.tsindex 7dff7ad0a0..b529d47920 100644--- a/src/services/config.ts+++ b/src/services/config.ts@@ -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: {