Skip to content

Build your personal knowledge base with Trilium Notes

fix

zadam16c3833a36a7
diff --git a/src/app.js b/src/app.js
index 5869e4b138..c77189fefa 100644
--- a/src/app.js
+++ b/src/app.js
@@ -13,7 +13,6 @@ const utils = require('./services/utils');
const assetPath = require('./services/asset_path');
require('./services/handlers');
require('./becca/becca_loader');
-require('./services/help_import');
const app = express();
diff --git a/src/services/help_import.js b/src/services/help_import.js
index 1b9cd59c02..23eb20d228 100644
--- a/src/services/help_import.js
+++ b/src/services/help_import.js
@@ -17,14 +17,12 @@ const sql = require('./sql');
const HELP_FILE_PATH = '/home/adam/Downloads/Help4.zip';
-beccaLoader.beccaLoaded.then(() => {
- cls.init(async () => {
- const hiddenRoot = becca.getNote("_hidden");
- const data = await fs.readFile(HELP_FILE_PATH, "binary");
+async function importHelp() {
+ const hiddenRoot = becca.getNote("_hidden");
+ const data = await fs.readFile(HELP_FILE_PATH, "binary");
- await importZip(Buffer.from(data, 'binary'), hiddenRoot);
- });
-});
+ await importZip(Buffer.from(data, 'binary'), hiddenRoot);
+}
async function importZip(fileBuffer, importRootNote) {
// maps from original noteId (in ZIP file) to newly generated noteId
@@ -477,3 +475,7 @@ function readZipFile(buffer, processEntryCallback) {
});
});
}
+
+module.exports = {
+ importHelp
+}
diff --git a/src/services/scheduler.js b/src/services/scheduler.js
index 9897f5642e..82b17dd4d3 100644
--- a/src/services/scheduler.js
+++ b/src/services/scheduler.js
@@ -7,6 +7,7 @@ const sql = require("./sql");
const becca = require("../becca/becca");
const protectedSessionService = require("../services/protected_session");
const hiddenSubtreeService = require("./hidden_subtree");
+const helpImportService = require("./help_import");
function getRunAtHours(note) {
try {
@@ -51,7 +52,11 @@ function runNotesWithLabel(runAttrValue) {
}
sqlInit.dbReady.then(() => {
- cls.init(() => hiddenSubtreeService.checkHiddenSubtree());
+ cls.init(() => {
+ hiddenSubtreeService.checkHiddenSubtree();
+
+ helpImportService.importHelp();
+ });
if (!process.env.TRILIUM_SAFE_MODE) {
setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000);