From e89057a771a74b166636e05f74926c8e06c20e12 Mon Sep 17 00:00:00 2001 From: zadam Date: Fri, 25 Dec 2020 20:46:04 +0100 Subject: [PATCH 1/4] search note content only if not excluded by other expressions --- .../expressions/note_content_protected_fulltext.js | 12 ++++++------ .../expressions/note_content_unprotected_fulltext.js | 10 +++++----- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/services/search/expressions/note_content_protected_fulltext.js b/src/services/search/expressions/note_content_protected_fulltext.js index daed14000..0ed21eb15 100644 --- a/src/services/search/expressions/note_content_protected_fulltext.js +++ b/src/services/search/expressions/note_content_protected_fulltext.js @@ -32,11 +32,15 @@ class NoteContentProtectedFulltextExp extends Expression { FROM notes JOIN note_contents USING (noteId) WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 1`)) { + if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) { + continue; + } + try { content = protectedSessionService.decryptString(content); } catch (e) { - log.info('Cannot decrypt content of note', noteId); + log.info(`Cannot decrypt content of note ${noteId}`); continue; } @@ -50,11 +54,7 @@ class NoteContentProtectedFulltextExp extends Expression { content = content.replace(/ /g, ' '); } - if (this.tokens.find(token => !content.includes(token))) { - continue; - } - - if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) { + if (!this.tokens.find(token => !content.includes(token))) { resultNoteSet.add(noteCache.notes[noteId]); } } diff --git a/src/services/search/expressions/note_content_unprotected_fulltext.js b/src/services/search/expressions/note_content_unprotected_fulltext.js index ad0ce7cdf..a9a531269 100644 --- a/src/services/search/expressions/note_content_unprotected_fulltext.js +++ b/src/services/search/expressions/note_content_unprotected_fulltext.js @@ -26,6 +26,10 @@ class NoteContentUnprotectedFulltextExp extends Expression { FROM notes JOIN note_contents USING (noteId) WHERE type IN ('text', 'code') AND isDeleted = 0 AND isProtected = 0`)) { + if (!inputNoteSet.hasNoteId(noteId) || !(noteId in noteCache.notes)) { + continue; + } + content = content.toString().toLowerCase(); if (type === 'text' && mime === 'text/html') { @@ -36,11 +40,7 @@ class NoteContentUnprotectedFulltextExp extends Expression { content = content.replace(/ /g, ' '); } - if (this.tokens.find(token => !content.includes(token))) { - continue; - } - - if (inputNoteSet.hasNoteId(noteId) && noteId in noteCache.notes) { + if (!this.tokens.find(token => !content.includes(token))) { resultNoteSet.add(noteCache.notes[noteId]); } } From 04e6431c09286d339af011f64fd7bf4738b7df6e Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 30 Dec 2020 23:20:12 +0100 Subject: [PATCH 2/4] use correct class in exported HTMLs so that content style is applied, #1504 --- src/services/export/zip.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/export/zip.js b/src/services/export/zip.js index 5c7376f34..aa9388196 100644 --- a/src/services/export/zip.js +++ b/src/services/export/zip.js @@ -234,7 +234,7 @@ function exportToZip(taskContext, branch, format, res) { - +

${utils.escapeHtml(title)}

${content} From 369274ead75947a68bf7bbb5ab1e784e81521030 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 11 Jan 2021 22:29:02 +0100 Subject: [PATCH 3/4] new env variable to specify start note, #1532 --- src/services/options_init.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/services/options_init.js b/src/services/options_init.js index 26283a424..02dbc1ee2 100644 --- a/src/services/options_init.js +++ b/src/services/options_init.js @@ -31,10 +31,7 @@ function initNotSyncedOptions(initialized, startNotePath = 'root', opts = {}) { optionService.createOption('openTabs', JSON.stringify([ { notePath: startNotePath, - active: true, - sidebar: { - widgets: [] - } + active: true } ]), false); @@ -103,6 +100,15 @@ function initStartupOptions() { log.info(`Created missing option "${name}" with default value "${value}"`); } } + + if (process.env.TRILIUM_START_NOTE_ID) { + optionService.setOption('openTabs', JSON.stringify([ + { + notePath: process.env.TRILIUM_START_NOTE_ID, + active: true + } + ])); + } } function getKeyboardDefaultOptions() { From 6afc299efb616d47c72b5f58ab2827c0e3e121c2 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 11 Jan 2021 22:29:31 +0100 Subject: [PATCH 4/4] release 0.45.8 --- package.json | 2 +- src/services/build.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/package.json b/package.json index bb729dc75..4503e20d3 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.45.7", + "version": "0.45.8", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/services/build.js b/src/services/build.js index 18f8a65b8..37e1951e4 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2020-12-22T20:21:15+01:00", buildRevision: "bdfd760b9d428dc29c45a0e016d12a25af220043" }; +module.exports = { buildDate:"2021-01-11T22:29:31+01:00", buildRevision: "369274ead75947a68bf7bbb5ab1e784e81521030" };