mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	Compare commits
	
		
			10 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | e76093e75c | ||
|  | 4f8073daa7 | ||
|  | 47fb96faa8 | ||
|  | 6e33553146 | ||
|  | 807941e6a5 | ||
|  | 1e30c0702e | ||
|  | 390ad6d813 | ||
|  | 77800d073f | ||
|  | 1953c7896f | ||
|  | cd43752f61 | 
| @@ -8,3 +8,6 @@ CREATE TABLE IF NOT EXISTS "blobs" ( | |||||||
|  |  | ||||||
| ALTER TABLE notes ADD blobId TEXT DEFAULT NULL; | ALTER TABLE notes ADD blobId TEXT DEFAULT NULL; | ||||||
| ALTER TABLE note_revisions ADD blobId TEXT DEFAULT NULL; | ALTER TABLE note_revisions ADD blobId TEXT DEFAULT NULL; | ||||||
|  |  | ||||||
|  | CREATE INDEX IF NOT EXISTS IDX_notes_blobId on notes (blobId); | ||||||
|  | CREATE INDEX IF NOT EXISTS IDX_note_revisions_blobId on note_revisions (blobId); | ||||||
|   | |||||||
| @@ -21,5 +21,6 @@ CREATE INDEX `IDX_revisions_utcDateCreated` ON `revisions` (`utcDateCreated`); | |||||||
| CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdited`); | CREATE INDEX `IDX_revisions_utcDateLastEdited` ON `revisions` (`utcDateLastEdited`); | ||||||
| CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`); | CREATE INDEX `IDX_revisions_dateCreated` ON `revisions` (`dateCreated`); | ||||||
| CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`); | CREATE INDEX `IDX_revisions_dateLastEdited` ON `revisions` (`dateLastEdited`); | ||||||
|  | CREATE INDEX IF NOT EXISTS IDX_revisions_blobId on revisions (blobId); | ||||||
|  |  | ||||||
| UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions'; | UPDATE entity_changes SET entityName = 'revisions' WHERE entityName = 'note_revisions'; | ||||||
|   | |||||||
| @@ -19,3 +19,5 @@ CREATE INDEX IDX_attachments_ownerId_role | |||||||
|  |  | ||||||
| CREATE INDEX IDX_attachments_utcDateScheduledForErasureSince | CREATE INDEX IDX_attachments_utcDateScheduledForErasureSince | ||||||
|     on attachments (utcDateScheduledForErasureSince); |     on attachments (utcDateScheduledForErasureSince); | ||||||
|  |  | ||||||
|  | CREATE INDEX IF NOT EXISTS IDX_attachments_blobId on attachments (blobId); | ||||||
|   | |||||||
							
								
								
									
										4
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								libraries/ckeditor/ckeditor.js
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
										
											
												File diff suppressed because one or more lines are too long
											
										
									
								
							
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,12 +1,12 @@ | |||||||
| { | { | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "version": "0.62.4", |   "version": "0.62.5", | ||||||
|   "lockfileVersion": 2, |   "lockfileVersion": 2, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "": { |     "": { | ||||||
|       "name": "trilium", |       "name": "trilium", | ||||||
|       "version": "0.62.4", |       "version": "0.62.5", | ||||||
|       "hasInstallScript": true, |       "hasInstallScript": true, | ||||||
|       "license": "AGPL-3.0-only", |       "license": "AGPL-3.0-only", | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "productName": "Trilium Notes", |   "productName": "Trilium Notes", | ||||||
|   "description": "Trilium Notes", |   "description": "Trilium Notes", | ||||||
|   "version": "0.62.5", |   "version": "0.62.6", | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|   "main": "electron.js", |   "main": "electron.js", | ||||||
|   "bin": { |   "bin": { | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| module.exports = { buildDate:"2024-01-08T00:05:13+01:00", buildRevision: "ee608fcf46a2052f21d94a8a72fc023dcaf955f7" }; | module.exports = { buildDate:"2024-01-21T23:49:23+01:00", buildRevision: "4f8073daa7cff1b8b6737ae45792b2e87c2adf33" }; | ||||||
|   | |||||||
| @@ -48,6 +48,14 @@ function isEntityEventsDisabled() { | |||||||
|     return !!namespace.get('disableEntityEvents'); |     return !!namespace.get('disableEntityEvents'); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function setMigrationRunning(running) { | ||||||
|  |     namespace.set('migrationRunning', !!running); | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function isMigrationRunning() { | ||||||
|  |     return !!namespace.get('migrationRunning'); | ||||||
|  | } | ||||||
|  |  | ||||||
| function disableSlowQueryLogging(disable) { | function disableSlowQueryLogging(disable) { | ||||||
|     namespace.set('disableSlowQueryLogging', disable); |     namespace.set('disableSlowQueryLogging', disable); | ||||||
| } | } | ||||||
| @@ -102,5 +110,7 @@ module.exports = { | |||||||
|     putEntityChange, |     putEntityChange, | ||||||
|     ignoreEntityChangeIds, |     ignoreEntityChangeIds, | ||||||
|     disableSlowQueryLogging, |     disableSlowQueryLogging, | ||||||
|     isSlowQueryLoggingDisabled |     isSlowQueryLoggingDisabled, | ||||||
|  |     setMigrationRunning, | ||||||
|  |     isMigrationRunning | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -302,7 +302,7 @@ const DEFAULT_KEYBOARD_ACTIONS = [ | |||||||
|     }, |     }, | ||||||
|     { |     { | ||||||
|         actionName: "lastTab", |         actionName: "lastTab", | ||||||
|         defaultShortcuts: ["CommandOrControl+0"], |         defaultShortcuts: [], | ||||||
|         description: "Activates the last tab in the list", |         description: "Activates the last tab in the list", | ||||||
|         scope: "window" |         scope: "window" | ||||||
|     }, |     }, | ||||||
|   | |||||||
| @@ -5,12 +5,13 @@ const log = require('./log'); | |||||||
| const utils = require('./utils'); | const utils = require('./utils'); | ||||||
| const resourceDir = require('./resource_dir'); | const resourceDir = require('./resource_dir'); | ||||||
| const appInfo = require('./app_info'); | const appInfo = require('./app_info'); | ||||||
|  | const cls = require('./cls.js'); | ||||||
|  |  | ||||||
| async function migrate() { | async function migrate() { | ||||||
|     const currentDbVersion = getDbVersion(); |     const currentDbVersion = getDbVersion(); | ||||||
|  |  | ||||||
|     if (currentDbVersion < 214) { |     if (currentDbVersion < 214) { | ||||||
|         log.error("Direct migration from your current version is not supported. Please upgrade to the latest v0.60.X first and only then to this version."); |         log.error("Direct migration from your current version is not supported. Please upgrade to the latest v0.60.4 first and only then to this version."); | ||||||
|  |  | ||||||
|         utils.crash(); |         utils.crash(); | ||||||
|         return; |         return; | ||||||
| @@ -18,7 +19,7 @@ async function migrate() { | |||||||
|  |  | ||||||
|     // backup before attempting migration |     // backup before attempting migration | ||||||
|     await backupService.backupNow( |     await backupService.backupNow( | ||||||
|         // creating a special backup for versions 0.60.X, the changes in 0.61 are major. |         // creating a special backup for version 0.60.4, the changes in 0.61 are major. | ||||||
|         currentDbVersion === 214 |         currentDbVersion === 214 | ||||||
|             ? `before-migration-v060` |             ? `before-migration-v060` | ||||||
|             : 'before-migration' |             : 'before-migration' | ||||||
| @@ -51,6 +52,9 @@ async function migrate() { | |||||||
|     // all migrations are executed in one transaction - upgrade either succeeds, or the user can stay at the old version |     // all migrations are executed in one transaction - upgrade either succeeds, or the user can stay at the old version | ||||||
|     // otherwise if half of the migrations succeed, user can't use any version - DB is too "new" for the old app, |     // otherwise if half of the migrations succeed, user can't use any version - DB is too "new" for the old app, | ||||||
|     // and too old for the new app version. |     // and too old for the new app version. | ||||||
|  |  | ||||||
|  |     cls.setMigrationRunning(true); | ||||||
|  |  | ||||||
|     sql.transactional(() => { |     sql.transactional(() => { | ||||||
|         for (const mig of migrations) { |         for (const mig of migrations) { | ||||||
|             try { |             try { | ||||||
|   | |||||||
| @@ -471,6 +471,8 @@ function findRelationMapLinks(content, foundLinks) { | |||||||
| const imageUrlToAttachmentIdMapping = {}; | const imageUrlToAttachmentIdMapping = {}; | ||||||
|  |  | ||||||
| async function downloadImage(noteId, imageUrl) { | async function downloadImage(noteId, imageUrl) { | ||||||
|  |     const unescapedUrl = utils.unescapeHtml(imageUrl); | ||||||
|  |  | ||||||
|     try { |     try { | ||||||
|         let imageBuffer; |         let imageBuffer; | ||||||
|  |  | ||||||
| @@ -487,10 +489,10 @@ async function downloadImage(noteId, imageUrl) { | |||||||
|                 }); |                 }); | ||||||
|             }); |             }); | ||||||
|         } else { |         } else { | ||||||
|             imageBuffer = await request.getImage(imageUrl); |             imageBuffer = await request.getImage(unescapedUrl); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         const parsedUrl = url.parse(imageUrl); |         const parsedUrl = url.parse(unescapedUrl); | ||||||
|         const title = path.basename(parsedUrl.pathname); |         const title = path.basename(parsedUrl.pathname); | ||||||
|  |  | ||||||
|         const imageService = require('../services/image'); |         const imageService = require('../services/image'); | ||||||
| @@ -519,7 +521,7 @@ function downloadImages(noteId, content) { | |||||||
|     let imageMatch; |     let imageMatch; | ||||||
|  |  | ||||||
|     while (imageMatch = imageRe.exec(content)) { |     while (imageMatch = imageRe.exec(content)) { | ||||||
|         let url = imageMatch[1]; |         const url = imageMatch[1]; | ||||||
|         const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url); |         const inlineImageMatch = /^data:image\/[a-z]+;base64,/.exec(url); | ||||||
|  |  | ||||||
|         if (inlineImageMatch) { |         if (inlineImageMatch) { | ||||||
| @@ -541,8 +543,6 @@ function downloadImages(noteId, content) { | |||||||
|                 continue; |                 continue; | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             url = utils.unescapeHtml(url); |  | ||||||
|  |  | ||||||
|             if (url in imageUrlToAttachmentIdMapping) { |             if (url in imageUrlToAttachmentIdMapping) { | ||||||
|                 const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]); |                 const attachment = becca.getAttachment(imageUrlToAttachmentIdMapping[url]); | ||||||
|  |  | ||||||
| @@ -895,6 +895,11 @@ function scanForLinks(note, content) { | |||||||
|  * Things which have to be executed after updating content, but asynchronously (separate transaction) |  * Things which have to be executed after updating content, but asynchronously (separate transaction) | ||||||
|  */ |  */ | ||||||
| async function asyncPostProcessContent(note, content) { | async function asyncPostProcessContent(note, content) { | ||||||
|  |     if (cls.isMigrationRunning()) { | ||||||
|  |         // this is rarely needed for migrations, but can cause trouble by e.g. triggering downloads | ||||||
|  |         return; | ||||||
|  |     } | ||||||
|  |  | ||||||
|     if (note.hasStringContent() && !utils.isString(content)) { |     if (note.hasStringContent() && !utils.isString(content)) { | ||||||
|         content = content.toString(); |         content = content.toString(); | ||||||
|     } |     } | ||||||
|   | |||||||
| @@ -137,7 +137,7 @@ function renderCode(result) { | |||||||
|  |  | ||||||
| function renderMermaid(result, note) { | function renderMermaid(result, note) { | ||||||
|     result.content = ` |     result.content = ` | ||||||
| <img src="api/images/${note.noteId}/${note.escapedTitle}?${note.utcDateModified}"> | <img src="api/images/${note.noteId}/${note.encodedTitle}?${note.utcDateModified}"> | ||||||
| <hr> | <hr> | ||||||
| <details> | <details> | ||||||
|     <summary>Chart source</summary> |     <summary>Chart source</summary> | ||||||
| @@ -146,7 +146,7 @@ function renderMermaid(result, note) { | |||||||
| } | } | ||||||
|  |  | ||||||
| function renderImage(result, note) { | function renderImage(result, note) { | ||||||
|     result.content = `<img src="api/images/${note.noteId}/${note.escapedTitle}?${note.utcDateModified}">`; |     result.content = `<img src="api/images/${note.noteId}/${note.encodedTitle}?${note.utcDateModified}">`; | ||||||
| } | } | ||||||
|  |  | ||||||
| function renderFile(note, result) { | function renderFile(note, result) { | ||||||
|   | |||||||
| @@ -490,6 +490,10 @@ class SNote extends AbstractShacaEntity { | |||||||
|         return escape(this.title); |         return escape(this.title); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     get encodedTitle() { | ||||||
|  |         return encodeURIComponent(this.title); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     getPojo() { |     getPojo() { | ||||||
|         return { |         return { | ||||||
|             noteId: this.noteId, |             noteId: this.noteId, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user