mirror of
https://github.com/zadam/trilium.git
synced 2025-11-01 02:45:54 +01:00
image sync
This commit is contained in:
@@ -122,6 +122,17 @@ router.get('/recent_notes/:noteTreeId', auth.checkApiAuth, async (req, res, next
|
||||
res.send(await sql.getFirst("SELECT * FROM recent_notes WHERE note_tree_id = ?", [noteTreeId]));
|
||||
});
|
||||
|
||||
router.get('/images/:imageId', auth.checkApiAuth, async (req, res, next) => {
|
||||
const imageId = req.params.imageId;
|
||||
const entity = await sql.getFirst("SELECT * FROM images WHERE image_id = ?", [imageId]);
|
||||
|
||||
if (entity && entity.data !== null) {
|
||||
entity.data = entity.data.toString('base64');
|
||||
}
|
||||
|
||||
res.send(entity);
|
||||
});
|
||||
|
||||
router.put('/notes', auth.checkApiAuth, async (req, res, next) => {
|
||||
await syncUpdate.updateNote(req.body.entity, req.body.sourceId);
|
||||
|
||||
@@ -158,4 +169,10 @@ router.put('/recent_notes', auth.checkApiAuth, async (req, res, next) => {
|
||||
res.send({});
|
||||
});
|
||||
|
||||
router.put('/images', auth.checkApiAuth, async (req, res, next) => {
|
||||
await syncUpdate.updateImage(req.body.entity, req.body.sourceId);
|
||||
|
||||
res.send({});
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user