Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
renamed Help to User Guide
zadam94dcaae12d2a
diff --git a/src/services/hidden_subtree.js b/src/services/hidden_subtree.jsindex e6337e1b89..e5115558db 100644--- a/src/services/hidden_subtree.js+++ b/src/services/hidden_subtree.js@@ -71,8 +71,8 @@ const HIDDEN_SUBTREE_DEFINITION = {]},{- id: '_help',- title: 'Help',+ id: '_userGuide',+ title: 'User Guide',type: 'text',icon: 'bx-help-circle'},diff --git a/src/services/options_init.js b/src/services/options_init.jsindex 630c5ea2f8..40c2b79d5e 100644--- a/src/services/options_init.js+++ b/src/services/options_init.js@@ -89,7 +89,7 @@ const defaultOptions = [{ name: 'minTocHeadings', value: '5', isSynced: true },{ name: 'checkForUpdates', value: 'true', isSynced: true },{ name: 'disableTray', value: 'false', isSynced: false },- { name: 'helpSha256Hash', value: '', isSynced: true },+ { name: 'userGuideSha256Hash', value: '', isSynced: true },];function initStartupOptions() {diff --git a/src/services/resource_dir.js b/src/services/resource_dir.jsindex fd98be4c32..0e968d42a0 100644--- a/src/services/resource_dir.js+++ b/src/services/resource_dir.js@@ -20,12 +20,12 @@ if (!fs.existsSync(MIGRATIONS_DIR)) {process.exit(1);}-const HELP_ZIP_DIR = path.resolve(RESOURCE_DIR, "tmp");+const USER_GUIDE_ZIP_DIR = path.resolve(RESOURCE_DIR, "tmp");module.exports = {RESOURCE_DIR,MIGRATIONS_DIR,DB_INIT_DIR,ELECTRON_APP_ROOT_DIR,- HELP_ZIP_DIR+ USER_GUIDE_ZIP_DIR};diff --git a/src/services/scheduler.js b/src/services/scheduler.jsindex 25a769d21c..9e0b166551 100644--- a/src/services/scheduler.js+++ b/src/services/scheduler.js@@ -7,7 +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");+const helpImportService = require("./user_guide_import.js");function getRunAtHours(note) {try {@@ -55,7 +55,7 @@ sqlInit.dbReady.then(() => {cls.init(() => {hiddenSubtreeService.checkHiddenSubtree();- helpImportService.importHelpIfNeeded();+ helpImportService.importUserGuideIfNeeded();});if (!process.env.TRILIUM_SAFE_MODE) {diff --git a/src/services/help_import.js b/src/services/user_guide_import.jssimilarity index 91%rename from src/services/help_import.jsrename to src/services/user_guide_import.jsindex 959b7ad9f1..0bc87a93ed 100644--- a/src/services/help_import.js+++ b/src/services/user_guide_import.js@@ -13,29 +13,29 @@ const yauzl = require("yauzl");const htmlSanitizer = require('./html_sanitizer');const sql = require('./sql');const options = require('./options');-const {HELP_ZIP_DIR} = require('./resource_dir');+const {USER_GUIDE_ZIP_DIR} = require('./resource_dir');-async function importHelpIfNeeded() {- const helpSha256HashInDb = options.getOption('helpSha256Hash');- let helpSha256HashInFile = await fs.readFile(HELP_ZIP_DIR + "/help.zip.sha256");+async function importUserGuideIfNeeded() {+ const userGuideSha256HashInDb = options.getOption('userGuideSha256Hash');+ let userGuideSha256HashInFile = await fs.readFile(USER_GUIDE_ZIP_DIR + "/user-guide.zip.sha256");- if (!helpSha256HashInFile || helpSha256HashInFile.byteLength < 64) {+ if (!userGuideSha256HashInFile || userGuideSha256HashInFile.byteLength < 64) {return;}- helpSha256HashInFile = helpSha256HashInFile.toString().substr(0, 64);+ userGuideSha256HashInFile = userGuideSha256HashInFile.toString().substr(0, 64);- if (helpSha256HashInDb === helpSha256HashInFile) {- // help file has been already imported and is up to date+ if (userGuideSha256HashInDb === userGuideSha256HashInFile) {+ // user guide ZIP file has been already imported and is up-to-datereturn;}const hiddenRoot = becca.getNote("_hidden");- const data = await fs.readFile(HELP_ZIP_DIR + "/" + "help.zip", "binary");+ const data = await fs.readFile(USER_GUIDE_ZIP_DIR + "/user-guide.zip", "binary");await importZip(Buffer.from(data, 'binary'), hiddenRoot);- options.setOption('helpSha256Hash', helpSha256HashInFile);+ options.setOption('userGuideSha256Hash', userGuideSha256HashInFile);}async function importZip(fileBuffer, importRootNote) {@@ -87,15 +87,15 @@ async function importZip(fileBuffer, importRootNote) {}function getNoteId(noteMeta) {- let helpNoteId = noteMeta.attributes?.find(attr => attr.type === 'label' && attr.name === 'helpNoteId')?.value;+ let userGuideNoteId = noteMeta.attributes?.find(attr => attr.type === 'label' && attr.name === 'helpNoteId')?.value;- helpNoteId = '_help' + noteMeta.title.replace(/[^a-z0-9]/ig, '');+ userGuideNoteId = '_userGuide' + noteMeta.title.replace(/[^a-z0-9]/ig, '');- if (helpNoteId === '_helpHelp') {- helpNoteId = '_help';+ if (noteMeta.title.trim() === 'User Guide') {+ userGuideNoteId = '_userGuide';}- const noteId = helpNoteId || noteMeta.noteId;+ const noteId = userGuideNoteId || noteMeta.noteId;noteIdMap[noteMeta.noteId] = noteId;return noteId;@@ -394,7 +394,7 @@ async function importZip(fileBuffer, importRootNote) {metaFile = JSON.parse(entries.find(entry => entry.type === 'file' && entry.filePath === '!!!meta.json').content);sql.transactional(() => {- deleteHelpSubtree();+ deleteUserGuideSubtree();for (const {type, filePath, content} of entries) {if (type === 'directory') {@@ -424,11 +424,11 @@ async function importZip(fileBuffer, importRootNote) {}/**- * This is a special implementation of deleting the subtree, because we want to preserve the links to the help pages+ * This is a special implementation of deleting the subtree, because we want to preserve the links to the user guide pages* and clones.*/-function deleteHelpSubtree() {- const DELETE_ID = 'help';+function deleteUserGuideSubtree() {+ const DELETE_ID = 'user-guide';function remove(branch) {branch.markAsDeleted(DELETE_ID);@@ -444,7 +444,7 @@ function deleteHelpSubtree() {note.markAsDeleted(DELETE_ID)}- remove(becca.getBranchFromChildAndParent('_help', '_hidden'));+ remove(becca.getBranchFromChildAndParent('_userGuide', '_hidden'));}/** @returns {string} path without leading or trailing slash and backslashes converted to forward ones */@@ -491,5 +491,5 @@ function readZipFile(buffer, processEntryCallback) {}module.exports = {- importHelpIfNeeded+ importUserGuideIfNeeded};