diff --git a/README.md b/README.md index b602093cc..dc451dbc9 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 themes, scripts, plugins and more. + ## 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). diff --git a/src/routes/api/clipper.js b/src/routes/api/clipper.js index 60914e979..d792ff38a 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) { + const labelValue = htmlSanitizer.sanitize(labels[labelName]); + note.setLabel(labelName, labelValue); + } + } const rewrittenContent = processContent(images, note, content); 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/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; } 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'); diff --git a/src/services/search/expressions/note_content_fulltext.js b/src/services/search/expressions/note_content_fulltext.js index 4b1673b6c..456306667 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) { + 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; }