diff --git a/docker-compose.yml b/docker-compose.yml index f74021d82..63f798bb9 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -21,3 +21,5 @@ services: # Unless TRILIUM_DATA_DIR is set, the data will be stored in the "trilium-data" directory in the home directory. # This can also be changed with by replacing the line below with `- /path/of/your/choice:/home/node/trilium-data - ${TRILIUM_DATA_DIR:-~/trilium-data}:/home/node/trilium-data + - /etc/timezone:/etc/timezone:ro + - /etc/localtime:/etc/localtime:ro diff --git a/src/views/login.ejs b/src/views/login.ejs index a17a58909..f9a058565 100644 --- a/src/views/login.ejs +++ b/src/views/login.ejs @@ -6,11 +6,16 @@ <%= t("login.title") %> + + + +
-
-

<%= t("login.heading") %>

+
+ +

<%= t("login.heading") %>

<% if (failedAuth) { %>
@@ -43,20 +48,8 @@ // Required for correct loading of scripts in Electron if (typeof module === 'object') {window.module = module; module = undefined;} - let device; - - if (window.location.search === '?desktop') { - device = "desktop"; - } - else if (window.location.search === '?mobile') { - device = "mobile"; - } - else { - device = isMobile() ? "mobile" : "desktop"; - } - + const device = getDeviceType() console.log("Setting device cookie to:", device); - setCookie("trilium-device", device); function setCookie(name, value) { @@ -66,21 +59,21 @@ document.cookie = name + "=" + (value || "") + expires + "; path=/"; } + function getDeviceType() { + if (window.location.search === '?desktop') return "desktop"; + if (window.location.search === '?mobile') return "mobile"; + return isMobile() ? "mobile" : "desktop"; + } + // https://stackoverflow.com/a/73731646/944162 function isMobile() { const mQ = matchMedia?.('(pointer:coarse)'); if (mQ?.media === '(pointer:coarse)') return !!mQ.matches; if ('orientation' in window) return true; - - return /\b(BlackBerry|webOS|iPhone|IEMobile)\b/i.test(navigator.userAgent) || - /\b(Android|Windows Phone|iPad|iPod)\b/i.test(navigator.userAgent); + const userAgentsRegEx = /\b(Android|iPhone|iPad|iPod|Windows Phone|BlackBerry|webOS|IEMobile)\b/i + return userAgentsRegEx.test(navigator.userAgent) } - - - - - diff --git a/translations/en/server.json b/translations/en/server.json index c04fc52f9..2e16e7f6e 100644 --- a/translations/en/server.json +++ b/translations/en/server.json @@ -94,7 +94,7 @@ }, "login": { "title": "Login", - "heading": "Trilium login", + "heading": "Trilium Login", "incorrect-password": "Password is incorrect. Please try again.", "password": "Password", "remember-me": "Remember me",