This commit is contained in:
zadam 2022-12-29 14:25:25 +01:00
parent 007e45ad8c
commit 16c3833a36
3 changed files with 15 additions and 9 deletions

View File

@ -13,7 +13,6 @@ const utils = require('./services/utils');
const assetPath = require('./services/asset_path'); const assetPath = require('./services/asset_path');
require('./services/handlers'); require('./services/handlers');
require('./becca/becca_loader'); require('./becca/becca_loader');
require('./services/help_import');
const app = express(); const app = express();

View File

@ -17,14 +17,12 @@ const sql = require('./sql');
const HELP_FILE_PATH = '/home/adam/Downloads/Help4.zip'; const HELP_FILE_PATH = '/home/adam/Downloads/Help4.zip';
beccaLoader.beccaLoaded.then(() => { async function importHelp() {
cls.init(async () => { const hiddenRoot = becca.getNote("_hidden");
const hiddenRoot = becca.getNote("_hidden"); const data = await fs.readFile(HELP_FILE_PATH, "binary");
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) { async function importZip(fileBuffer, importRootNote) {
// maps from original noteId (in ZIP file) to newly generated noteId // maps from original noteId (in ZIP file) to newly generated noteId
@ -477,3 +475,7 @@ function readZipFile(buffer, processEntryCallback) {
}); });
}); });
} }
module.exports = {
importHelp
}

View File

@ -7,6 +7,7 @@ const sql = require("./sql");
const becca = require("../becca/becca"); const becca = require("../becca/becca");
const protectedSessionService = require("../services/protected_session"); const protectedSessionService = require("../services/protected_session");
const hiddenSubtreeService = require("./hidden_subtree"); const hiddenSubtreeService = require("./hidden_subtree");
const helpImportService = require("./help_import");
function getRunAtHours(note) { function getRunAtHours(note) {
try { try {
@ -51,7 +52,11 @@ function runNotesWithLabel(runAttrValue) {
} }
sqlInit.dbReady.then(() => { sqlInit.dbReady.then(() => {
cls.init(() => hiddenSubtreeService.checkHiddenSubtree()); cls.init(() => {
hiddenSubtreeService.checkHiddenSubtree();
helpImportService.importHelp();
});
if (!process.env.TRILIUM_SAFE_MODE) { if (!process.env.TRILIUM_SAFE_MODE) {
setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000); setTimeout(cls.wrap(() => runNotesWithLabel('backendStartup')), 10 * 1000);