Skip to content

Commit

Permalink
refactor(config): rename Cookies to Session
Browse files Browse the repository at this point in the history
as requested in PR #1155
  • Loading branch information
pano9000 committed Feb 10, 2025
1 parent b6d73df commit 7e9e896
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/routes/csrf_protection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/routes/session_parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
},
Expand Down
6 changes: 3 additions & 3 deletions src/services/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export interface TriliumConfig {
keyPath: string;
trustedReverseProxy: boolean | string;
};
Cookies: {
Session: {
cookiePath: string;
}
Sync: {
Expand Down Expand Up @@ -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: {
Expand Down

0 comments on commit 7e9e896

Please # to comment.