diff --git a/src/routes/index.ts b/src/routes/index.ts index 5115630a0..4a26d8387 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -19,7 +19,7 @@ function index(req: Request, res: Response) { const view = !utils.isElectron() && req.cookies["trilium-device"] === "mobile" ? "mobile" : "desktop"; - const csrfToken = req.csrfToken(); + const csrfToken = (typeof req.csrfToken === "function") ? req.csrfToken() : undefined; log.info(`Generated CSRF token ${csrfToken} with secret ${res.getHeader("set-cookie")}`); // We force the page to not be cached since on mobile the CSRF token can be