mirror of
https://github.com/zadam/trilium.git
synced 2025-03-01 14:22:32 +01:00
Merge branch 'stable'
This commit is contained in:
commit
f8bc03feaf
@ -3,8 +3,12 @@ module.exports = () => {
|
||||
const becca = require("../../src/becca/becca");
|
||||
const cls = require("../../src/services/cls");
|
||||
const log = require("../../src/services/log");
|
||||
const sql = require("../../src/services/sql");
|
||||
|
||||
cls.init(() => {
|
||||
// emergency disabling of image compression since it appears to make problems in migration to 0.61
|
||||
sql.execute(`UPDATE options SET value = 'false' WHERE name = 'compressImages'`);
|
||||
|
||||
beccaLoader.load();
|
||||
|
||||
for (const note of Object.values(becca.notes)) {
|
||||
|
2
db/migrations/0227__disable_image_compression.sql
Normal file
2
db/migrations/0227__disable_image_compression.sql
Normal file
@ -0,0 +1,2 @@
|
||||
-- emergency disabling of image compression since it appears to make problems in migration to 0.61
|
||||
UPDATE options SET value = 'false' WHERE name = 'compressImages';
|
@ -2,7 +2,7 @@
|
||||
"name": "trilium",
|
||||
"productName": "Trilium Notes",
|
||||
"description": "Trilium Notes",
|
||||
"version": "0.61.11",
|
||||
"version": "0.61.13",
|
||||
"license": "AGPL-3.0-only",
|
||||
"main": "electron.js",
|
||||
"bin": {
|
||||
|
@ -172,7 +172,7 @@ if (utils.isElectron()) {
|
||||
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];
|
||||
|
@ -4,7 +4,7 @@ const build = require('./build');
|
||||
const packageJson = require('../../package');
|
||||
const {TRILIUM_DATA_DIR} = require('./data_dir');
|
||||
|
||||
const APP_DB_VERSION = 226;
|
||||
const APP_DB_VERSION = 227;
|
||||
const SYNC_VERSION = 31;
|
||||
const CLIPPER_PROTOCOL_VERSION = "1.0";
|
||||
|
||||
|
@ -1 +1 @@
|
||||
module.exports = { buildDate:"2023-11-03T11:46:53+01:00", buildRevision: "01093d05d7ca1ede0c9af3fe2f5b04969ade816d" };
|
||||
module.exports = { buildDate:"2023-11-06T00:21:41+01:00", buildRevision: "531e9d4aff47b7e8332420645546d25ab28acf85" };
|
||||
|
@ -148,8 +148,16 @@ function saveImageToAttachment(noteId, uploadBuffer, originalName, shrinkImageSw
|
||||
title: fileName
|
||||
});
|
||||
|
||||
const noteService = require("../services/notes");
|
||||
noteService.asyncPostProcessContent(note, note.getContent()); // to mark an unused attachment for deletion
|
||||
// TODO: this is a quick-fix solution of a recursive bug - this is called from asyncPostProcessContent()
|
||||
// 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
|
||||
processImage(uploadBuffer, originalName, shrinkImageSwitch).then(({buffer, imageFormat}) => {
|
||||
|
@ -292,7 +292,9 @@ async function syncRequest(syncContext, method, requestPath, body) {
|
||||
return response;
|
||||
}
|
||||
|
||||
function getEntityChangeRow(entityName, entityId) {
|
||||
function getEntityChangeRow(entityChange) {
|
||||
const {entityName, entityId} = entityChange;
|
||||
|
||||
if (entityName === 'note_reordering') {
|
||||
return sql.getMap("SELECT branchId, notePosition FROM branches WHERE parentNoteId = ? AND isDeleted = 0", [entityId]);
|
||||
}
|
||||
@ -300,13 +302,14 @@ function getEntityChangeRow(entityName, entityId) {
|
||||
const primaryKey = entityConstructor.getEntityFromEntityName(entityName).primaryKeyName;
|
||||
|
||||
if (!primaryKey) {
|
||||
throw new Error(`Unknown entity '${entityName}'`);
|
||||
throw new Error(`Unknown entity for entity change ${JSON.stringify(entityChange)}`);
|
||||
}
|
||||
|
||||
const entityRow = sql.getRow(`SELECT * FROM ${entityName} WHERE ${primaryKey} = ?`, [entityId]);
|
||||
|
||||
if (!entityRow) {
|
||||
throw new Error(`Entity ${entityName} '${entityId}' not found.`);
|
||||
log.error(`Cannot find entity for entity change ${JSON.stringify(entityChange)}`);
|
||||
return null;
|
||||
}
|
||||
|
||||
if (entityName === 'blobs' && entityRow.content !== null) {
|
||||
@ -332,7 +335,10 @@ function getEntityChangeRecords(entityChanges) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const entity = getEntityChangeRow(entityChange.entityName, entityChange.entityId);
|
||||
const entity = getEntityChangeRow(entityChange);
|
||||
if (!entity) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const record = { entityChange, entity };
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user