mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	Merge pull request #199 from TriliumNext/feature/port_0.63.7
Port 0.63.7
This commit is contained in:
		
						commit
						b6ca2281f7
					
				
							
								
								
									
										16
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										16
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							| @ -23,6 +23,22 @@ jobs: | ||||
|         with: | ||||
|           name: trilium-mac-x64.zip | ||||
|           path: dist/trilium-mac-x64*.zip | ||||
|   build_darwin-arm64: | ||||
|     name: Build macOS aarch64 | ||||
|     runs-on: ubuntu-latest | ||||
|     steps: | ||||
|       - uses: actions/checkout@v4 | ||||
|       - name: Set up node & dependencies | ||||
|         uses: actions/setup-node@v4 | ||||
|         with: | ||||
|           node-version: 18 | ||||
|           cache: "npm" | ||||
|       - run: npm ci | ||||
|       - run: ./bin/build-mac-arm64.sh | ||||
|       - uses: actions/upload-artifact@v4 | ||||
|         with: | ||||
|           name: trilium-mac-arm64.zip | ||||
|           path: dist/trilium-mac-arm64*.zip | ||||
|   build_linux-x64: | ||||
|     name: Build Linux x86_64 | ||||
|     runs-on: ubuntu-latest | ||||
|  | ||||
							
								
								
									
										
											BIN
										
									
								
								bin/better-sqlite3/mac-arm64-better_sqlite3.node
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								bin/better-sqlite3/mac-arm64-better_sqlite3.node
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										38
									
								
								bin/build-mac-arm64.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										38
									
								
								bin/build-mac-arm64.sh
									
									
									
									
									
										Executable file
									
								
							| @ -0,0 +1,38 @@ | ||||
| #!/usr/bin/env bash | ||||
| 
 | ||||
| SRC_DIR=./dist/trilium-mac-arm64-src | ||||
| 
 | ||||
| if [ "$1" != "DONTCOPY" ] | ||||
| then | ||||
|     ./bin/copy-trilium.sh $SRC_DIR | ||||
| fi | ||||
| 
 | ||||
| echo "Copying required mac arm64 binaries" | ||||
| 
 | ||||
| cp -r bin/better-sqlite3/mac-arm64-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| 
 | ||||
| rm -r $SRC_DIR/src/public/app-dist/*.mobile.* | ||||
| 
 | ||||
| echo "Packaging mac arm64 electron build" | ||||
| 
 | ||||
| ./node_modules/.bin/electron-packager $SRC_DIR --asar --out=dist --executable-name=trilium --platform=darwin --arch=arm64 --overwrite --icon=images/app-icons/mac/icon.icns | ||||
| 
 | ||||
| BUILD_DIR=./dist/trilium-mac-arm64 | ||||
| rm -rf $BUILD_DIR | ||||
| 
 | ||||
| # Mac build has by default useless directory level | ||||
| mv "./dist/Trilium Notes-darwin-arm64" $BUILD_DIR | ||||
| 
 | ||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||
| 
 | ||||
| cp -r dump-db $BUILD_DIR/ | ||||
| rm -rf $BUILD_DIR/dump-db/node_modules | ||||
| 
 | ||||
| echo "Zipping mac arm64 electron distribution..." | ||||
| 
 | ||||
| VERSION=`jq -r ".version" package.json` | ||||
| 
 | ||||
| cd dist | ||||
| 
 | ||||
| rm trilium-mac-arm64-${VERSION}.zip | ||||
| zip -r9 --symlinks trilium-mac-arm64-${VERSION}.zip trilium-mac-arm64 | ||||
| @ -7,9 +7,9 @@ then | ||||
|     ./bin/copy-trilium.sh $SRC_DIR | ||||
| fi | ||||
| 
 | ||||
| echo "Copying required mac binaries" | ||||
| echo "Copying required mac x64 binaries" | ||||
| 
 | ||||
| cp -r bin/better-sqlite3/mac-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| cp -r bin/better-sqlite3/mac-x64-better_sqlite3.node $SRC_DIR/node_modules/better-sqlite3/build/Release/better_sqlite3.node | ||||
| 
 | ||||
| rm -r $SRC_DIR/src/public/app-dist/*.mobile.* | ||||
| 
 | ||||
|  | ||||
| @ -13,11 +13,14 @@ cp -r $SRC_DIR ./dist/trilium-linux-x64-src | ||||
| cp -r $SRC_DIR ./dist/trilium-linux-x64-server | ||||
| cp -r $SRC_DIR ./dist/trilium-windows-x64-src | ||||
| cp -r $SRC_DIR ./dist/trilium-mac-x64-src | ||||
| cp -r $SRC_DIR ./dist/trilium-mac-arm64-src | ||||
| 
 | ||||
| bin/build-win-x64.sh DONTCOPY | ||||
| 
 | ||||
| bin/build-mac-x64.sh DONTCOPY | ||||
| 
 | ||||
| bin/build-mac-arm64.sh DONTCOPY | ||||
| 
 | ||||
| bin/build-linux-x64.sh DONTCOPY | ||||
| 
 | ||||
| bin/build-server.sh DONTCOPY | ||||
|  | ||||
| @ -48,6 +48,7 @@ LINUX_X64_BUILD=trilium-linux-x64-$VERSION.tar.xz | ||||
| DEBIAN_X64_BUILD=trilium_${VERSION}_amd64.deb | ||||
| WINDOWS_X64_BUILD=trilium-windows-x64-$VERSION.zip | ||||
| MAC_X64_BUILD=trilium-mac-x64-$VERSION.zip | ||||
| MAC_ARM64_BUILD=trilium-mac-arm64-$VERSION.zip | ||||
| SERVER_BUILD=trilium-linux-x64-server-$VERSION.tar.xz | ||||
| 
 | ||||
| echo "Creating release in GitHub" | ||||
| @ -68,4 +69,5 @@ gh release create "$TAG" \ | ||||
|     "dist/$LINUX_X64_BUILD" \ | ||||
|     "dist/$WINDOWS_X64_BUILD" \ | ||||
|     "dist/$MAC_X64_BUILD" \ | ||||
|     "dist/$MAC_ARM64_BUILD" \ | ||||
|     "dist/$SERVER_BUILD" | ||||
|  | ||||
							
								
								
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										4
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							| @ -1,12 +1,12 @@ | ||||
| { | ||||
|   "name": "trilium", | ||||
|   "version": "0.63.5", | ||||
|   "version": "0.63.6", | ||||
|   "lockfileVersion": 2, | ||||
|   "requires": true, | ||||
|   "packages": { | ||||
|     "": { | ||||
|       "name": "trilium", | ||||
|       "version": "0.63.5", | ||||
|       "version": "0.63.6", | ||||
|       "hasInstallScript": true, | ||||
|       "license": "AGPL-3.0-only", | ||||
|       "dependencies": { | ||||
|  | ||||
| @ -2,7 +2,7 @@ | ||||
|   "name": "trilium", | ||||
|   "productName": "Trilium Notes", | ||||
|   "description": "Trilium Notes", | ||||
|   "version": "0.63.5", | ||||
|   "version": "0.63.7", | ||||
|   "license": "AGPL-3.0-only", | ||||
|   "main": "electron.js", | ||||
|   "bin": { | ||||
|  | ||||
| @ -50,10 +50,10 @@ export default class TreeContextMenu { | ||||
|             { title: 'Open in a new tab <kbd>Ctrl+Click</kbd>', command: "openInTab", uiIcon: "bx bx-empty", enabled: noSelectedNotes }, | ||||
|             { title: 'Open in a new split', command: "openNoteInSplit", uiIcon: "bx bx-dock-right", enabled: noSelectedNotes }, | ||||
|             { title: 'Insert note after <kbd data-command="createNoteAfter"></kbd>', command: "insertNoteAfter", uiIcon: "bx bx-plus", | ||||
|                 items: insertNoteAfterEnabled ? await noteTypesService.getNoteTypeItems("insertNoteAfter", {removeDeprecatedTypes: true}) : null, | ||||
|                 items: insertNoteAfterEnabled ? await noteTypesService.getNoteTypeItems("insertNoteAfter") : null, | ||||
|                 enabled: insertNoteAfterEnabled && noSelectedNotes }, | ||||
|             { title: 'Insert child note <kbd data-command="createNoteInto"></kbd>', command: "insertChildNote", uiIcon: "bx bx-plus", | ||||
|                 items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote", {removeDeprecatedTypes: true}) : null, | ||||
|                 items: notSearch ? await noteTypesService.getNoteTypeItems("insertChildNote") : null, | ||||
|                 enabled: notSearch && noSelectedNotes }, | ||||
|             { title: 'Delete <kbd data-command="deleteNotes"></kbd>', command: "deleteNotes", uiIcon: "bx bx-trash", | ||||
|                 enabled: isNotRoot && !isHoisted && parentNotSearch }, | ||||
|  | ||||
| @ -1,21 +1,19 @@ | ||||
| import server from "./server.js"; | ||||
| import froca from "./froca.js"; | ||||
| 
 | ||||
| async function getNoteTypeItems(command, opts = {}) { | ||||
|     const removeDeprecatedTypes = !!opts.removeDeprecatedTypes; | ||||
| 
 | ||||
| async function getNoteTypeItems(command) { | ||||
|     const items = [ | ||||
|         { title: "Text", command: command, type: "text", uiIcon: "bx bx-note" }, | ||||
|         { title: "Code", command: command, type: "code", uiIcon: "bx bx-code" }, | ||||
|         { title: "Saved Search", command: command, type: "search", uiIcon: "bx bx-file-find" }, | ||||
|         { title: "Relation Map", command: command, type: "relationMap", uiIcon: "bx bx-map-alt", deprecated: true }, | ||||
|         { title: "Relation Map", command: command, type: "relationMap", uiIcon: "bx bx-map-alt" }, | ||||
|         { title: "Note Map", command: command, type: "noteMap", uiIcon: "bx bx-map-alt" }, | ||||
|         { title: "Render Note", command: command, type: "render", uiIcon: "bx bx-extension" }, | ||||
|         { title: "Book", command: command, type: "book", uiIcon: "bx bx-book" }, | ||||
|         { title: "Mermaid Diagram", command: command, type: "mermaid", uiIcon: "bx bx-selection" }, | ||||
|         { title: "Canvas", command: command, type: "canvas", uiIcon: "bx bx-pen" }, | ||||
|         { title: "Web View", command: command, type: "webView", uiIcon: "bx bx-globe-alt" }, | ||||
|     ].filter(item => !removeDeprecatedTypes || !item.deprecated); | ||||
|     ]; | ||||
| 
 | ||||
|     const templateNoteIds = await server.get("search-templates"); | ||||
|     const templateNotes = await froca.getNotes(templateNoteIds); | ||||
|  | ||||
| @ -2,7 +2,6 @@ import libraryLoader from '../../services/library_loader.js'; | ||||
| import TypeWidget from './type_widget.js'; | ||||
| import utils from '../../services/utils.js'; | ||||
| import linkService from '../../services/link.js'; | ||||
| import debounce from '../../services/debounce.js'; | ||||
| 
 | ||||
| const TPL = ` | ||||
|     <div class="canvas-widget note-detail-canvas note-detail-printable note-detail"> | ||||
| @ -103,8 +102,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | ||||
|         this.SCENE_VERSION_INITIAL = -1; // -1 indicates that it is fresh. excalidraw scene version is always >0
 | ||||
|         this.SCENE_VERSION_ERROR = -2; // -2 indicates error
 | ||||
| 
 | ||||
|         // config
 | ||||
|         this.DEBOUNCE_TIME_ONCHANGEHANDLER = 750; // ms
 | ||||
|         // ensure that assets are loaded from trilium
 | ||||
|         window.EXCALIDRAW_ASSET_PATH = `${window.location.origin}/node_modules/@excalidraw/excalidraw/dist/`; | ||||
| 
 | ||||
| @ -117,11 +114,6 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | ||||
|         this.$widget; | ||||
|         this.reactHandlers; // used to control react state
 | ||||
| 
 | ||||
|         // binds
 | ||||
|         this.createExcalidrawReactApp = this.createExcalidrawReactApp.bind(this); | ||||
|         this.onChangeHandler = this.onChangeHandler.bind(this); | ||||
|         this.isNewSceneVersion = this.isNewSceneVersion.bind(this); | ||||
| 
 | ||||
|         this.libraryChanged = false; | ||||
|     } | ||||
| 
 | ||||
| @ -153,7 +145,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | ||||
| 
 | ||||
|                 ReactDOM.unmountComponentAtNode(renderElement); | ||||
|                 const root = ReactDOM.createRoot(renderElement); | ||||
|                 root.render(React.createElement(this.createExcalidrawReactApp)); | ||||
|                 root.render(React.createElement(() => this.createExcalidrawReactApp())); | ||||
|             }); | ||||
| 
 | ||||
|         return this.$widget; | ||||
| @ -445,7 +437,7 @@ export default class ExcalidrawTypeWidget extends TypeWidget { | ||||
| 
 | ||||
|                         this.saveData(); | ||||
|                     }, | ||||
|                     onChange: debounce(this.onChangeHandler, this.DEBOUNCE_TIME_ONCHANGEHANDLER), | ||||
|                     onChange: () => this.onChangeHandler(), | ||||
|                     viewModeEnabled: false, | ||||
|                     zenModeEnabled: false, | ||||
|                     gridModeEnabled: false, | ||||
|  | ||||
| @ -184,8 +184,6 @@ export default class RelationMapTypeWidget extends TypeWidget { | ||||
|     } | ||||
| 
 | ||||
|     async loadMapData() { | ||||
|         toastService.showMessage("Relation Map has been deprecated since Trilium 0.63 and will be removed in a future version. Migrate your content to some other note type (e.g. canvas) as soon as possible.", 5000); | ||||
| 
 | ||||
|         this.mapData = { | ||||
|             notes: [], | ||||
|             // it is important to have this exact value here so that initial transform is the same as this
 | ||||
|  | ||||
| @ -169,6 +169,8 @@ function saveAttachmentToTmpDir(req: Request) { | ||||
|     return saveToTmpDir(fileName, content, 'attachments', attachment.attachmentId); | ||||
| } | ||||
| 
 | ||||
| const createdTemporaryFiles = new Set<string>(); | ||||
| 
 | ||||
| function saveToTmpDir(fileName: string, content: string | Buffer, entityType: string, entityId: string) { | ||||
|     const tmpObj = tmp.fileSync({ postfix: fileName }); | ||||
| 
 | ||||
| @ -180,6 +182,8 @@ function saveToTmpDir(fileName: string, content: string | Buffer, entityType: st | ||||
| 
 | ||||
|     fs.closeSync(tmpObj.fd); | ||||
| 
 | ||||
|     createdTemporaryFiles.add(tmpObj.name); | ||||
| 
 | ||||
|     log.info(`Saved temporary file ${tmpObj.name}`); | ||||
| 
 | ||||
|     if (utils.isElectron()) { | ||||
| @ -203,6 +207,10 @@ function uploadModifiedFileToNote(req: Request) { | ||||
|     const noteId = req.params.noteId; | ||||
|     const {filePath} = req.body; | ||||
| 
 | ||||
|     if (!createdTemporaryFiles.has(filePath)) { | ||||
|         throw new ValidationError(`File '${filePath}' is not a temporary file.`); | ||||
|     } | ||||
| 
 | ||||
|     const note = becca.getNoteOrThrow(noteId); | ||||
| 
 | ||||
|     log.info(`Updating note '${noteId}' with content from '${filePath}'`); | ||||
|  | ||||
| @ -1 +1 @@ | ||||
| export = { buildDate:"2024-03-28T07:11:39+01:00", buildRevision: "399458b52f250b22be22d980a78de0b3390d7521" }; | ||||
| export = { buildDate:"2024-05-18T06:17:21+02:00", buildRevision: "c7f19e04fafc031910f6f9a45d2015387618e902" }; | ||||
|  | ||||
| @ -446,6 +446,7 @@ function findIncludeNoteLinks(content: string, foundLinks: FoundLink[]) { | ||||
| } | ||||
| 
 | ||||
| function findRelationMapLinks(content: string, foundLinks: FoundLink[]) { | ||||
|     try { | ||||
|         const obj = JSON.parse(content); | ||||
| 
 | ||||
|         for (const note of obj.notes) { | ||||
| @ -454,6 +455,9 @@ function findRelationMapLinks(content: string, foundLinks: FoundLink[]) { | ||||
|                 value: note.noteId | ||||
|             }); | ||||
|         } | ||||
|     } catch (e: any) { | ||||
|         log.error("Could not scan for relation map links: " + e.message); | ||||
|     } | ||||
| } | ||||
| 
 | ||||
| const imageUrlToAttachmentIdMapping: Record<string, string> = {}; | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran