Compare commits

...

10 Commits

Author SHA1 Message Date
zadam
999cf0d9e3 release 0.61.14 2023-11-16 00:21:34 +01:00
zadam
0afc41060a template LABEL should not be inherited #4349 2023-11-16 00:11:14 +01:00
zadam
0507c46ae9 revert general HTML support 2023-11-13 00:58:55 +01:00
zadam
6515dd7b23 fix assigning extension to attachment export filenames, closes #4415 2023-11-12 23:57:21 +01:00
zadam
5a38bf78e1 fix content renderer of protected canvas/mermaid notes, closes #4414 2023-11-12 23:43:04 +01:00
zadam
4bdb40904f fix loading reference link titles in read-only text notes, closes #4404 2023-11-12 22:57:04 +01:00
zadam
7fc1eb5262 release 0.61.13 2023-11-06 00:21:41 +01:00
zadam
531e9d4aff graceful handling of sync error 2023-11-06 00:15:35 +01:00
zadam
e0d4766c2d fix recursion in the inline image processing 2023-11-05 21:50:08 +01:00
zadam
ab4e83771c fix throwing empty error 2023-11-04 22:53:09 +01:00
13 changed files with 56 additions and 55 deletions

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

32
package-lock.json generated
View File

@@ -1,12 +1,12 @@
{ {
"name": "trilium", "name": "trilium",
"version": "0.61.10-beta", "version": "0.61.13",
"lockfileVersion": 2, "lockfileVersion": 2,
"requires": true, "requires": true,
"packages": { "packages": {
"": { "": {
"name": "trilium", "name": "trilium",
"version": "0.61.10-beta", "version": "0.61.13",
"hasInstallScript": true, "hasInstallScript": true,
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"dependencies": { "dependencies": {
@@ -47,7 +47,7 @@
"jimp": "0.22.10", "jimp": "0.22.10",
"joplin-turndown-plugin-gfm": "1.0.12", "joplin-turndown-plugin-gfm": "1.0.12",
"jsdom": "22.1.0", "jsdom": "22.1.0",
"marked": "9.1.2", "marked": "9.1.6",
"mime-types": "2.1.35", "mime-types": "2.1.35",
"multer": "1.4.5-lts.1", "multer": "1.4.5-lts.1",
"node-abi": "3.50.0", "node-abi": "3.50.0",
@@ -79,7 +79,7 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "25.9.2", "electron": "25.9.5",
"electron-builder": "24.6.4", "electron-builder": "24.6.4",
"electron-packager": "17.1.2", "electron-packager": "17.1.2",
"electron-rebuild": "3.2.9", "electron-rebuild": "3.2.9",
@@ -4276,9 +4276,9 @@
} }
}, },
"node_modules/electron": { "node_modules/electron": {
"version": "25.9.2", "version": "25.9.5",
"resolved": "https://registry.npmjs.org/electron/-/electron-25.9.2.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-25.9.5.tgz",
"integrity": "sha512-hVBN5rsrL99BKNHvzMeYy2PkAmewuIobu4U3o3EzVz4MDoLmMfW4yTH5GZ4RbJrpokoEky5IzGtRR/ggPzL6Fw==", "integrity": "sha512-gM7GXUSd3JVRcYbBnNOtZeNnE5MCJjtZTT8QyIxJvpQ0Dh9dz3hTuEL62dOwnMFW/l47ACQ6es/8qi01P4QGZA==",
"hasInstallScript": true, "hasInstallScript": true,
"dependencies": { "dependencies": {
"@electron/get": "^2.0.0", "@electron/get": "^2.0.0",
@@ -9037,9 +9037,9 @@
} }
}, },
"node_modules/marked": { "node_modules/marked": {
"version": "9.1.2", "version": "9.1.6",
"resolved": "https://registry.npmjs.org/marked/-/marked-9.1.2.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz",
"integrity": "sha512-qoKMJqK0w6vkLk8+KnKZAH6neUZSNaQqVZ/h2yZ9S7CbLuFHyS2viB0jnqcWF9UKjwsAbMrQtnQhdmdvOVOw9w==", "integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q==",
"bin": { "bin": {
"marked": "bin/marked.js" "marked": "bin/marked.js"
}, },
@@ -16633,9 +16633,9 @@
} }
}, },
"electron": { "electron": {
"version": "25.9.2", "version": "25.9.5",
"resolved": "https://registry.npmjs.org/electron/-/electron-25.9.2.tgz", "resolved": "https://registry.npmjs.org/electron/-/electron-25.9.5.tgz",
"integrity": "sha512-hVBN5rsrL99BKNHvzMeYy2PkAmewuIobu4U3o3EzVz4MDoLmMfW4yTH5GZ4RbJrpokoEky5IzGtRR/ggPzL6Fw==", "integrity": "sha512-gM7GXUSd3JVRcYbBnNOtZeNnE5MCJjtZTT8QyIxJvpQ0Dh9dz3hTuEL62dOwnMFW/l47ACQ6es/8qi01P4QGZA==",
"requires": { "requires": {
"@electron/get": "^2.0.0", "@electron/get": "^2.0.0",
"@types/node": "^18.11.18", "@types/node": "^18.11.18",
@@ -20139,9 +20139,9 @@
"requires": {} "requires": {}
}, },
"marked": { "marked": {
"version": "9.1.2", "version": "9.1.6",
"resolved": "https://registry.npmjs.org/marked/-/marked-9.1.2.tgz", "resolved": "https://registry.npmjs.org/marked/-/marked-9.1.6.tgz",
"integrity": "sha512-qoKMJqK0w6vkLk8+KnKZAH6neUZSNaQqVZ/h2yZ9S7CbLuFHyS2viB0jnqcWF9UKjwsAbMrQtnQhdmdvOVOw9w==" "integrity": "sha512-jcByLnIFkd5gSXZmjNvS1TlmRhCXZjIzHYlaGkPlLIekG55JDR2Z4va9tZwCiP+/RDERiNhMOFu01xd6O5ct1Q=="
}, },
"matcher": { "matcher": {
"version": "3.0.0", "version": "3.0.0",

View File

@@ -2,7 +2,7 @@
"name": "trilium", "name": "trilium",
"productName": "Trilium Notes", "productName": "Trilium Notes",
"description": "Trilium Notes", "description": "Trilium Notes",
"version": "0.61.12", "version": "0.61.14",
"license": "AGPL-3.0-only", "license": "AGPL-3.0-only",
"main": "electron.js", "main": "electron.js",
"bin": { "bin": {
@@ -72,7 +72,7 @@
"jimp": "0.22.10", "jimp": "0.22.10",
"joplin-turndown-plugin-gfm": "1.0.12", "joplin-turndown-plugin-gfm": "1.0.12",
"jsdom": "22.1.0", "jsdom": "22.1.0",
"marked": "9.1.2", "marked": "9.1.6",
"mime-types": "2.1.35", "mime-types": "2.1.35",
"multer": "1.4.5-lts.1", "multer": "1.4.5-lts.1",
"node-abi": "3.50.0", "node-abi": "3.50.0",
@@ -101,7 +101,7 @@
}, },
"devDependencies": { "devDependencies": {
"cross-env": "7.0.3", "cross-env": "7.0.3",
"electron": "25.9.2", "electron": "25.9.5",
"electron-builder": "24.6.4", "electron-builder": "24.6.4",
"electron-packager": "17.1.2", "electron-packager": "17.1.2",
"electron-rebuild": "3.2.9", "electron-rebuild": "3.2.9",

View File

@@ -1156,14 +1156,8 @@ class BNote extends AbstractBeccaEntity {
/** @returns {BAttachment} */ /** @returns {BAttachment} */
getAttachmentByTitle(title) { getAttachmentByTitle(title) {
return sql.getRows(` // cannot use SQL to filter by title since it can be encrypted
SELECT attachments.* return this.getAttachments().filter(attachment => attachment.title === title)[0];
FROM attachments
WHERE ownerId = ?
AND title = ?
AND isDeleted = 0
ORDER BY position`, [this.noteId, title])
.map(row => new BAttachment(row))[0];
} }
/** /**

View File

@@ -157,14 +157,8 @@ class BRevision extends AbstractBeccaEntity {
/** @returns {BAttachment} */ /** @returns {BAttachment} */
getAttachmentByTitle(title) { getAttachmentByTitle(title) {
return sql.getRows(` // cannot use SQL to filter by title since it can be encrypted
SELECT attachments.* return this.getAttachments().filter(attachment => attachment.title === title)[0];
FROM attachments
WHERE ownerId = ?
AND title = ?
AND isDeleted = 0
ORDER BY position`, [this.revisionId, title])
.map(row => new BAttachment(row))[0];
} }
beforeSaving() { beforeSaving() {

View File

@@ -268,7 +268,9 @@ function linkContextMenu(e) {
} }
async function loadReferenceLinkTitle($el, href = null) { async function loadReferenceLinkTitle($el, href = null) {
href = href || $el.find("a").attr("href"); const $link = $el[0].tagName === 'A' ? $el : $el.find("a");
href = href || $link.attr("href");
if (!href) { if (!href) {
console.warn("Empty URL for parsing: " + $el[0].outerHTML); console.warn("Empty URL for parsing: " + $el[0].outerHTML);
return; return;
@@ -286,7 +288,7 @@ async function loadReferenceLinkTitle($el, href = null) {
if (note) { if (note) {
const icon = await getLinkIcon(noteId, viewScope.viewMode); const icon = await getLinkIcon(noteId, viewScope.viewMode);
k
$el.prepend($("<span>").addClass(icon)); $el.prepend($("<span>").addClass(icon));
} }
} }

View File

@@ -172,7 +172,7 @@ if (utils.isElectron()) {
await reportError(arg.method, arg.url, arg.statusCode, arg.body); await reportError(arg.method, arg.url, arg.statusCode, arg.body);
} }
idToRequestMap[arg.requestId].reject(); idToRequestMap[arg.requestId].reject(new Error(`Server responded with ${arg.statusCode}`));
} }
delete idToRequestMap[arg.requestId]; delete idToRequestMap[arg.requestId];

View File

@@ -1 +1 @@
module.exports = { buildDate:"2023-11-04T00:16:19+01:00", buildRevision: "1ebdb0f5e1a5cc1b7f8c36af5e1f750141ab062b" }; module.exports = { buildDate:"2023-11-16T00:21:34+01:00", buildRevision: "0afc41060a935a46642a082128bea5002c2410e1" };

View File

@@ -75,15 +75,14 @@ async function exportToZip(taskContext, branch, format, res, setHeaders = true)
* @return {string} * @return {string}
*/ */
function getDataFileName(type, mime, baseFileName, existingFileNames) { function getDataFileName(type, mime, baseFileName, existingFileNames) {
let fileName = baseFileName; let fileName = baseFileName.trim();
if (fileName.length > 30) {
fileName = fileName.substr(0, 30).trim();
}
let existingExtension = path.extname(fileName).toLowerCase(); let existingExtension = path.extname(fileName).toLowerCase();
let newExtension; let newExtension;
if (fileName.length > 30) {
fileName = fileName.substr(0, 30);
}
// the following two are handled specifically since we always want to have these extensions no matter the automatic detection // the following two are handled specifically since we always want to have these extensions no matter the automatic detection
// and/or existing detected extensions in the note name // and/or existing detected extensions in the note name
if (type === 'text' && format === 'markdown') { if (type === 'text' && format === 'markdown') {
@@ -108,7 +107,7 @@ async function exportToZip(taskContext, branch, format, res, setHeaders = true)
} }
} }
// if the note is already named with extension (e.g. "jquery"), then it's silly to append the exact same extension again // if the note is already named with the extension (e.g. "image.jpg"), then it's silly to append the exact same extension again
if (newExtension && existingExtension !== `.${newExtension.toLowerCase()}`) { if (newExtension && existingExtension !== `.${newExtension.toLowerCase()}`) {
fileName += `.${newExtension}`; fileName += `.${newExtension}`;
} }

View File

@@ -148,8 +148,16 @@ function saveImageToAttachment(noteId, uploadBuffer, originalName, shrinkImageSw
title: fileName title: fileName
}); });
const noteService = require("../services/notes"); // TODO: this is a quick-fix solution of a recursive bug - this is called from asyncPostProcessContent()
noteService.asyncPostProcessContent(note, note.getContent()); // to mark an unused attachment for deletion // find some async way to do this - perhaps some global timeout with a Set of noteIds needing one more
// run of asyncPostProcessContent
setTimeout(() => {
sql.transactional(() => {
const note = becca.getNoteOrThrow(noteId);
const noteService = require("../services/notes");
noteService.asyncPostProcessContent(note, note.getContent()); // to mark an unused attachment for deletion
});
}, 5000);
// resizing images asynchronously since JIMP does not support sync operation // resizing images asynchronously since JIMP does not support sync operation
processImage(uploadBuffer, originalName, shrinkImageSwitch).then(({buffer, imageFormat}) => { processImage(uploadBuffer, originalName, shrinkImageSwitch).then(({buffer, imageFormat}) => {

View File

@@ -10,6 +10,8 @@ class AttributeExistsExp extends Expression {
this.attributeType = attributeType; this.attributeType = attributeType;
this.attributeName = attributeName; this.attributeName = attributeName;
// template attr is used as a marker for templates, but it's not meant to be inherited
this.isTemplateLabel = this.attributeType === 'label' && (this.attributeName === 'template' || this.attributeName === 'workspacetemplate');
this.prefixMatch = prefixMatch; this.prefixMatch = prefixMatch;
} }
@@ -23,12 +25,10 @@ class AttributeExistsExp extends Expression {
for (const attr of attrs) { for (const attr of attrs) {
const note = attr.note; const note = attr.note;
if (attr.isInheritable) { if (attr.isInheritable && !this.isTemplateLabel) {
resultNoteSet.addAll(note.getSubtreeNotesIncludingTemplated()); resultNoteSet.addAll(note.getSubtreeNotesIncludingTemplated());
} }
else if (note.isInherited() && else if (note.isInherited() && !this.isTemplateLabel) {
// template attr is used as a marker for templates, but it's not meant to be inherited
!(this.attributeType === 'label' && (this.attributeName === 'template' || this.attributeName === 'workspacetemplate'))) {
resultNoteSet.addAll(note.getInheritingNotes()); resultNoteSet.addAll(note.getInheritingNotes());
} }
else { else {

View File

@@ -308,7 +308,8 @@ function getEntityChangeRow(entityChange) {
const entityRow = sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]); const entityRow = sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]);
if (!entityRow) { if (!entityRow) {
throw new Error(`Cannot find entity for entity change ${JSON.stringify(entityChange)}`); log.error(`Cannot find entity for entity change ${JSON.stringify(entityChange)}`);
return null;
} }
if (entityName === 'blobs' && entityRow.content !== null) { if (entityName === 'blobs' && entityRow.content !== null) {
@@ -335,6 +336,9 @@ function getEntityChangeRecords(entityChanges) {
} }
const entity = getEntityChangeRow(entityChange); const entity = getEntityChangeRow(entityChange);
if (!entity) {
continue;
}
const record = { entityChange, entity }; const record = { entityChange, entity };