From 14358d1ec00887d7ba75b36d7e63491ac9df206c Mon Sep 17 00:00:00 2001 From: Panagiotis Papadopoulos Date: Wed, 8 Jan 2025 09:15:16 +0100 Subject: [PATCH] refactor(views): use ejs partial for injecting window.glob --- src/routes/index.ts | 3 ++- src/views/desktop.ejs | 24 +----------------------- src/views/mobile.ejs | 21 +-------------------- src/views/partials/windowGlobal.ejs | 23 +++++++++++++++++++++++ 4 files changed, 27 insertions(+), 44 deletions(-) create mode 100644 src/views/partials/windowGlobal.ejs diff --git a/src/routes/index.ts b/src/routes/index.ts index aa943267c..e9cde473a 100644 --- a/src/routes/index.ts +++ b/src/routes/index.ts @@ -34,6 +34,7 @@ function index(req: Request, res: Response) { const isElectron = utils.isElectron(); res.render(view, { + device: view, csrfToken: csrfToken, themeCssUrl: getThemeCssUrl(theme, themeNote), themeUseNextAsBase: themeNote?.getAttributeValue("label", "appThemeBase") === "next", @@ -51,7 +52,7 @@ function index(req: Request, res: Response) { instanceName: config.General ? config.General.instanceName : null, appCssNoteIds: getAppCssNoteIds(), isDev: env.isDev(), - isMainWindow: !req.query.extraWindow, + isMainWindow: (view === "mobile") ? true : !req.query.extraWindow, isProtectedSessionAvailable: protectedSessionService.isProtectedSessionAvailable(), maxContentWidth: Math.max(640, parseInt(options.maxContentWidth)), triliumVersion: packageJson.version, diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs index 514f72695..f56f68eb6 100644 --- a/src/views/desktop.ejs +++ b/src/views/desktop.ejs @@ -21,29 +21,7 @@ - +<%- include("./partials/windowGlobal.ejs", locals) %>