mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 10:26:08 +01:00 
			
		
		
		
	added "safe mode" environment variable switch which disables startup scripts and resets tabs
This commit is contained in:
		| @@ -41,6 +41,9 @@ export default class NoteTypeWidget extends TabAwareWidget { | ||||
|         this.$noteTypeDropdown = this.$widget.find(".note-type-dropdown"); | ||||
|         this.$noteTypeButton = this.$widget.find(".note-type-button"); | ||||
|         this.$noteTypeDesc = this.$widget.find(".note-type-desc"); | ||||
|  | ||||
|         this.$widget.on('click', '.dropdown-item', | ||||
|             () => this.$widget.find('.dropdown-toggle').dropdown('toggle')); | ||||
|     } | ||||
|  | ||||
|     async refreshWithNote(note) { | ||||
|   | ||||
| @@ -54,11 +54,21 @@ function getBundlesWithLabel(label, value) { | ||||
| } | ||||
|  | ||||
| function getStartupBundles() { | ||||
|     return getBundlesWithLabel("run", "frontendStartup"); | ||||
|     if (!process.env.TRILIUM_SAFE_MODE) { | ||||
|         return getBundlesWithLabel("run", "frontendStartup"); | ||||
|     } | ||||
|     else { | ||||
|         return []; | ||||
|     } | ||||
| } | ||||
|  | ||||
| function getWidgetBundles() { | ||||
|     return getBundlesWithLabel("widget"); | ||||
|     if (!process.env.TRILIUM_SAFE_MODE) { | ||||
|         return getBundlesWithLabel("widget"); | ||||
|     } | ||||
|     else { | ||||
|         return []; | ||||
|     } | ||||
| } | ||||
|  | ||||
| function getRelationBundles(req) { | ||||
|   | ||||
| @@ -101,10 +101,10 @@ function initStartupOptions() { | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     if (process.env.TRILIUM_START_NOTE_ID) { | ||||
|     if (process.env.TRILIUM_START_NOTE_ID || process.env.TRILIUM_SAFE_MODE) { | ||||
|         optionService.setOption('openTabs', JSON.stringify([ | ||||
|             { | ||||
|                 notePath: process.env.TRILIUM_START_NOTE_ID, | ||||
|                 notePath: process.env.TRILIUM_START_NOTE_ID || 'root', | ||||
|                 active: true | ||||
|             } | ||||
|         ])); | ||||
|   | ||||
| @@ -22,9 +22,11 @@ function runNotesWithLabel(runAttrValue) { | ||||
| } | ||||
|  | ||||
| sqlInit.dbReady.then(() => { | ||||
|     setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000); | ||||
|     if (!process.env.TRILIUM_SAFE_MODE) { | ||||
|         setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000); | ||||
|  | ||||
|     setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000); | ||||
|         setInterval(cls.wrap(() => runNotesWithLabel('hourly')), 3600 * 1000); | ||||
|  | ||||
|     setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000); | ||||
|         setInterval(cls.wrap(() => runNotesWithLabel('daily')), 24 * 3600 * 1000); | ||||
|     } | ||||
| }); | ||||
|   | ||||
| @@ -1,4 +1,3 @@ | ||||
| const sql = require('./sql'); | ||||
| const ScriptContext = require('./script_context'); | ||||
| const repository = require('./repository'); | ||||
| const cls = require('./cls'); | ||||
|   | ||||
		Reference in New Issue
	
	Block a user