wip import zip as help

This commit is contained in:
zadam 2022-12-25 23:36:56 +01:00
parent b906efb23b
commit acda37e334
5 changed files with 30 additions and 1 deletions

View File

@ -14,7 +14,9 @@
}, },
"scripts": { "scripts": {
"start-server": "cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev node ./src/www", "start-server": "cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev node ./src/www",
"start-server-no-dir": "cross-env TRILIUM_ENV=dev node ./src/www",
"start-electron": "cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev electron --inspect=5858 .", "start-electron": "cross-env TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev electron --inspect=5858 .",
"start-electron-no-dir": "cross-env TRILIUM_ENV=dev electron --inspect=5858 .",
"switch-server": "rm -r ./node_modules/better-sqlite3 && npm install", "switch-server": "rm -r ./node_modules/better-sqlite3 && npm install",
"switch-electron": "rm -r ./node_modules/better-sqlite3 && npm install && ./node_modules/.bin/electron-rebuild", "switch-electron": "rm -r ./node_modules/better-sqlite3 && npm install && ./node_modules/.bin/electron-rebuild",
"build-backend-docs": "rm -r ./docs/backend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js", "build-backend-docs": "rm -r ./docs/backend_api && ./node_modules/.bin/jsdoc -c jsdoc-conf.json -d ./docs/backend_api src/becca/entities/*.js src/services/backend_script_api.js src/services/sql.js",

View File

@ -13,6 +13,7 @@ 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

@ -0,0 +1,20 @@
const sqlInit = require("./sql_init");
const cls = require("./cls");
const zipImport = require("../services/import/zip");
const TaskContext = require("./task_context");
const becca = require("../becca/becca");
const fs = require("fs").promises;
const HELP_FILE_PATH = '/home/adam/Downloads/Help1.zip';
sqlInit.dbReady.then(() => {
cls.init(async () => {
const helpRoot = becca.getNote("_help");
const taskContext = new TaskContext('no-progress-reporting', null, {});
const data = await fs.readFile(HELP_FILE_PATH, "binary");
console.log("BUGGER LENGTH", data.length);
await zipImport.importZip(taskContext, Buffer.from(data, 'binary'), helpRoot);
});
});

View File

@ -63,6 +63,12 @@ const HIDDEN_SUBTREE_DEFINITION = {
{ type: 'label', name: 'keepCurrentHoisting' } { type: 'label', name: 'keepCurrentHoisting' }
] ]
}, },
{
id: '_help',
title: 'Help',
type: 'text',
icon: 'bx-help-circle'
},
{ {
// place for user scripts hidden stuff (scripts should not create notes directly under hidden root) // place for user scripts hidden stuff (scripts should not create notes directly under hidden root)
id: '_userHidden', id: '_userHidden',

View File

@ -6,7 +6,7 @@ const ws = require('./ws');
const taskContexts = {}; const taskContexts = {};
class TaskContext { class TaskContext {
constructor(taskId, taskType, data = null) { constructor(taskId, taskType = null, data = null) {
this.taskId = taskId; this.taskId = taskId;
this.taskType = taskType; this.taskType = taskType;
this.data = data; this.data = data;