mirror of
https://github.com/zadam/trilium.git
synced 2025-11-10 15:25:51 +01:00
cleanup obsolete image code
This commit is contained in:
@@ -27,12 +27,6 @@ async function updateEntity(sync, entity, sourceId) {
|
||||
else if (entityName === 'links') {
|
||||
await updateLink(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'images') {
|
||||
await updateImage(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'note_images') {
|
||||
await updateNoteImage(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'attributes') {
|
||||
await updateAttribute(entity, sourceId);
|
||||
}
|
||||
@@ -156,38 +150,6 @@ async function updateLink(entity, sourceId) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateImage(entity, sourceId) {
|
||||
if (entity.data !== null) {
|
||||
entity.data = Buffer.from(entity.data, 'base64');
|
||||
}
|
||||
|
||||
const origImage = await sql.getRow("SELECT * FROM images WHERE imageId = ?", [entity.imageId]);
|
||||
|
||||
if (!origImage || origImage.dateModified <= entity.dateModified) {
|
||||
await sql.transactional(async () => {
|
||||
await sql.replace("images", entity);
|
||||
|
||||
await syncTableService.addImageSync(entity.imageId, sourceId);
|
||||
});
|
||||
|
||||
log.info("Update/sync image " + entity.imageId);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateNoteImage(entity, sourceId) {
|
||||
const origNoteImage = await sql.getRow("SELECT * FROM note_images WHERE noteImageId = ?", [entity.noteImageId]);
|
||||
|
||||
if (!origNoteImage || origNoteImage.dateModified <= entity.dateModified) {
|
||||
await sql.transactional(async () => {
|
||||
await sql.replace("note_images", entity);
|
||||
|
||||
await syncTableService.addNoteImageSync(entity.noteImageId, sourceId);
|
||||
});
|
||||
|
||||
log.info("Update/sync note image " + entity.noteImageId);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateAttribute(entity, sourceId) {
|
||||
const origAttribute = await sql.getRow("SELECT * FROM attributes WHERE attributeId = ?", [entity.attributeId]);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user