Merge remote-tracking branch 'origin/master'

# Conflicts:
#	package-lock.json
This commit is contained in:
zadam 2023-03-07 23:07:06 +01:00
commit f60e4a1355
6 changed files with 18 additions and 25 deletions

View file

@ -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).

View file

@ -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);

View file

@ -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 = [];

View file

@ -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;
}

View file

@ -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');

View file

@ -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;
}