mirror of
https://github.com/zadam/trilium.git
synced 2025-11-02 03:16:11 +01:00
encryption of note history if the note is encrypted
This commit is contained in:
@@ -7,10 +7,28 @@ const auth = require('../../services/auth');
|
||||
|
||||
router.get('/:noteId', auth.checkApiAuth, async (req, res, next) => {
|
||||
const noteId = req.params.noteId;
|
||||
const encryption = req.query.encryption;
|
||||
|
||||
const history = await sql.getResults("select * from notes_history where note_id = ? order by date_modified_to desc", [noteId]);
|
||||
let history;
|
||||
|
||||
if (encryption === undefined) {
|
||||
history = await sql.getResults("select * from notes_history where note_id = ? order by date_modified_to desc", [noteId]);
|
||||
}
|
||||
else {
|
||||
history = await sql.getResults("select * from notes_history where note_id = ? and encryption = ? order by date_modified_to desc", [noteId, encryption]);
|
||||
}
|
||||
|
||||
res.send(history);
|
||||
});
|
||||
|
||||
router.put('/', auth.checkApiAuth, async (req, res, next) => {
|
||||
await sql.doInTransaction(async () => {
|
||||
await sql.replace("notes_history", req.body);
|
||||
|
||||
await sql.addNoteHistorySync(req.body.note_history_id);
|
||||
});
|
||||
|
||||
res.send();
|
||||
});
|
||||
|
||||
module.exports = router;
|
||||
Reference in New Issue
Block a user