mirror of
				https://github.com/TriliumNext/Notes.git
				synced 2025-10-31 04:51:31 +08:00 
			
		
		
		
	Merge branch 'stable'
# Conflicts: # src/routes/api/revisions.js # src/services/bulk_actions.js
This commit is contained in:
		
						commit
						df85a5eee4
					
				
							
								
								
									
										19
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										19
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -1,11 +1,12 @@ | ||||
| { | ||||
|   "name": "trilium", | ||||
|   "version": "0.62.2", | ||||
|   "version": "0.62.3", | ||||
|   "lockfileVersion": 2, | ||||
|   "requires": true, | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "version": "0.62.2", | ||||
|       "name": "trilium", | ||||
|       "version": "0.62.3", | ||||
|       "hasInstallScript": true, | ||||
|       "license": "AGPL-3.0-only", | ||||
|       "dependencies": { | ||||
| @ -88,7 +89,7 @@ | ||||
|       }, | ||||
|       "devDependencies": { | ||||
|         "cross-env": "7.0.3", | ||||
|         "electron": "25.9.5", | ||||
|         "electron": "25.9.8", | ||||
|         "electron-builder": "24.6.4", | ||||
|         "electron-packager": "17.1.2", | ||||
|         "electron-rebuild": "3.2.9", | ||||
| @ -5101,9 +5102,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "node_modules/electron": { | ||||
|       "version": "25.9.5", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-25.9.5.tgz", | ||||
|       "integrity": "sha512-gM7GXUSd3JVRcYbBnNOtZeNnE5MCJjtZTT8QyIxJvpQ0Dh9dz3hTuEL62dOwnMFW/l47ACQ6es/8qi01P4QGZA==", | ||||
|       "version": "25.9.8", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-25.9.8.tgz", | ||||
|       "integrity": "sha512-PGgp6PH46QVENHuAHc2NT1Su8Q1qov7qIl2jI5tsDpTibwV2zD8539AeWBQySeBU4dhbj9onIl7+1bXQ0wefBg==", | ||||
|       "hasInstallScript": true, | ||||
|       "dependencies": { | ||||
|         "@electron/get": "^2.0.0", | ||||
| @ -19123,9 +19124,9 @@ | ||||
|       } | ||||
|     }, | ||||
|     "electron": { | ||||
|       "version": "25.9.5", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-25.9.5.tgz", | ||||
|       "integrity": "sha512-gM7GXUSd3JVRcYbBnNOtZeNnE5MCJjtZTT8QyIxJvpQ0Dh9dz3hTuEL62dOwnMFW/l47ACQ6es/8qi01P4QGZA==", | ||||
|       "version": "25.9.8", | ||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-25.9.8.tgz", | ||||
|       "integrity": "sha512-PGgp6PH46QVENHuAHc2NT1Su8Q1qov7qIl2jI5tsDpTibwV2zD8539AeWBQySeBU4dhbj9onIl7+1bXQ0wefBg==", | ||||
|       "requires": { | ||||
|         "@electron/get": "^2.0.0", | ||||
|         "@types/node": "^18.11.18", | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
|   "name": "trilium", | ||||
|   "productName": "Trilium Notes", | ||||
|   "description": "Trilium Notes", | ||||
|   "version": "0.62.2", | ||||
|   "version": "0.62.4", | ||||
|   "license": "AGPL-3.0-only", | ||||
|   "main": "electron.js", | ||||
|   "bin": { | ||||
| @ -112,7 +112,7 @@ | ||||
|   }, | ||||
|   "devDependencies": { | ||||
|     "cross-env": "7.0.3", | ||||
|     "electron": "25.9.5", | ||||
|     "electron": "25.9.8", | ||||
|     "electron-builder": "24.6.4", | ||||
|     "electron-packager": "17.1.2", | ||||
|     "electron-rebuild": "3.2.9", | ||||
|  | ||||
| @ -8,6 +8,7 @@ const cls = require('../../services/cls.js'); | ||||
| const path = require('path'); | ||||
| const becca = require('../../becca/becca.js'); | ||||
| const blobService = require('../../services/blob.js'); | ||||
| const eraseService = require("../../services/erase.js"); | ||||
| 
 | ||||
| function getRevisionBlob(req) { | ||||
|     const preview = req.query.preview === 'true'; | ||||
| @ -88,11 +89,11 @@ function eraseAllRevisions(req) { | ||||
|     const revisionIdsToErase = sql.getColumn('SELECT revisionId FROM revisions WHERE noteId = ?', | ||||
|         [req.params.noteId]); | ||||
| 
 | ||||
|     revisionService.eraseRevisions(revisionIdsToErase); | ||||
|     eraseService.eraseRevisions(revisionIdsToErase); | ||||
| } | ||||
| 
 | ||||
| function eraseRevision(req) { | ||||
|     revisionService.eraseRevisions([req.params.revisionId]); | ||||
|     eraseService.eraseRevisions([req.params.revisionId]); | ||||
| } | ||||
| 
 | ||||
| function restoreRevision(req) { | ||||
|  | ||||
| @ -1 +1 @@ | ||||
| module.exports = { buildDate:"2023-11-21T20:49:24+01:00", buildRevision: "e2b1421bf3d764ffe444a103c118e67d8c563673" }; | ||||
| module.exports = { buildDate:"2023-12-07T00:03:59+01:00", buildRevision: "2e23c521c356c2305124f5df0f474532fa5f34ce" }; | ||||
|  | ||||
| @ -4,6 +4,7 @@ const becca = require('../becca/becca.js'); | ||||
| const cloningService = require('./cloning.js'); | ||||
| const branchService = require('./branches.js'); | ||||
| const utils = require('./utils.js'); | ||||
| const eraseService = require("./erase.js"); | ||||
| 
 | ||||
| const ACTION_HANDLERS = { | ||||
|     addLabel: (action, note) => { | ||||
| @ -18,7 +19,7 @@ const ACTION_HANDLERS = { | ||||
|         note.deleteNote(deleteId); | ||||
|     }, | ||||
|     deleteRevisions: (action, note) => { | ||||
|         revisionService.eraseRevisions(note.getRevisions().map(rev => rev.revisionId)); | ||||
|         eraseService.eraseRevisions(note.getRevisions().map(rev => rev.revisionId)); | ||||
|     }, | ||||
|     deleteLabel: (action, note) => { | ||||
|         for (const label of note.getOwnedLabels(action.labelName)) { | ||||
|  | ||||
| @ -467,7 +467,7 @@ class ConsistencyChecks { | ||||
|                     WHERE blobs.blobId IS NULL`,
 | ||||
|             ({revisionId, blobId}) => { | ||||
|                 if (this.autoFix) { | ||||
|                     revisionService.eraseRevisions([revisionId]); | ||||
|                     eraseService.eraseRevisions([revisionId]); | ||||
| 
 | ||||
|                     this.reloadNeeded = true; | ||||
| 
 | ||||
|  | ||||
| @ -29,7 +29,7 @@ function eraseNotes(noteIdsToErase) { | ||||
|     const revisionIdsToErase = sql.getManyRows(`SELECT revisionId FROM revisions WHERE noteId IN (???)`, noteIdsToErase) | ||||
|         .map(row => row.revisionId); | ||||
| 
 | ||||
|     revisionService.eraseRevisions(revisionIdsToErase); | ||||
|     eraseRevisions(revisionIdsToErase); | ||||
| 
 | ||||
|     log.info(`Erased notes: ${JSON.stringify(noteIdsToErase)}`); | ||||
| } | ||||
| @ -79,6 +79,18 @@ function eraseAttachments(attachmentIdsToErase) { | ||||
|     log.info(`Erased attachments: ${JSON.stringify(attachmentIdsToErase)}`); | ||||
| } | ||||
| 
 | ||||
| function eraseRevisions(revisionIdsToErase) { | ||||
|     if (revisionIdsToErase.length === 0) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     sql.executeMany(`DELETE FROM revisions WHERE revisionId IN (???)`, revisionIdsToErase); | ||||
| 
 | ||||
|     setEntityChangesAsErased(sql.getManyRows(`SELECT * FROM entity_changes WHERE entityName = 'revisions' AND entityId IN (???)`, revisionIdsToErase)); | ||||
| 
 | ||||
|     log.info(`Removed revisions: ${JSON.stringify(revisionIdsToErase)}`); | ||||
| } | ||||
| 
 | ||||
| function eraseUnusedBlobs() { | ||||
|     const unusedBlobIds = sql.getColumn(` | ||||
|         SELECT blobs.blobId | ||||
| @ -184,5 +196,6 @@ module.exports = { | ||||
|     eraseUnusedAttachmentsNow, | ||||
|     eraseNotesWithDeleteId, | ||||
|     eraseUnusedBlobs, | ||||
|     eraseAttachments | ||||
|     eraseAttachments, | ||||
|     eraseRevisions | ||||
| }; | ||||
|  | ||||
| @ -46,18 +46,6 @@ function protectRevisions(note) { | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| function eraseRevisions(revisionIdsToErase) { | ||||
|     if (revisionIdsToErase.length === 0) { | ||||
|         return; | ||||
|     } | ||||
| 
 | ||||
|     log.info(`Removing revisions: ${JSON.stringify(revisionIdsToErase)}`); | ||||
| 
 | ||||
|     sql.executeMany(`DELETE FROM revisions WHERE revisionId IN (???)`, revisionIdsToErase); | ||||
|     sql.executeMany(`UPDATE entity_changes SET isErased = 1, utcDateChanged = '${dateUtils.utcNowDateTime()}' WHERE entityName = 'revisions' AND entityId IN (???)`, revisionIdsToErase); | ||||
| } | ||||
| 
 | ||||
| module.exports = { | ||||
|     protectRevisions, | ||||
|     eraseRevisions | ||||
|     protectRevisions | ||||
| }; | ||||
|  | ||||
| @ -209,8 +209,9 @@ function sortNotesIfNeeded(parentNoteId) { | ||||
| function setNoteToParent(noteId, prefix, parentNoteId) { | ||||
|     const parentNote = becca.getNote(parentNoteId); | ||||
| 
 | ||||
|     if (!parentNote) { | ||||
|         throw new Error(`Cannot move note to deleted parent note '${parentNoteId}'`); | ||||
|     if (parentNoteId && !parentNote) { | ||||
|         // null parentNoteId is a valid value
 | ||||
|         throw new Error(`Cannot move note to deleted / missing parent note '${parentNoteId}'`); | ||||
|     } | ||||
| 
 | ||||
|     // case where there might be more such branches is ignored. It's expected there should be just one
 | ||||
|  | ||||
| @ -63,6 +63,8 @@ function isElectron() { | ||||
| } | ||||
| 
 | ||||
| function hash(text) { | ||||
|     text = text.normalize(); | ||||
| 
 | ||||
|     return crypto.createHash('sha1').update(text).digest('base64'); | ||||
| } | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 zadam
						zadam