From 458ed1faffda528ad46a3e599792984dbdcf7789 Mon Sep 17 00:00:00 2001 From: azivner Date: Fri, 28 Dec 2018 23:47:06 +0100 Subject: [PATCH] mobile detection --- src/routes/index.js | 4 +++- src/views/{index.ejs => desktop.ejs} | 0 src/views/login.ejs | 22 ++++++++++++++++++++-- 3 files changed, 23 insertions(+), 3 deletions(-) rename src/views/{index.ejs => desktop.ejs} (100%) diff --git a/src/routes/index.js b/src/routes/index.js index e3e36f845..c0af0c5f4 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -9,7 +9,9 @@ const optionService = require('../services/options'); async function index(req, res) { const options = await optionService.getOptionsMap(); - res.render('index', { + const view = req.cookies['trilium-device'] === 'mobile' ? 'mobile' : 'desktop'; + + res.render(view, { theme: options.theme, leftPaneMinWidth: parseInt(options.leftPaneMinWidth), leftPaneWidthPercent: parseInt(options.leftPaneWidthPercent), diff --git a/src/views/index.ejs b/src/views/desktop.ejs similarity index 100% rename from src/views/index.ejs rename to src/views/desktop.ejs diff --git a/src/views/login.ejs b/src/views/login.ejs index 354e0d17d..8286c7899 100644 --- a/src/views/login.ejs +++ b/src/views/login.ejs @@ -42,8 +42,26 @@ - - +