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
added enter/leave protected session into the mobile frontend
zadamfe27c8007824
diff --git a/src/public/app/widgets/mobile_widgets/mobile_global_buttons.js b/src/public/app/widgets/mobile_widgets/mobile_global_buttons.jsindex 71d9dcd60f..16446e4bdb 100644--- a/src/public/app/widgets/mobile_widgets/mobile_global_buttons.js+++ b/src/public/app/widgets/mobile_widgets/mobile_global_buttons.js@@ -1,4 +1,5 @@import BasicWidget from "../basic_widget.js";+import protectedSessionHolder from "../../services/protected_session_holder.js";const WIDGET_TPL = `<div id="global-buttons">@@ -39,6 +40,8 @@ const WIDGET_TPL = `<div class="dropdown-menu dropdown-menu-right"><a class="dropdown-item" data-trigger-command="switchToDesktopVersion"><span class="bx bx-laptop"></span> Switch to desktop version</a>+ <a class="dropdown-item" data-trigger-command="enterProtectedSession"><span class="bx bx-shield-quarter"></span> Enter protected session</a>+ <a class="dropdown-item" data-trigger-command="leaveProtectedSession"><span class="bx bx-check-shield"></span> Leave protected session</a><a class="dropdown-item" data-trigger-command="logout"><span class="bx bx-log-out"></span> Logout</a></div></div>@@ -48,6 +51,18 @@ const WIDGET_TPL = `class MobileGlobalButtonsWidget extends BasicWidget {doRender() {this.$widget = $(WIDGET_TPL);+ this.updateSettings();+ }++ protectedSessionStartedEvent() {+ this.updateSettings();+ }++ updateSettings() {+ const protectedSession = protectedSessionHolder.isProtectedSessionAvailable();++ this.$widget.find('[data-trigger-command="enterProtectedSession"]').toggle(!protectedSession);+ this.$widget.find('[data-trigger-command="leaveProtectedSession"]').toggle(protectedSession);}}diff --git a/src/views/mobile.ejs b/src/views/mobile.ejsindex 9d6450e196..7ee37f882f 100644--- a/src/views/mobile.ejs+++ b/src/views/mobile.ejs@@ -103,6 +103,7 @@<div class="dropdown-menu dropdown-menu-sm" id="context-menu-container"></div><%- include('dialogs/confirm.ejs') %>+<%- include('dialogs/protected_session_password.ejs') %><script type="text/javascript">global = globalThis; /* fixes https://github.com/webpack/webpack/issues/10035 */@@ -116,7 +117,8 @@instanceName: '<%= instanceName %>',csrfToken: '<%= csrfToken %>',isDev: <%= isDev %>,- appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>+ appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>,+ isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>};</script>