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); }