Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
chore(client-standalone): basic support for mobile
Elian Doran882793e794a0
diff --git a/apps/client/src/index.ts b/apps/client/src/index.tsindex 795adc8cfd..0d0ebd9e01 100644--- a/apps/client/src/index.ts+++ b/apps/client/src/index.ts@@ -25,10 +25,24 @@ async function setupGlob() {window.global = globalThis; /* fixes https://github.com/webpack/webpack/issues/10035 */window.glob = {...json,- activeDialog: null+ activeDialog: null,+ device: getDevice()};}+function getDevice() {+ // Respect user's manual override via URL.+ const urlParams = new URLSearchParams(window.location.search);+ if (urlParams.has("desktop")) {+ return "desktop";+ } else if (urlParams.has("mobile")) {+ return "mobile";+ }++ const deviceCookie = document.cookie.split("; ").find(row => row.startsWith("trilium-device="))?.split("=")[1];+ return deviceCookie ?? "desktop";+}+async function loadBootstrapCss() {// We have to selectively import Bootstrap CSS based on text direction.if (glob.isRtl) {