mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	Compare commits
	
		
			12 Commits
		
	
	
		
			v0.52.1-be
			...
			v0.52.3
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					fac9fef652 | ||
| 
						 | 
					f0ab1fb5a1 | ||
| 
						 | 
					df3fdb59c5 | ||
| 
						 | 
					23e9bcfdc5 | ||
| 
						 | 
					96c4934c00 | ||
| 
						 | 
					31fb02f810 | ||
| 
						 | 
					e206d9cc68 | ||
| 
						 | 
					2d33f570f4 | ||
| 
						 | 
					15f8173add | ||
| 
						 | 
					7609bc78ec | ||
| 
						 | 
					b4ac41eff8 | ||
| 
						 | 
					de1c76ee3c | 
@@ -22,7 +22,7 @@ RUN set -x \
 | 
				
			|||||||
    && apk del .build-dependencies
 | 
					    && apk del .build-dependencies
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Some setup tools need to be kept
 | 
					# Some setup tools need to be kept
 | 
				
			||||||
RUN apk add --no-cache su-exec
 | 
					RUN apk add --no-cache su-exec shadow
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Bundle app source
 | 
					# Bundle app source
 | 
				
			||||||
COPY . .
 | 
					COPY . .
 | 
				
			||||||
 
 | 
				
			|||||||
							
								
								
									
										46
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										46
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							@@ -1,12 +1,12 @@
 | 
				
			|||||||
{
 | 
					{
 | 
				
			||||||
  "name": "trilium",
 | 
					  "name": "trilium",
 | 
				
			||||||
  "version": "0.51.2",
 | 
					  "version": "0.52.1-beta",
 | 
				
			||||||
  "lockfileVersion": 2,
 | 
					  "lockfileVersion": 2,
 | 
				
			||||||
  "requires": true,
 | 
					  "requires": true,
 | 
				
			||||||
  "packages": {
 | 
					  "packages": {
 | 
				
			||||||
    "": {
 | 
					    "": {
 | 
				
			||||||
      "name": "trilium",
 | 
					      "name": "trilium",
 | 
				
			||||||
      "version": "0.51.2",
 | 
					      "version": "0.52.1-beta",
 | 
				
			||||||
      "hasInstallScript": true,
 | 
					      "hasInstallScript": true,
 | 
				
			||||||
      "license": "AGPL-3.0-only",
 | 
					      "license": "AGPL-3.0-only",
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
@@ -21,7 +21,7 @@
 | 
				
			|||||||
        "commonmark": "0.30.0",
 | 
					        "commonmark": "0.30.0",
 | 
				
			||||||
        "cookie-parser": "1.4.6",
 | 
					        "cookie-parser": "1.4.6",
 | 
				
			||||||
        "csurf": "1.11.0",
 | 
					        "csurf": "1.11.0",
 | 
				
			||||||
        "dayjs": "1.11.2",
 | 
					        "dayjs": "1.11.3",
 | 
				
			||||||
        "ejs": "3.1.8",
 | 
					        "ejs": "3.1.8",
 | 
				
			||||||
        "electron-debug": "3.2.0",
 | 
					        "electron-debug": "3.2.0",
 | 
				
			||||||
        "electron-dl": "3.3.1",
 | 
					        "electron-dl": "3.3.1",
 | 
				
			||||||
@@ -65,7 +65,7 @@
 | 
				
			|||||||
        "tmp": "0.2.1",
 | 
					        "tmp": "0.2.1",
 | 
				
			||||||
        "turndown": "7.1.1",
 | 
					        "turndown": "7.1.1",
 | 
				
			||||||
        "unescape": "1.0.1",
 | 
					        "unescape": "1.0.1",
 | 
				
			||||||
        "ws": "8.6.0",
 | 
					        "ws": "8.7.0",
 | 
				
			||||||
        "yauzl": "2.10.0"
 | 
					        "yauzl": "2.10.0"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "bin": {
 | 
					      "bin": {
 | 
				
			||||||
@@ -82,7 +82,7 @@
 | 
				
			|||||||
        "jsdoc": "3.6.10",
 | 
					        "jsdoc": "3.6.10",
 | 
				
			||||||
        "lorem-ipsum": "2.0.4",
 | 
					        "lorem-ipsum": "2.0.4",
 | 
				
			||||||
        "rcedit": "3.0.1",
 | 
					        "rcedit": "3.0.1",
 | 
				
			||||||
        "webpack": "5.72.1",
 | 
					        "webpack": "5.73.0",
 | 
				
			||||||
        "webpack-cli": "4.9.2"
 | 
					        "webpack-cli": "4.9.2"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
      "optionalDependencies": {
 | 
					      "optionalDependencies": {
 | 
				
			||||||
@@ -3115,9 +3115,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/dayjs": {
 | 
					    "node_modules/dayjs": {
 | 
				
			||||||
      "version": "1.11.2",
 | 
					      "version": "1.11.3",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz",
 | 
				
			||||||
      "integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw=="
 | 
					      "integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/debug": {
 | 
					    "node_modules/debug": {
 | 
				
			||||||
      "version": "4.3.4",
 | 
					      "version": "4.3.4",
 | 
				
			||||||
@@ -10252,9 +10252,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/webpack": {
 | 
					    "node_modules/webpack": {
 | 
				
			||||||
      "version": "5.72.1",
 | 
					      "version": "5.73.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.72.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.73.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-dXG5zXCLspQR4krZVR6QgajnZOjW2K/djHvdcRaDQvsjV9z9vaW6+ja5dZOYbqBBjF6kGXka/2ZyxNdc+8Jung==",
 | 
					      "integrity": "sha512-svjudQRPPa0YiOYa2lM/Gacw0r6PvxptHj4FuEKQ2kX05ZLkjbVc5MnPs6its5j7IZljnIqSVo/OsY2X0IpHGA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "dependencies": {
 | 
					      "dependencies": {
 | 
				
			||||||
        "@types/eslint-scope": "^3.7.3",
 | 
					        "@types/eslint-scope": "^3.7.3",
 | 
				
			||||||
@@ -10594,9 +10594,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "node_modules/ws": {
 | 
					    "node_modules/ws": {
 | 
				
			||||||
      "version": "8.6.0",
 | 
					      "version": "8.7.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/ws/-/ws-8.6.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==",
 | 
					      "integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==",
 | 
				
			||||||
      "engines": {
 | 
					      "engines": {
 | 
				
			||||||
        "node": ">=10.0.0"
 | 
					        "node": ">=10.0.0"
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
@@ -13271,9 +13271,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "dayjs": {
 | 
					    "dayjs": {
 | 
				
			||||||
      "version": "1.11.2",
 | 
					      "version": "1.11.3",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.2.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.11.3.tgz",
 | 
				
			||||||
      "integrity": "sha512-F4LXf1OeU9hrSYRPTTj/6FbO4HTjPKXvEIC1P2kcnFurViINCVk3ZV0xAS3XVx9MkMsXbbqlK6hjseaYbgKEHw=="
 | 
					      "integrity": "sha512-xxwlswWOlGhzgQ4TKzASQkUhqERI3egRNqgV4ScR8wlANA/A9tZ7miXa44vTTKEq5l7vWoL5G57bG3zA+Kow0A=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "debug": {
 | 
					    "debug": {
 | 
				
			||||||
      "version": "4.3.4",
 | 
					      "version": "4.3.4",
 | 
				
			||||||
@@ -18776,9 +18776,9 @@
 | 
				
			|||||||
      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
 | 
					      "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g=="
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "webpack": {
 | 
					    "webpack": {
 | 
				
			||||||
      "version": "5.72.1",
 | 
					      "version": "5.73.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.72.1.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.73.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-dXG5zXCLspQR4krZVR6QgajnZOjW2K/djHvdcRaDQvsjV9z9vaW6+ja5dZOYbqBBjF6kGXka/2ZyxNdc+8Jung==",
 | 
					      "integrity": "sha512-svjudQRPPa0YiOYa2lM/Gacw0r6PvxptHj4FuEKQ2kX05ZLkjbVc5MnPs6its5j7IZljnIqSVo/OsY2X0IpHGA==",
 | 
				
			||||||
      "dev": true,
 | 
					      "dev": true,
 | 
				
			||||||
      "requires": {
 | 
					      "requires": {
 | 
				
			||||||
        "@types/eslint-scope": "^3.7.3",
 | 
					        "@types/eslint-scope": "^3.7.3",
 | 
				
			||||||
@@ -19028,9 +19028,9 @@
 | 
				
			|||||||
      }
 | 
					      }
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "ws": {
 | 
					    "ws": {
 | 
				
			||||||
      "version": "8.6.0",
 | 
					      "version": "8.7.0",
 | 
				
			||||||
      "resolved": "https://registry.npmjs.org/ws/-/ws-8.6.0.tgz",
 | 
					      "resolved": "https://registry.npmjs.org/ws/-/ws-8.7.0.tgz",
 | 
				
			||||||
      "integrity": "sha512-AzmM3aH3gk0aX7/rZLYvjdvZooofDu3fFOzGqcSnQ1tOcTWwhM/o+q++E8mAyVVIyUdajrkzWUGftaVSDLn1bw==",
 | 
					      "integrity": "sha512-c2gsP0PRwcLFzUiA8Mkr37/MI7ilIlHQxaEAtd0uNMbVMoy8puJyafRlm0bV9MbGSabUPeLrRRaqIBcFcA2Pqg==",
 | 
				
			||||||
      "requires": {}
 | 
					      "requires": {}
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    "xdg-basedir": {
 | 
					    "xdg-basedir": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -2,7 +2,7 @@
 | 
				
			|||||||
  "name": "trilium",
 | 
					  "name": "trilium",
 | 
				
			||||||
  "productName": "Trilium Notes",
 | 
					  "productName": "Trilium Notes",
 | 
				
			||||||
  "description": "Trilium Notes",
 | 
					  "description": "Trilium Notes",
 | 
				
			||||||
  "version": "0.52.1-beta",
 | 
					  "version": "0.52.3",
 | 
				
			||||||
  "license": "AGPL-3.0-only",
 | 
					  "license": "AGPL-3.0-only",
 | 
				
			||||||
  "main": "electron.js",
 | 
					  "main": "electron.js",
 | 
				
			||||||
  "bin": {
 | 
					  "bin": {
 | 
				
			||||||
@@ -36,7 +36,7 @@
 | 
				
			|||||||
    "commonmark": "0.30.0",
 | 
					    "commonmark": "0.30.0",
 | 
				
			||||||
    "cookie-parser": "1.4.6",
 | 
					    "cookie-parser": "1.4.6",
 | 
				
			||||||
    "csurf": "1.11.0",
 | 
					    "csurf": "1.11.0",
 | 
				
			||||||
    "dayjs": "1.11.2",
 | 
					    "dayjs": "1.11.3",
 | 
				
			||||||
    "ejs": "3.1.8",
 | 
					    "ejs": "3.1.8",
 | 
				
			||||||
    "electron-debug": "3.2.0",
 | 
					    "electron-debug": "3.2.0",
 | 
				
			||||||
    "electron-dl": "3.3.1",
 | 
					    "electron-dl": "3.3.1",
 | 
				
			||||||
@@ -80,7 +80,7 @@
 | 
				
			|||||||
    "tmp": "0.2.1",
 | 
					    "tmp": "0.2.1",
 | 
				
			||||||
    "turndown": "7.1.1",
 | 
					    "turndown": "7.1.1",
 | 
				
			||||||
    "unescape": "1.0.1",
 | 
					    "unescape": "1.0.1",
 | 
				
			||||||
    "ws": "8.6.0",
 | 
					    "ws": "8.7.0",
 | 
				
			||||||
    "yauzl": "2.10.0"
 | 
					    "yauzl": "2.10.0"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "devDependencies": {
 | 
					  "devDependencies": {
 | 
				
			||||||
@@ -94,7 +94,7 @@
 | 
				
			|||||||
    "jsdoc": "3.6.10",
 | 
					    "jsdoc": "3.6.10",
 | 
				
			||||||
    "lorem-ipsum": "2.0.4",
 | 
					    "lorem-ipsum": "2.0.4",
 | 
				
			||||||
    "rcedit": "3.0.1",
 | 
					    "rcedit": "3.0.1",
 | 
				
			||||||
    "webpack": "5.72.1",
 | 
					    "webpack": "5.73.0",
 | 
				
			||||||
    "webpack-cli": "4.9.2"
 | 
					    "webpack-cli": "4.9.2"
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  "optionalDependencies": {
 | 
					  "optionalDependencies": {
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,7 +9,6 @@ const entityChangesService = require('../../services/entity_changes');
 | 
				
			|||||||
const AbstractEntity = require("./abstract_entity");
 | 
					const AbstractEntity = require("./abstract_entity");
 | 
				
			||||||
const NoteRevision = require("./note_revision");
 | 
					const NoteRevision = require("./note_revision");
 | 
				
			||||||
const TaskContext = require("../../services/task_context");
 | 
					const TaskContext = require("../../services/task_context");
 | 
				
			||||||
const handlers = require("../../services/handlers");
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const LABEL = 'label';
 | 
					const LABEL = 'label';
 | 
				
			||||||
const RELATION = 'relation';
 | 
					const RELATION = 'relation';
 | 
				
			||||||
@@ -1134,6 +1133,10 @@ class Note extends AbstractEntity {
 | 
				
			|||||||
     * @param {TaskContext} [taskContext]
 | 
					     * @param {TaskContext} [taskContext]
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    deleteNote(deleteId, taskContext) {
 | 
					    deleteNote(deleteId, taskContext) {
 | 
				
			||||||
 | 
					        if (this.isDeleted) {
 | 
				
			||||||
 | 
					            return;
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (!deleteId) {
 | 
					        if (!deleteId) {
 | 
				
			||||||
            deleteId = utils.randomString(10);
 | 
					            deleteId = utils.randomString(10);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
@@ -1143,6 +1146,7 @@ class Note extends AbstractEntity {
 | 
				
			|||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // needs to be run before branches and attributes are deleted and thus attached relations disappear
 | 
					        // needs to be run before branches and attributes are deleted and thus attached relations disappear
 | 
				
			||||||
 | 
					        const handlers = require("../../services/handlers");
 | 
				
			||||||
        handlers.runAttachedRelations(this, 'runOnNoteDeletion', this);
 | 
					        handlers.runAttachedRelations(this, 'runOnNoteDeletion', this);
 | 
				
			||||||
        taskContext.noteDeletionHandlerTriggered = true;
 | 
					        taskContext.noteDeletionHandlerTriggered = true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -280,7 +280,7 @@ function isHtmlEmpty(html) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
async function clearBrowserCache() {
 | 
					async function clearBrowserCache() {
 | 
				
			||||||
    if (isElectron()) {
 | 
					    if (isElectron()) {
 | 
				
			||||||
        const win = utils.dynamicRequire('@electron/remote').getCurrentWindow();
 | 
					        const win = dynamicRequire('@electron/remote').getCurrentWindow();
 | 
				
			||||||
        await win.webContents.session.clearCache();
 | 
					        await win.webContents.session.clearCache();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -235,7 +235,7 @@ const ATTR_HELP = {
 | 
				
			|||||||
        "runOnNoteChange": "executes when note is changed (includes note creation as well)",
 | 
					        "runOnNoteChange": "executes when note is changed (includes note creation as well)",
 | 
				
			||||||
        "runOnNoteDeletion": "executes when note is being deleted",
 | 
					        "runOnNoteDeletion": "executes when note is being deleted",
 | 
				
			||||||
        "runOnBranchCreation": "executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.",
 | 
					        "runOnBranchCreation": "executes when a branch is created. Branch is a link between parent note and child note and is created e.g. when cloning or moving note.",
 | 
				
			||||||
        "runOnBranchDeletion": "executes when a branch is delete. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).",
 | 
					        "runOnBranchDeletion": "executes when a branch is deleted. Branch is a link between parent note and child note and is deleted e.g. when moving note (old branch/link is deleted).",
 | 
				
			||||||
        "runOnChildNoteCreation": "executes when new note is created under this note",
 | 
					        "runOnChildNoteCreation": "executes when new note is created under this note",
 | 
				
			||||||
        "runOnAttributeCreation": "executes when new attribute is created under this note",
 | 
					        "runOnAttributeCreation": "executes when new attribute is created under this note",
 | 
				
			||||||
        "runOnAttributeChange": "executes when attribute is changed under this note",
 | 
					        "runOnAttributeChange": "executes when attribute is changed under this note",
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -968,3 +968,8 @@ input {
 | 
				
			|||||||
.note-split.full-content-width {
 | 
					.note-split.full-content-width {
 | 
				
			||||||
    max-width: 999999px;
 | 
					    max-width: 999999px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					button.close:hover {
 | 
				
			||||||
 | 
					    text-shadow: none;
 | 
				
			||||||
 | 
					    color: currentColor;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -170,7 +170,6 @@ span.fancytree-active .fancytree-title {
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
span.fancytree-selected {
 | 
					span.fancytree-selected {
 | 
				
			||||||
    color: var(--hover-item-text-color) !important;
 | 
					 | 
				
			||||||
    border-color: var(--main-border-color) !important;
 | 
					    border-color: var(--main-border-color) !important;
 | 
				
			||||||
    border-radius: 5px;
 | 
					    border-radius: 5px;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -21,7 +21,8 @@ function updateFile(req) {
 | 
				
			|||||||
        return [404, `Note ${noteId} doesn't exist.`];
 | 
					        return [404, `Note ${noteId} doesn't exist.`];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteRevisionService.createNoteRevision(note);
 | 
					    note.saveNoteRevision();
 | 
				
			||||||
 | 
					    noteRevisionService.protectNoteRevisions(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    note.mime = file.mimetype.toLowerCase();
 | 
					    note.mime = file.mimetype.toLowerCase();
 | 
				
			||||||
    note.save();
 | 
					    note.save();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -97,7 +97,8 @@ function restoreNoteRevision(req) {
 | 
				
			|||||||
    if (noteRevision) {
 | 
					    if (noteRevision) {
 | 
				
			||||||
        const note = noteRevision.getNote();
 | 
					        const note = noteRevision.getNote();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        noteRevisionService.createNoteRevision(note);
 | 
					        note.saveNoteRevision();
 | 
				
			||||||
 | 
					        noteRevisionService.protectNoteRevisions(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        note.title = noteRevision.title;
 | 
					        note.title = noteRevision.title;
 | 
				
			||||||
        note.setContent(noteRevision.getContent());
 | 
					        note.setContent(noteRevision.getContent());
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -294,7 +294,8 @@ function uploadModifiedFile(req) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    log.info(`Updating note '${noteId}' with content from ${filePath}`);
 | 
					    log.info(`Updating note '${noteId}' with content from ${filePath}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteRevisionService.createNoteRevision(note);
 | 
					    note.saveNoteRevision();
 | 
				
			||||||
 | 
					    noteRevisionService.protectNoteRevisions(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const fileContent = fs.readFileSync(filePath);
 | 
					    const fileContent = fs.readFileSync(filePath);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -9,15 +9,16 @@ const noteRevisionService = require("../../services/note_revisions");
 | 
				
			|||||||
const branchService = require("../../services/branches");
 | 
					const branchService = require("../../services/branches");
 | 
				
			||||||
const cloningService = require("../../services/cloning");
 | 
					const cloningService = require("../../services/cloning");
 | 
				
			||||||
const {formatAttrForSearch} = require("../../services/attribute_formatter");
 | 
					const {formatAttrForSearch} = require("../../services/attribute_formatter");
 | 
				
			||||||
 | 
					const utils = require("../../services/utils.js");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function searchFromNoteInt(note) {
 | 
					function searchFromNoteInt(note) {
 | 
				
			||||||
    let searchResultNoteIds;
 | 
					    let searchResultNoteIds;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const searchScript = note.getRelationValue('searchScript');
 | 
					    const searchScript = note.getRelationValue('searchScript');
 | 
				
			||||||
    const searchString = note.getLabelValue('searchString');
 | 
					    const searchString = note.getLabelValue('searchString');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (searchScript) {
 | 
					    if (searchScript) {
 | 
				
			||||||
        searchResultNoteIds = await searchFromRelation(note, 'searchScript');
 | 
					        searchResultNoteIds = searchFromRelation(note, 'searchScript');
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        const searchContext = new SearchContext({
 | 
					        const searchContext = new SearchContext({
 | 
				
			||||||
            fastSearch: note.hasLabel('fastSearch'),
 | 
					            fastSearch: note.hasLabel('fastSearch'),
 | 
				
			||||||
@@ -61,7 +62,9 @@ async function searchFromNote(req) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
const ACTION_HANDLERS = {
 | 
					const ACTION_HANDLERS = {
 | 
				
			||||||
    deleteNote: (action, note) => {
 | 
					    deleteNote: (action, note) => {
 | 
				
			||||||
        note.markAsDeleted();
 | 
					        const deleteId = 'searchbulkaction-' + utils.randomString(10);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					        note.deleteNote(deleteId);
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    deleteNoteRevisions: (action, note) => {
 | 
					    deleteNoteRevisions: (action, note) => {
 | 
				
			||||||
        noteRevisionService.eraseNoteRevisions(note.getNoteRevisions().map(rev => rev.noteRevisionId));
 | 
					        noteRevisionService.eraseNoteRevisions(note.getNoteRevisions().map(rev => rev.noteRevisionId));
 | 
				
			||||||
@@ -149,7 +152,7 @@ function getActions(note) {
 | 
				
			|||||||
        .filter(a => !!a);
 | 
					        .filter(a => !!a);
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
async function searchAndExecute(req) {
 | 
					function searchAndExecute(req) {
 | 
				
			||||||
    const note = becca.getNote(req.params.noteId);
 | 
					    const note = becca.getNote(req.params.noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (!note) {
 | 
					    if (!note) {
 | 
				
			||||||
@@ -165,7 +168,7 @@ async function searchAndExecute(req) {
 | 
				
			|||||||
        return [400, `Note ${req.params.noteId} is not a search note.`]
 | 
					        return [400, `Note ${req.params.noteId} is not a search note.`]
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const searchResultNoteIds = await searchFromNoteInt(note);
 | 
					    const searchResultNoteIds = searchFromNoteInt(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const actions = getActions(note);
 | 
					    const actions = getActions(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1 +1 @@
 | 
				
			|||||||
module.exports = { buildDate:"2022-06-05T15:00:25+02:00", buildRevision: "f587e0dfd9177462faef8ad7c39a855c25d03c91" };
 | 
					module.exports = { buildDate:"2022-06-13T23:41:52+02:00", buildRevision: "f0ab1fb5a1c45bf15eae46a72b46ebf132eee531" };
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -50,7 +50,7 @@ module.exports = [
 | 
				
			|||||||
    { type: 'label', name: 'shareDisallowRobotIndexing' },
 | 
					    { type: 'label', name: 'shareDisallowRobotIndexing' },
 | 
				
			||||||
    { type: 'label', name: 'displayRelations' },
 | 
					    { type: 'label', name: 'displayRelations' },
 | 
				
			||||||
    { type: 'label', name: 'hideRelations' },
 | 
					    { type: 'label', name: 'hideRelations' },
 | 
				
			||||||
    { type: 'label', name: 'titleTemplate' },
 | 
					    { type: 'label', name: 'titleTemplate', isDangerous: true },
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // relation names
 | 
					    // relation names
 | 
				
			||||||
    { type: 'relation', name: 'internalLink' },
 | 
					    { type: 'relation', name: 'internalLink' },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -68,7 +68,7 @@ function updateImage(noteId, uploadBuffer, originalName) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const note = becca.getNote(noteId);
 | 
					    const note = becca.getNote(noteId);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    noteRevisionService.createNoteRevision(note);
 | 
					    note.saveNoteRevision();
 | 
				
			||||||
    noteRevisionService.protectNoteRevisions(note);
 | 
					    noteRevisionService.protectNoteRevisions(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    note.setLabel('originalFileName', originalName);
 | 
					    note.setLabel('originalFileName', originalName);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -98,25 +98,25 @@ const DEFAULT_KEYBOARD_ACTIONS = [
 | 
				
			|||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        actionName: "moveNoteUp",
 | 
					        actionName: "moveNoteUp",
 | 
				
			||||||
        defaultShortcuts: ["CommandOrControl+Up"],
 | 
					        defaultShortcuts: isMac ? ["Alt+Up"] : ["CommandOrControl+Up"],
 | 
				
			||||||
        description: "Move note up",
 | 
					        description: "Move note up",
 | 
				
			||||||
        scope: "note-tree"
 | 
					        scope: "note-tree"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        actionName: "moveNoteDown",
 | 
					        actionName: "moveNoteDown",
 | 
				
			||||||
        defaultShortcuts: ["CommandOrControl+Down"],
 | 
					        defaultShortcuts: isMac ? ["Alt+Down"] : ["CommandOrControl+Down"],
 | 
				
			||||||
        description: "Move note down",
 | 
					        description: "Move note down",
 | 
				
			||||||
        scope: "note-tree"
 | 
					        scope: "note-tree"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        actionName: "moveNoteUpInHierarchy",
 | 
					        actionName: "moveNoteUpInHierarchy",
 | 
				
			||||||
        defaultShortcuts: ["CommandOrControl+Left"],
 | 
					        defaultShortcuts: isMac ? ["Alt+Left"] : ["CommandOrControl+Left"],
 | 
				
			||||||
        description: "Move note up in hierarchy",
 | 
					        description: "Move note up in hierarchy",
 | 
				
			||||||
        scope: "note-tree"
 | 
					        scope: "note-tree"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
        actionName: "moveNoteDownInHierarchy",
 | 
					        actionName: "moveNoteDownInHierarchy",
 | 
				
			||||||
        defaultShortcuts: ["CommandOrControl+Right"],
 | 
					        defaultShortcuts: isMac ? ["Alt+Right"] : ["CommandOrControl+Right"],
 | 
				
			||||||
        description: "Move note down in hierarchy",
 | 
					        description: "Move note down in hierarchy",
 | 
				
			||||||
        scope: "note-tree"
 | 
					        scope: "note-tree"
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -102,7 +102,7 @@ function isDbUpToDate() {
 | 
				
			|||||||
async function migrateIfNecessary() {
 | 
					async function migrateIfNecessary() {
 | 
				
			||||||
    const currentDbVersion = getDbVersion();
 | 
					    const currentDbVersion = getDbVersion();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (currentDbVersion > appInfo.dbVersion) {
 | 
					    if (currentDbVersion > appInfo.dbVersion && process.env.TRILIUM_IGNORE_DB_VERSION !== 'true') {
 | 
				
			||||||
        log.error(`Current DB version ${currentDbVersion} is newer than app db version ${appInfo.dbVersion} which means that it was created by newer and incompatible version of Trilium. Upgrade to latest version of Trilium to resolve this issue.`);
 | 
					        log.error(`Current DB version ${currentDbVersion} is newer than app db version ${appInfo.dbVersion} which means that it was created by newer and incompatible version of Trilium. Upgrade to latest version of Trilium to resolve this issue.`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        utils.crash();
 | 
					        utils.crash();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,9 +1,8 @@
 | 
				
			|||||||
"use strict";
 | 
					"use strict";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const NoteRevision = require('../becca/entities/note_revision');
 | 
					 | 
				
			||||||
const dateUtils = require('./date_utils');
 | 
					 | 
				
			||||||
const log = require('./log');
 | 
					const log = require('./log');
 | 
				
			||||||
const sql = require('./sql');
 | 
					const sql = require('./sql');
 | 
				
			||||||
 | 
					const protectedSession = require("./protected_session");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * @param {Note} note
 | 
					 * @param {Note} note
 | 
				
			||||||
@@ -11,6 +10,12 @@ const sql = require('./sql');
 | 
				
			|||||||
function protectNoteRevisions(note) {
 | 
					function protectNoteRevisions(note) {
 | 
				
			||||||
    for (const revision of note.getNoteRevisions()) {
 | 
					    for (const revision of note.getNoteRevisions()) {
 | 
				
			||||||
        if (note.isProtected !== revision.isProtected) {
 | 
					        if (note.isProtected !== revision.isProtected) {
 | 
				
			||||||
 | 
					            if (!protectedSession.isProtectedSessionAvailable()) {
 | 
				
			||||||
 | 
					                log.error("Protected session is not available to fix note revisions.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					                return;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            try {
 | 
					            try {
 | 
				
			||||||
                const content = revision.getContent();
 | 
					                const content = revision.getContent();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -78,6 +78,10 @@ function findResultsWithExpression(expression, searchContext) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    const searchResults = noteSet.notes
 | 
					    const searchResults = noteSet.notes
 | 
				
			||||||
        .map(note => {
 | 
					        .map(note => {
 | 
				
			||||||
 | 
					            if (note.isDeleted) {
 | 
				
			||||||
 | 
					                return null;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            const notePathArray = executionContext.noteIdToNotePath[note.noteId] || beccaService.getSomePath(note);
 | 
					            const notePathArray = executionContext.noteIdToNotePath[note.noteId] || beccaService.getSomePath(note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (!notePathArray) {
 | 
					            if (!notePathArray) {
 | 
				
			||||||
@@ -85,7 +89,8 @@ function findResultsWithExpression(expression, searchContext) {
 | 
				
			|||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return new SearchResult(notePathArray);
 | 
					            return new SearchResult(notePathArray);
 | 
				
			||||||
        });
 | 
					        })
 | 
				
			||||||
 | 
					        .filter(note => !!note);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    for (const res of searchResults) {
 | 
					    for (const res of searchResults) {
 | 
				
			||||||
        res.computeScore(searchContext.highlightedTokens);
 | 
					        res.computeScore(searchContext.highlightedTokens);
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -242,9 +242,9 @@ function transactional(func) {
 | 
				
			|||||||
        return ret;
 | 
					        return ret;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    catch (e) {
 | 
					    catch (e) {
 | 
				
			||||||
        const entityChanges = cls.getAndClearEntityChangeIds();
 | 
					        const entityChangeIds = cls.getAndClearEntityChangeIds();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        if (entityChanges.length > 0) {
 | 
					        if (entityChangeIds.length > 0) {
 | 
				
			||||||
            log.info("Transaction rollback dirtied the becca, forcing reload.");
 | 
					            log.info("Transaction rollback dirtied the becca, forcing reload.");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            require('../becca/becca_loader').load();
 | 
					            require('../becca/becca_loader').load();
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -1,4 +1,7 @@
 | 
				
			|||||||
#!/bin/sh
 | 
					#!/bin/sh
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					[[ ! -z "${USER_UID}" ]] && usermod -u ${USER_UID} node || echo "No USER_UID specified, leaving 1000"
 | 
				
			||||||
 | 
					[[ ! -z "${USER_GID}" ]] && groupmod -g ${USER_GID} node || echo "No USER_GID specified, leaving 1000"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
chown -R node:node /home/node
 | 
					chown -R node:node /home/node
 | 
				
			||||||
su-exec node node ./src/www
 | 
					su-exec node node ./src/www
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user