From 6b013c05cc4e263f1f48bcc4af43555953076092 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 1 Mar 2023 10:47:27 +0100 Subject: [PATCH 1/9] added awesome-trilium to README --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index b602093cc..bfa750e96 100644 --- a/README.md +++ b/README.md @@ -35,6 +35,8 @@ Ukraine is currently defending itself from Russian aggression, please consider [ * [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) and [Markdown import & export](https://github.com/zadam/trilium/wiki/Markdown) * [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper) for easy saving of web content +Check out [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party scripts and plugins. + ## Builds Trilium is provided as either desktop application (Linux and Windows) or web application hosted on your server (Linux). Mac OS desktop build is available, but it is [unsupported](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support). From 700c6ffc75fa1c6005dbaafe04b8cd22ed88f77f Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 1 Mar 2023 10:48:11 +0100 Subject: [PATCH 2/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index bfa750e96..97e7b92c2 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Ukraine is currently defending itself from Russian aggression, please consider [ * [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) and [Markdown import & export](https://github.com/zadam/trilium/wiki/Markdown) * [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper) for easy saving of web content -Check out [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party scripts and plugins. +Check out [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party themese, scripts, plugins and more. ## Builds From 46eebdc7aaa9f44604fb4f772c3d8675221d5857 Mon Sep 17 00:00:00 2001 From: zadam Date: Wed, 1 Mar 2023 10:48:34 +0100 Subject: [PATCH 3/9] Update README.md --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 97e7b92c2..dc451dbc9 100644 --- a/README.md +++ b/README.md @@ -35,7 +35,7 @@ Ukraine is currently defending itself from Russian aggression, please consider [ * [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) and [Markdown import & export](https://github.com/zadam/trilium/wiki/Markdown) * [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper) for easy saving of web content -Check out [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party themese, scripts, plugins and more. +Check out [awesome-trilium](https://github.com/Nriver/awesome-trilium) for 3rd party themes, scripts, plugins and more. ## Builds From 540d19c67c89f44b953a42907faf3270649a4734 Mon Sep 17 00:00:00 2001 From: zadam Date: Thu, 2 Mar 2023 08:44:55 +0100 Subject: [PATCH 4/9] fix import of ZIP with images with no meta file, closes #3649 --- package-lock.json | 5 ++--- src/services/import/zip.js | 6 ------ 2 files changed, 2 insertions(+), 9 deletions(-) diff --git a/package-lock.json b/package-lock.json index 2b01d1b36..941d50ed8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,11 @@ { "name": "trilium", - "version": "0.58.8", + "version": "0.59.1", "lockfileVersion": 2, "requires": true, "packages": { "": { - "name": "trilium", - "version": "0.58.8", + "version": "0.59.1", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { diff --git a/src/services/import/zip.js b/src/services/import/zip.js index 1f8a3b8e9..abe3b58a9 100644 --- a/src/services/import/zip.js +++ b/src/services/import/zip.js @@ -231,12 +231,6 @@ async function importZip(taskContext, fileBuffer, importRootNote) { const {noteMeta} = getMeta(absUrl); - if (!noteMeta) { - log.info(`Could not find note meta for URL '${absUrl}'.`); - - return null; - } - const targetNoteId = getNoteId(noteMeta, absUrl); return targetNoteId; } From fdffc27bb67c422ae6ab60b650c597b3aa4d509a Mon Sep 17 00:00:00 2001 From: J Rao Date: Mon, 6 Mar 2023 21:21:09 +0800 Subject: [PATCH 5/9] Allow arbitrary labels to be added via web clipper --- src/routes/api/clipper.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 60914e979..e1500c2c0 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -75,7 +75,7 @@ function addClipping(req) { } function createNote(req) { - let {title, content, pageUrl, images, clipType} = req.body; + let {title, content, pageUrl, images, clipType, labels} = req.body; if (!title || !title.trim()) { title = `Clipped note from ${pageUrl}`; @@ -100,6 +100,13 @@ function createNote(req) { note.setLabel('pageUrl', pageUrl); note.setLabel('iconClass', 'bx bx-globe'); } + + if (labels) { + for (const labelName in labels) { + console.log('set label ' + labelName + ' on the new note!'); + note.setLabel(labelName, labels[labelName]); + } + } const rewrittenContent = processContent(images, note, content); From 2389ab30f84d752d2f867eb8109f3921a764a76a Mon Sep 17 00:00:00 2001 From: J Rao Date: Mon, 6 Mar 2023 21:28:09 +0800 Subject: [PATCH 6/9] sanitize label value --- src/routes/api/clipper.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index e1500c2c0..d792ff38a 100644 --- a/src/routes/api/clipper.js +++ b/src/routes/api/clipper.js @@ -103,8 +103,8 @@ function createNote(req) { if (labels) { for (const labelName in labels) { - console.log('set label ' + labelName + ' on the new note!'); - note.setLabel(labelName, labels[labelName]); + const labelValue = htmlSanitizer.sanitize(labels[labelName]); + note.setLabel(labelName, labelValue); } } From 62c2547557448e705a4d6d4ee5860e667f78561a Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 6 Mar 2023 23:00:29 +0100 Subject: [PATCH 7/9] #run should respect inheritance, fixes #3669 --- src/routes/api/script.js | 2 +- src/services/scheduler.js | 19 ++----------------- 2 files changed, 3 insertions(+), 18 deletions(-) diff --git a/src/routes/api/script.js b/src/routes/api/script.js index 2f2aa879f..b591307df 100644 --- a/src/routes/api/script.js +++ b/src/routes/api/script.js @@ -38,7 +38,7 @@ function run(req) { } function getBundlesWithLabel(label, value) { - const notes = attributeService.getNotesWithLabelFast(label, value); + const notes = attributeService.getNotesWithLabel(label, value); const bundles = []; diff --git a/src/services/scheduler.js b/src/services/scheduler.js index dfc277377..1980ceff0 100644 --- a/src/services/scheduler.js +++ b/src/services/scheduler.js @@ -3,8 +3,7 @@ const cls = require('./cls'); const sqlInit = require('./sql_init'); const config = require('./config'); const log = require('./log'); -const sql = require("./sql"); -const becca = require("../becca/becca"); +const attributeService = require("../services/attributes"); const protectedSessionService = require("../services/protected_session"); const hiddenSubtreeService = require("./hidden_subtree"); @@ -20,23 +19,9 @@ function getRunAtHours(note) { } function runNotesWithLabel(runAttrValue) { - // TODO: should be refactored into becca search - const noteIds = sql.getColumn(` - SELECT notes.noteId - FROM notes - JOIN attributes ON attributes.noteId = notes.noteId - AND attributes.isDeleted = 0 - AND attributes.type = 'label' - AND attributes.name = 'run' - AND attributes.value = ? - WHERE - notes.type = 'code' - AND notes.isDeleted = 0`, [runAttrValue]); - - const notes = becca.getNotes(noteIds); - const instanceName = config.General ? config.General.instanceName : null; const currentHours = new Date().getHours(); + const notes = attributeService.getNotesWithLabel('run', runAttrValue); for (const note of notes) { const runOnInstances = note.getLabelValues('runOnInstance'); From 1e551581f88455bcf2284e5fabacb48e4a0ee49b Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 6 Mar 2023 23:23:32 +0100 Subject: [PATCH 8/9] content null check in full text search, #3672 --- src/services/search/expressions/note_content_fulltext.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/services/search/expressions/note_content_fulltext.js b/src/services/search/expressions/note_content_fulltext.js index 4b1673b6c..c893b124b 100644 --- a/src/services/search/expressions/note_content_fulltext.js +++ b/src/services/search/expressions/note_content_fulltext.js @@ -69,6 +69,10 @@ class NoteContentFulltextExp extends Expression { } } + if (!content || typeof content !== 'string') { + return; + } + content = this.preprocessContent(content, type, mime); if (this.tokens.length === 1) { @@ -98,6 +102,7 @@ class NoteContentFulltextExp extends Expression { resultNoteSet.add(becca.notes[noteId]); } } + return content; } From 177a67f59be1354a8b50c30e5c1fc54acc7659f9 Mon Sep 17 00:00:00 2001 From: zadam Date: Mon, 6 Mar 2023 23:23:56 +0100 Subject: [PATCH 9/9] content null check in full text search, #3672 --- src/services/search/expressions/note_content_fulltext.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/services/search/expressions/note_content_fulltext.js b/src/services/search/expressions/note_content_fulltext.js index c893b124b..456306667 100644 --- a/src/services/search/expressions/note_content_fulltext.js +++ b/src/services/search/expressions/note_content_fulltext.js @@ -69,7 +69,7 @@ class NoteContentFulltextExp extends Expression { } } - if (!content || typeof content !== 'string') { + if (!content) { return; }