mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-30 18:05:55 +01:00 
			
		
		
		
	Compare commits
	
		
			11 Commits
		
	
	
		
			v0.48.6-do
			...
			v0.48.7
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 8c11d022fb | ||
|  | 24210ef80c | ||
|  | 2135aa058e | ||
|  | 67542f448d | ||
|  | 08e9b59696 | ||
|  | fe605c012a | ||
|  | 4c7c53d8c8 | ||
|  | d345b7ed56 | ||
|  | 298af217e9 | ||
|  | 7d64f6a7dd | ||
|  | bc8b6284a6 | 
							
								
								
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										14
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @@ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "version": "0.48.4", |   "version": "0.48.6", | ||||||
|   "lockfileVersion": 1, |   "lockfileVersion": 1, | ||||||
|   "requires": true, |   "requires": true, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
| @@ -2850,9 +2850,9 @@ | |||||||
|       } |       } | ||||||
|     }, |     }, | ||||||
|     "electron": { |     "electron": { | ||||||
|       "version": "13.6.1", |       "version": "13.6.2", | ||||||
|       "resolved": "https://registry.npmjs.org/electron/-/electron-13.6.1.tgz", |       "resolved": "https://registry.npmjs.org/electron/-/electron-13.6.2.tgz", | ||||||
|       "integrity": "sha512-rZ6Y7RberigruefQpWOiI4bA9ppyT88GQF8htY6N1MrAgal5RrBc+Mh92CcGU7zT9QO+XO3DarSgZafNTepffQ==", |       "integrity": "sha512-ZXx9t68yXftvNZVnQ7v2XHcnH+MPUF6LNStoz4MMXuWpkF9gq3qwjcYSqnbM4wiVkvWVHIyYvt1yemmStza9dQ==", | ||||||
|       "dev": true, |       "dev": true, | ||||||
|       "requires": { |       "requires": { | ||||||
|         "@electron/get": "^1.0.1", |         "@electron/get": "^1.0.1", | ||||||
| @@ -2861,9 +2861,9 @@ | |||||||
|       }, |       }, | ||||||
|       "dependencies": { |       "dependencies": { | ||||||
|         "@types/node": { |         "@types/node": { | ||||||
|           "version": "14.17.32", |           "version": "14.17.33", | ||||||
|           "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.32.tgz", |           "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.33.tgz", | ||||||
|           "integrity": "sha512-JcII3D5/OapPGx+eJ+Ik1SQGyt6WvuqdRfh9jUwL6/iHGjmyOriBDciBUu7lEIBTL2ijxwrR70WUnw5AEDmFvQ==", |           "integrity": "sha512-noEeJ06zbn3lOh4gqe2v7NMGS33jrulfNqYFDjjEbhpDEHR5VTxgYNQSBqBlJIsBJW3uEYDgD6kvMnrrhGzq8g==", | ||||||
|           "dev": true |           "dev": true | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "productName": "Trilium Notes", |   "productName": "Trilium Notes", | ||||||
|   "description": "Trilium Notes", |   "description": "Trilium Notes", | ||||||
|   "version": "0.48.6", |   "version": "0.48.7", | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|   "main": "electron.js", |   "main": "electron.js", | ||||||
|   "bin": { |   "bin": { | ||||||
| @@ -81,7 +81,7 @@ | |||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|     "cross-env": "7.0.3", |     "cross-env": "7.0.3", | ||||||
|     "electron": "13.6.1", |     "electron": "13.6.2", | ||||||
|     "electron-builder": "22.13.1", |     "electron-builder": "22.13.1", | ||||||
|     "electron-packager": "15.4.0", |     "electron-packager": "15.4.0", | ||||||
|     "electron-rebuild": "3.2.3", |     "electron-rebuild": "3.2.3", | ||||||
|   | |||||||
| @@ -58,6 +58,9 @@ class Branch extends AbstractEntity { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     init() { |     init() { | ||||||
|  |         this.becca.branches[this.branchId] = this; | ||||||
|  |         this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; | ||||||
|  |  | ||||||
|         if (this.branchId === 'root') { |         if (this.branchId === 'root') { | ||||||
|             return; |             return; | ||||||
|         } |         } | ||||||
| @@ -76,9 +79,6 @@ class Branch extends AbstractEntity { | |||||||
|         if (!parentNote.children.includes(childNote)) { |         if (!parentNote.children.includes(childNote)) { | ||||||
|             parentNote.children.push(childNote); |             parentNote.children.push(childNote); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         this.becca.branches[this.branchId] = this; |  | ||||||
|         this.becca.childParentToBranch[`${this.noteId}-${this.parentNoteId}`] = this; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** @returns {Note} */ |     /** @returns {Note} */ | ||||||
|   | |||||||
| @@ -88,7 +88,7 @@ export default class MobileLayout { | |||||||
|         return new FlexContainer('row').cssBlock(MOBILE_CSS) |         return new FlexContainer('row').cssBlock(MOBILE_CSS) | ||||||
|             .setParent(appContext) |             .setParent(appContext) | ||||||
|             .id('root-widget') |             .id('root-widget') | ||||||
|             .css('height', '100vh') |             .css('height', '100%') | ||||||
|             .child(new ScreenContainer("tree", 'column') |             .child(new ScreenContainer("tree", 'column') | ||||||
|                 .class("d-sm-flex d-md-flex d-lg-flex d-xl-flex col-12 col-sm-5 col-md-4 col-lg-4 col-xl-4") |                 .class("d-sm-flex d-md-flex d-lg-flex d-xl-flex col-12 col-sm-5 col-md-4 col-lg-4 col-xl-4") | ||||||
|                 .css("max-height", "100%") |                 .css("max-height", "100%") | ||||||
|   | |||||||
| @@ -181,9 +181,9 @@ async function consumeFrontendUpdateData() { | |||||||
|  |  | ||||||
|         for (const entityChange of nonProcessedEntityChanges) { |         for (const entityChange of nonProcessedEntityChanges) { | ||||||
|             processedEntityChangeIds.add(entityChange.id); |             processedEntityChangeIds.add(entityChange.id); | ||||||
|         } |  | ||||||
|  |  | ||||||
|         lastProcessedEntityChangeId = Math.max(lastProcessedEntityChangeId, allEntityChanges[allEntityChanges.length - 1].id); |             lastProcessedEntityChangeId = Math.max(lastProcessedEntityChangeId, entityChange.id); | ||||||
|  |         } | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     checkEntityChangeIdListeners(); |     checkEntityChangeIdListeners(); | ||||||
|   | |||||||
| @@ -5,6 +5,18 @@ import froca from "../../services/froca.js"; | |||||||
| export default class OpenNoteButtonWidget extends ButtonWidget { | export default class OpenNoteButtonWidget extends ButtonWidget { | ||||||
|     targetNote(noteId) { |     targetNote(noteId) { | ||||||
|         froca.getNote(noteId).then(note => { |         froca.getNote(noteId).then(note => { | ||||||
|  |             if (!note) { | ||||||
|  |                 console.log(`Note ${noteId} has not been found. This might happen on the first run before the target note is created.`); | ||||||
|  |  | ||||||
|  |                 if (!this.retried) { | ||||||
|  |                     this.retried = true; | ||||||
|  |  | ||||||
|  |                     setTimeout(() => this.targetNote(noteId), 15000); // should be higher than timeout for createMissingSpecialNotes | ||||||
|  |                 } | ||||||
|  |  | ||||||
|  |                 return; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             this.icon(note.getIcon()); |             this.icon(note.getIcon()); | ||||||
|             this.title(note.title); |             this.title(note.title); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -7,7 +7,7 @@ export default class RootContainer extends FlexContainer { | |||||||
|         super('row'); |         super('row'); | ||||||
|  |  | ||||||
|         this.id('root-widget'); |         this.id('root-widget'); | ||||||
|         this.css('height', '100vh'); |         this.css('height', '100%'); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     refresh() { |     refresh() { | ||||||
|   | |||||||
| @@ -150,6 +150,7 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|     doRender() { |     doRender() { | ||||||
|         this.$widget = $(TPL); |         this.$widget = $(TPL); | ||||||
|         this.$tree = this.$widget.find('.tree'); |         this.$tree = this.$widget.find('.tree'); | ||||||
|  |         this.$treeActions = this.$widget.find(".tree-actions"); | ||||||
|  |  | ||||||
|         this.$tree.on("mousedown", ".unhoist-button", () => hoistedNoteService.unhoist()); |         this.$tree.on("mousedown", ".unhoist-button", () => hoistedNoteService.unhoist()); | ||||||
|         this.$tree.on("mousedown", ".refresh-search-button", e => this.refreshSearch(e)); |         this.$tree.on("mousedown", ".refresh-search-button", e => this.refreshSearch(e)); | ||||||
| @@ -200,20 +201,16 @@ export default class NoteTreeWidget extends NoteContextAwareWidget { | |||||||
|             this.$hideIncludedImages.prop("checked", this.hideIncludedImages); |             this.$hideIncludedImages.prop("checked", this.hideIncludedImages); | ||||||
|             this.$autoCollapseNoteTree.prop("checked", this.autoCollapseNoteTree); |             this.$autoCollapseNoteTree.prop("checked", this.autoCollapseNoteTree); | ||||||
|  |  | ||||||
|             let top = this.$treeSettingsButton[0].offsetTop; |             const top = this.$treeActions[0].offsetTop - (this.$treeSettingsPopup.outerHeight()); | ||||||
|             let left = this.$treeSettingsButton[0].offsetLeft; |             const left = Math.max( | ||||||
|             top -= this.$treeSettingsPopup.outerHeight() + 10; |                 0, | ||||||
|             left += this.$treeSettingsButton.outerWidth() - this.$treeSettingsPopup.outerWidth(); |                 this.$treeActions[0].offsetLeft - this.$treeSettingsPopup.outerWidth() + this.$treeActions.outerWidth() | ||||||
|  |             ); | ||||||
|             if (left < 0) { |  | ||||||
|                 left = 0; |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             this.$treeSettingsPopup.css({ |             this.$treeSettingsPopup.css({ | ||||||
|                 display: "block", |                 top, | ||||||
|                 top: top, |                 left | ||||||
|                 left: left |             }).show(); | ||||||
|             }).addClass("show"); |  | ||||||
|  |  | ||||||
|             return false; |             return false; | ||||||
|         }); |         }); | ||||||
|   | |||||||
| @@ -18,9 +18,11 @@ body { | |||||||
|        on the last line of the editor. */ |        on the last line of the editor. */ | ||||||
|     position: fixed; |     position: fixed; | ||||||
|     width: 100%; |     width: 100%; | ||||||
|  |     height: 100%; | ||||||
|     background-color: var(--main-background-color); |     background-color: var(--main-background-color); | ||||||
|     color: var(--main-text-color); |     color: var(--main-text-color); | ||||||
|     font-family: var(--main-font-family); |     font-family: var(--main-font-family); | ||||||
|  |     font-size: var(--main-font-size); | ||||||
| } | } | ||||||
|  |  | ||||||
| a, a:visited, a:hover { | a, a:visited, a:hover { | ||||||
| @@ -58,7 +60,7 @@ table td, table th { | |||||||
| } | } | ||||||
|  |  | ||||||
| code, kbd, pre, samp { | code, kbd, pre, samp { | ||||||
|     font-family: var(--monospace-font-family); |     font-family: var(--monospace-font-family) !important; | ||||||
| } | } | ||||||
|  |  | ||||||
| .input-group-text { | .input-group-text { | ||||||
| @@ -714,10 +716,6 @@ a.external:not(.no-arrow):after, a[href^="http://"]:not(.no-arrow):after, a[href | |||||||
|     border-color: var(--main-border-color) !important; |     border-color: var(--main-border-color) !important; | ||||||
| } | } | ||||||
|  |  | ||||||
| body { |  | ||||||
|     font-size: var(--main-font-size); |  | ||||||
| } |  | ||||||
|  |  | ||||||
| .gutter { | .gutter { | ||||||
|     background: linear-gradient(to bottom, transparent, var(--accented-background-color), transparent); |     background: linear-gradient(to bottom, transparent, var(--accented-background-color), transparent); | ||||||
| } | } | ||||||
|   | |||||||
| @@ -204,6 +204,11 @@ function queueSector(req) { | |||||||
|     entityChangesService.addEntityChangesForSector(entityName, sector); |     entityChangesService.addEntityChangesForSector(entityName, sector); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function checkEntityChanges() { | ||||||
|  |     const consistencyChecks = require("../../services/consistency_checks"); | ||||||
|  |     consistencyChecks.runEntityChangesChecks(); | ||||||
|  | } | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|     testSync, |     testSync, | ||||||
|     checkSync, |     checkSync, | ||||||
| @@ -215,5 +220,6 @@ module.exports = { | |||||||
|     update, |     update, | ||||||
|     getStats, |     getStats, | ||||||
|     syncFinished, |     syncFinished, | ||||||
|     queueSector |     queueSector, | ||||||
|  |     checkEntityChanges | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -294,6 +294,7 @@ function register(app) { | |||||||
|     route(GET, '/api/sync/changed', [auth.checkApiAuth], syncApiRoute.getChanged, apiResultHandler); |     route(GET, '/api/sync/changed', [auth.checkApiAuth], syncApiRoute.getChanged, apiResultHandler); | ||||||
|     route(PUT, '/api/sync/update', [auth.checkApiAuth], syncApiRoute.update, apiResultHandler); |     route(PUT, '/api/sync/update', [auth.checkApiAuth], syncApiRoute.update, apiResultHandler); | ||||||
|     route(POST, '/api/sync/finished', [auth.checkApiAuth], syncApiRoute.syncFinished, apiResultHandler); |     route(POST, '/api/sync/finished', [auth.checkApiAuth], syncApiRoute.syncFinished, apiResultHandler); | ||||||
|  |     route(POST, '/api/sync/check-entity-changes', [auth.checkApiAuth], syncApiRoute.checkEntityChanges, apiResultHandler); | ||||||
|     route(POST, '/api/sync/queue-sector/:entityName/:sector', [auth.checkApiAuth], syncApiRoute.queueSector, apiResultHandler); |     route(POST, '/api/sync/queue-sector/:entityName/:sector', [auth.checkApiAuth], syncApiRoute.queueSector, apiResultHandler); | ||||||
|     route(GET, '/api/sync/stats', [], syncApiRoute.getStats, apiResultHandler); |     route(GET, '/api/sync/stats', [], syncApiRoute.getStats, apiResultHandler); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -5,7 +5,7 @@ const packageJson = require('../../package'); | |||||||
| const {TRILIUM_DATA_DIR} = require('./data_dir'); | const {TRILIUM_DATA_DIR} = require('./data_dir'); | ||||||
|  |  | ||||||
| const APP_DB_VERSION = 185; | const APP_DB_VERSION = 185; | ||||||
| const SYNC_VERSION = 21; | const SYNC_VERSION = 22; | ||||||
| const CLIPPER_PROTOCOL_VERSION = "1.0"; | const CLIPPER_PROTOCOL_VERSION = "1.0"; | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|   | |||||||
| @@ -1 +1 @@ | |||||||
| module.exports = { buildDate:"2021-11-13T22:49:58+01:00", buildRevision: "c94603010630cfafe64575ab378c482bb39fb083" }; | module.exports = { buildDate:"2021-11-23T21:53:32+01:00", buildRevision: "24210ef80c8585b64a00cd5316ae1c1563e0c9f7" }; | ||||||
|   | |||||||
| @@ -701,6 +701,11 @@ function runOnDemandChecks(autoFix) { | |||||||
|     consistencyChecks.runChecks(); |     consistencyChecks.runChecks(); | ||||||
| } | } | ||||||
|  |  | ||||||
|  | function runEntityChangesChecks() { | ||||||
|  |     const consistencyChecks = new ConsistencyChecks(true); | ||||||
|  |     consistencyChecks.findEntityChangeIssues(); | ||||||
|  | } | ||||||
|  |  | ||||||
| sqlInit.dbReady.then(() => { | sqlInit.dbReady.then(() => { | ||||||
|     setInterval(cls.wrap(runPeriodicChecks), 60 * 60 * 1000); |     setInterval(cls.wrap(runPeriodicChecks), 60 * 60 * 1000); | ||||||
|  |  | ||||||
| @@ -709,5 +714,6 @@ sqlInit.dbReady.then(() => { | |||||||
| }); | }); | ||||||
|  |  | ||||||
| module.exports = { | module.exports = { | ||||||
|     runOnDemandChecks |     runOnDemandChecks, | ||||||
|  |     runEntityChangesChecks | ||||||
| }; | }; | ||||||
|   | |||||||
| @@ -7,12 +7,10 @@ const becca = require("../becca/becca"); | |||||||
|  |  | ||||||
| let maxEntityChangeId = 0; | let maxEntityChangeId = 0; | ||||||
|  |  | ||||||
| function addEntityChange(origEntityChange, keepOriginalId = false) { | function addEntityChange(origEntityChange) { | ||||||
|     const ec = {...origEntityChange}; |     const ec = {...origEntityChange}; | ||||||
|  |  | ||||||
|     if (!keepOriginalId) { |  | ||||||
|     delete ec.id; |     delete ec.id; | ||||||
|     } |  | ||||||
|  |  | ||||||
|     ec.sourceId = ec.sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId(); |     ec.sourceId = ec.sourceId || cls.getSourceId() || sourceIdService.getCurrentSourceId(); | ||||||
|     ec.isSynced = ec.isSynced ? 1 : 0; |     ec.isSynced = ec.isSynced ? 1 : 0; | ||||||
|   | |||||||
| @@ -83,8 +83,12 @@ function findResultsWithExpression(expression, searchContext) { | |||||||
|                 throw new Error(`Can't find note path for note ${JSON.stringify(note.getPojo())}`); |                 throw new Error(`Can't find note path for note ${JSON.stringify(note.getPojo())}`); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|  |             if (notePathArray.includes("hidden")) { | ||||||
|  |                 return null; | ||||||
|  |             } | ||||||
|  |  | ||||||
|             return new SearchResult(notePathArray); |             return new SearchResult(notePathArray); | ||||||
|         }); |         }).filter(Boolean); | ||||||
|  |  | ||||||
|     for (const res of searchResults) { |     for (const res of searchResults) { | ||||||
|         res.computeScore(searchContext.highlightedTokens); |         res.computeScore(searchContext.highlightedTokens); | ||||||
|   | |||||||
| @@ -149,7 +149,10 @@ async function pullChanges(syncContext) { | |||||||
|  |  | ||||||
|         sql.transactional(() => { |         sql.transactional(() => { | ||||||
|             for (const {entityChange, entity} of entityChanges) { |             for (const {entityChange, entity} of entityChanges) { | ||||||
|                 if (!sourceIdService.isLocalSourceId(entityChange.sourceId)) { |                 // FIXME: temporary fix | ||||||
|  |                 const existsAlready = !!sql.getValue("SELECT id FROM entity_changes WHERE entityName = ? AND entityId = ? AND utcDateChanged = ? AND hash = ?", [entityChange.entityName, entityChange.entityId, entityChange.utcDateChanged, entityChange.hash]); | ||||||
|  |  | ||||||
|  |                 if (!existsAlready && !sourceIdService.isLocalSourceId(entityChange.sourceId)) { | ||||||
|                     if (!atLeastOnePullApplied) { // send only for first |                     if (!atLeastOnePullApplied) { // send only for first | ||||||
|                         ws.syncPullInProgress(); |                         ws.syncPullInProgress(); | ||||||
|  |  | ||||||
| @@ -249,6 +252,14 @@ async function checkContentHash(syncContext) { | |||||||
|  |  | ||||||
|     const failedChecks = contentHashService.checkContentHashes(resp.entityHashes); |     const failedChecks = contentHashService.checkContentHashes(resp.entityHashes); | ||||||
|  |  | ||||||
|  |     if (failedChecks.length > 0) { | ||||||
|  |         // before requeuing sectors make sure the entity changes are correct | ||||||
|  |         const consistencyChecks = require("./consistency_checks"); | ||||||
|  |         consistencyChecks.runEntityChangesChecks(); | ||||||
|  |  | ||||||
|  |         await syncRequest(syncContext, 'POST', `/api/sync/check-entity-changes`); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     for (const {entityName, sector} of failedChecks) { |     for (const {entityName, sector} of failedChecks) { | ||||||
|         entityChangesService.addEntityChangesForSector(entityName, sector); |         entityChangesService.addEntityChangesForSector(entityName, sector); | ||||||
|  |  | ||||||
|   | |||||||
| @@ -54,7 +54,7 @@ function updateNormalEntity(remoteEntityChange, entity) { | |||||||
|  |  | ||||||
|             sql.execute(`DELETE FROM ${remoteEntityChange.entityName} WHERE ${primaryKey} = ?`, remoteEntityChange.entityId); |             sql.execute(`DELETE FROM ${remoteEntityChange.entityName} WHERE ${primaryKey} = ?`, remoteEntityChange.entityId); | ||||||
|  |  | ||||||
|             entityChangesService.addEntityChange(remoteEntityChange, true); |             entityChangesService.addEntityChange(remoteEntityChange); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         return true; |         return true; | ||||||
| @@ -71,7 +71,7 @@ function updateNormalEntity(remoteEntityChange, entity) { | |||||||
|         sql.transactional(() => { |         sql.transactional(() => { | ||||||
|             sql.replace(remoteEntityChange.entityName, entity); |             sql.replace(remoteEntityChange.entityName, entity); | ||||||
|  |  | ||||||
|             entityChangesService.addEntityChange(remoteEntityChange, true); |             entityChangesService.addEntityChange(remoteEntityChange); | ||||||
|         }); |         }); | ||||||
|  |  | ||||||
|         return true; |         return true; | ||||||
| @@ -86,7 +86,7 @@ function updateNoteReordering(entityChange, entity) { | |||||||
|             sql.execute("UPDATE branches SET notePosition = ? WHERE branchId = ?", [entity[key], key]); |             sql.execute("UPDATE branches SET notePosition = ? WHERE branchId = ?", [entity[key], key]); | ||||||
|         } |         } | ||||||
|  |  | ||||||
|         entityChangesService.addEntityChange(entityChange, true); |         entityChangesService.addEntityChange(entityChange); | ||||||
|     }); |     }); | ||||||
|  |  | ||||||
|     return true; |     return true; | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user