mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 10:55:55 +01:00
store images in notes, basic structure
This commit is contained in:
@@ -24,6 +24,9 @@ async function updateEntity(sync, entity, sourceId) {
|
||||
else if (entityName === 'recent_notes') {
|
||||
await updateRecentNotes(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'links') {
|
||||
await updateLink(entity, sourceId);
|
||||
}
|
||||
else if (entityName === 'images') {
|
||||
await updateImage(entity, sourceId);
|
||||
}
|
||||
@@ -139,6 +142,20 @@ async function updateRecentNotes(entity, sourceId) {
|
||||
}
|
||||
}
|
||||
|
||||
async function updateLink(entity, sourceId) {
|
||||
const origLink = await sql.getRow("SELECT * FROM links WHERE linkId = ?", [entity.linkId]);
|
||||
|
||||
if (!origLink || origLink.dateModified <= entity.dateModified) {
|
||||
await sql.transactional(async () => {
|
||||
await sql.replace("links", entity);
|
||||
|
||||
await syncTableService.addLinkSync(entity.linkId, sourceId);
|
||||
});
|
||||
|
||||
log.info("Update/sync link " + entity.linkId);
|
||||
}
|
||||
}
|
||||
|
||||
async function updateImage(entity, sourceId) {
|
||||
if (entity.data !== null) {
|
||||
entity.data = Buffer.from(entity.data, 'base64');
|
||||
|
||||
Reference in New Issue
Block a user