From 63bcd80375c02433ce8c3312556c1713d5f5cc81 Mon Sep 17 00:00:00 2001 From: Elian Doran Date: Sat, 18 Oct 2025 20:15:28 +0300 Subject: [PATCH] chore(server): set up template for printing --- apps/server/src/assets/views/print.ejs | 30 ++++++++++++++++++++++++++ apps/server/src/routes/api/print.ts | 13 ++++++++--- apps/server/src/routes/routes.ts | 2 +- 3 files changed, 41 insertions(+), 4 deletions(-) create mode 100644 apps/server/src/assets/views/print.ejs diff --git a/apps/server/src/assets/views/print.ejs b/apps/server/src/assets/views/print.ejs new file mode 100644 index 000000000..2ed13581f --- /dev/null +++ b/apps/server/src/assets/views/print.ejs @@ -0,0 +1,30 @@ + + + + + + + + + + Trilium Notes + + + + + + + + + + + + + + diff --git a/apps/server/src/routes/api/print.ts b/apps/server/src/routes/api/print.ts index fff79a66c..844769d56 100644 --- a/apps/server/src/routes/api/print.ts +++ b/apps/server/src/routes/api/print.ts @@ -1,7 +1,14 @@ -import { Request } from "express"; +import { Request, Response } from "express"; +import assetPath from "../../services/asset_path"; +import app_path from "../../services/app_path"; +import { getCurrentLocale } from "../../services/i18n"; -export function getPrintablePage(req: Request) { +export function getPrintablePage(req: Request, res: Response) { const { noteId } = req.params; - return "Hello world: " + noteId; + res.render("print", { + assetPath: assetPath, + appPath: app_path, + currentLocale: getCurrentLocale() + }); } diff --git a/apps/server/src/routes/routes.ts b/apps/server/src/routes/routes.ts index b4e73cf3e..a76810feb 100644 --- a/apps/server/src/routes/routes.ts +++ b/apps/server/src/routes/routes.ts @@ -388,7 +388,7 @@ function register(app: express.Application) { apiDocsRoute(app); // Printing route - apiRoute(GET, "/print/:noteId", getPrintablePage); + route(GET, "/print/:noteId", [ auth.checkAuth ], getPrintablePage); app.use("", router); }