Skip to content

Build your personal knowledge base with Trilium Notes

custom widget launchers should not be initialized in safe mode

zadam4c5158827055
diff --git a/src/public/app/widgets/containers/launcher.js b/src/public/app/widgets/containers/launcher.js
index b093c60e96..bb85f8b842 100644
--- a/src/public/app/widgets/containers/launcher.js
+++ b/src/public/app/widgets/containers/launcher.js
@@ -37,6 +37,10 @@ export default class LauncherWidget extends BasicWidget {
const launcherType = note.getLabelValue("launcherType");
+ if (glob.TRILIUM_SAFE_MODE && launcherType === 'customWidget') {
+ return false;
+ }
+
if (launcherType === 'command') {
this.innerWidget = this.initCommandLauncherWidget(note)
.class("launcher-button");
diff --git a/src/public/app/widgets/containers/launcher_container.js b/src/public/app/widgets/containers/launcher_container.js
index 6c7dd21ddb..fe5e69ddec 100644
--- a/src/public/app/widgets/containers/launcher_container.js
+++ b/src/public/app/widgets/containers/launcher_container.js
@@ -27,22 +27,19 @@ export default class LauncherContainer extends FlexContainer {
return;
}
- await Promise.allSettled(
- (await visibleLaunchersRoot.getChildNotes())
- .map(async launcherNote => {
- try {
- const launcherWidget = new LauncherWidget();
- const success = await launcherWidget.initLauncher(launcherNote);
-
- if (success) {
- this.child(launcherWidget);
- }
- }
- catch (e) {
- console.error(e);
- }
- })
- );
+ for (const launcherNote of await visibleLaunchersRoot.getChildNotes()) {
+ try {
+ const launcherWidget = new LauncherWidget();
+ const success = await launcherWidget.initLauncher(launcherNote);
+
+ if (success) {
+ this.child(launcherWidget);
+ }
+ }
+ catch (e) {
+ console.error(e);
+ }
+ }
this.$widget.empty();
this.renderChildren();
diff --git a/src/views/desktop.ejs b/src/views/desktop.ejs
index 6f2af62280..6848847229 100644
--- a/src/views/desktop.ejs
+++ b/src/views/desktop.ejs
@@ -35,7 +35,8 @@
extraHoistedNoteId: '<%= extraHoistedNoteId %>',
isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>,
triliumVersion: "<%= triliumVersion %>",
- assetPath: "<%= assetPath %>"
+ assetPath: "<%= assetPath %>",
+ TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %>
};
</script>
diff --git a/src/views/mobile.ejs b/src/views/mobile.ejs
index c6ad8f8871..4edb46a2fe 100644
--- a/src/views/mobile.ejs
+++ b/src/views/mobile.ejs
@@ -117,7 +117,8 @@
appCssNoteIds: <%- JSON.stringify(appCssNoteIds) %>,
isProtectedSessionAvailable: <%= isProtectedSessionAvailable %>,
assetPath: "<%= assetPath %>",
- isMainWindow: true
+ isMainWindow: true,
+ TRILIUM_SAFE_MODE: <%= !!process.env.TRILIUM_SAFE_MODE %>
};
</script>