diff --git a/README-ZH_CN.md b/README-ZH_CN.md index 47d93a3da..8b2b21253 100644 --- a/README-ZH_CN.md +++ b/README-ZH_CN.md @@ -1,6 +1,6 @@ # Trilium Notes -[English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) +[English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md) [![Join the chat at https://gitter.im/trilium-notes/Lobby](https://badges.gitter.im/trilium-notes/Lobby.svg)](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Trilium Notes 是一个层次化的笔记应用程序,专注于建立大型个人知识库。请参阅[屏幕截图](https://github.com/zadam/trilium/wiki/Screenshot-tour)以快速了解: diff --git a/README.it.md b/README.it.md new file mode 100644 index 000000000..8f845ca46 --- /dev/null +++ b/README.it.md @@ -0,0 +1,93 @@ +# Trilium Notes + +## Trilium è in manutenzione - vedi i dettagli in https://github.com/zadam/trilium/issues/4620 + +Le discussioni preliminari sull'organizzazione si stanno svolgendo in [Trilium Next discussions](https://github.com/orgs/TriliumNext/discussions). + +[![Join the chat at https://gitter.im/trilium-notes/Lobby](https://badges.gitter.im/trilium-notes/Lobby.svg)](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md) + + +Trilium Notes è un'applicazione per appunti ad organizzazione gerarchica, studiata per la costruzione di archivi di conoscenza personali di grandi dimensioni. + +Vedi [fotografie](https://github.com/zadam/trilium/wiki/Screenshot-tour) per una panoramica veloce: + +Trilium Screenshot + +L'Ucraina si sta difendendo dall'aggressione russa, considera [donare all'esercito ucraino o a organizzazioni umanitarie](https://standforukraine.com/). + +

+ drawing + Trilium Notes supports Ukraine! +

+ +## 🎁 Funzionalità + + +* Gli appunti possono essere organizzati in un albero di profondità arbitraria. Un singolo appunto può essere collocato in più posti nell'albero (vedi [clonazione](https://github.com/zadam/trilium/wiki/Cloning-notes)) +* Ricco editor visuale (WYSIWYG), con supporto -tra l'altro- per tabelle, immagini ed [espressioni matematiche](https://github.com/zadam/trilium/wiki/Text-notes#math-support) e con [formattazione automatica](https://github.com/zadam/trilium/wiki/Text-notes#autoformat) per markdown +* Supporto per la modifica di [appunti con codice sorgente](https://github.com/zadam/trilium/wiki/Code-notes), con evidenziazione della sintassi +* [Navigazione veloce](https://github.com/zadam/trilium/wiki/Note-navigation) tra gli appunti, ricerca testuale completa e [fissaggio degli appunti](https://github.com/zadam/trilium/wiki/Note-hoisting) +* Supporto integrato ed automatico per le [revisioni degli appunti](https://github.com/zadam/trilium/wiki/Note-revisions) +* Gli [attributi](https://github.com/zadam/trilium/wiki/Attributes) degli appunti possono essere utilizzati per l'organizzazione, per l'interrogazione e per lo scripting avanzato (prorgrammazione). +* [Sincronizzazione](https://github.com/zadam/trilium/wiki/Synchronization) con un server di sincronizzazione auto-ospitato + * c'è un [servizio di terze parti per ospitare server di sincronizzazione](https://trilium.cc/paid-hosting) +* [Condivisione](https://github.com/zadam/trilium/wiki/Sharing) (pubblicazione) di appunti sull'internet pubblico +* Robusta [crittografia](https://github.com/zadam/trilium/wiki/Protected-notes) configurabile singolarmente per ogni appunto +* Disegno di diagrammi con Excalidraw (tipo di appunto "canvas") +* [Mappe relazionali](https://github.com/zadam/trilium/wiki/Relation-map) e [mappe di collegamenti](https://github.com/zadam/trilium/wiki/Link-map) per visualizzare gli appunti e le loro relazioni +* [Scripting](https://github.com/zadam/trilium/wiki/Scripts) - vedi [Esempi avanzati](https://github.com/zadam/trilium/wiki/Advanced-showcases) +* [API REST](https://github.com/zadam/trilium/wiki/ETAPI) per l'automazione +* Si adatta bene sia in termini di usabilità che di prestazioni fino ad oltre 100 000 appunti +* Interfaccia utente ottimizzata per il [mobile](https://github.com/zadam/trilium/wiki/Mobile-frontend) (smartphone e tablet) +* [Tema Notturno](https://github.com/zadam/trilium/wiki/Themes) +* Supporto per importazione ed esportazione da e per [Evernote](https://github.com/zadam/trilium/wiki/Evernote-import) e [Markdown import](https://github.com/zadam/trilium/wiki/Markdown) +* [Web Clipper](https://github.com/zadam/trilium/wiki/Web-clipper) per il salvataggio facile di contenuti web + + +Dai un'occhiata a [awesome-trilium](https://github.com/Nriver/awesome-trilium) per temi, script, plugin e altro di terze parti. + +## 🏗 Rilasci + + +Trilium è fornito come applicazione desktop (Linux e Windows) o come applicazione web ospitata sul tuo server (Linux). La versione desktop per Mac OS è disponibile, ma [non è supportata](https://github.com/zadam/trilium/wiki/FAQ#mac-os-support). + +* Se vuoi usare Trilium sul tuo desktop, scarica il rilascio binario per la tua piattaforma dall'[ultimo rilascio](https://github.com/zadam/trilium/releases/latest), decomprimi l'archivio e avvia l'eseguibile ```trilium```. +* Se vuoi installare Trilium su un server, segui [questa pagina](https://github.com/zadam/trilium/wiki/Server-installation). + * Per ora solo Chrome e Firefox sono i browser supportati (testati). + +Trilium è anche disponibile su Flatpak: + +[](https://flathub.org/apps/details/com.github.zadam.trilium) + +## 📝 Documentazione + +[Vedi la wiki per una lista completa delle pagine di documentazione.](https://github.com/zadam/trilium/wiki/) + +Puoi anche leggere ["Patterns of personal knowledge base"](https://github.com/zadam/trilium/wiki/Patterns-of-personal-knowledge-base) per avere un'ispirazione su come potresti utilizzare Trilium. + +## 💻 Contribuire + +Usa un ambiente di sviluppo basato su browser + +[![Apri in Gitpod](https://gitpod.io/button/open-in-gitpod.svg)](https://gitpod.io/#https://github.com/zadam/trilium) + +O clona localmente ed esegui +``` +npm install +npm run start-server +``` + +## 📢 Riconoscimenti + +* [CKEditor 5](https://github.com/ckeditor/ckeditor5) - miglior editor visuale (WYSIWYG) sul mercato, squadra di sviluppo attenta e reattiva +* [FancyTree](https://github.com/mar10/fancytree) - libreria per alberi molto ricca di funzionalità, senza pari. Trilium Notes non sarebbe lo stesso senza di essa. +* [CodeMirror](https://github.com/codemirror/CodeMirror) - editor di codice con supporto per un'enorme quantità di linguaggi. +* [jsPlumb](https://github.com/jsplumb/jsplumb) - libreria per la connettività visuale senza pari. Utilizzata per [mappe relazionali](https://github.com/zadam/trilium/wiki/Relation-map) e [mappe di collegamenti](https://github.com/zadam/trilium/wiki/Link-map). + +## 🤝 Supporto + +È possibile supportare Trilium attraverso Github Sponsors, [PayPal](https://paypal.me/za4am) o Bitcoin (bitcoin:bc1qv3svjn40v89mnkre5vyvs2xw6y8phaltl385d2). + +## 🔑 Licenza + +Questo programma è software libero: è possibile redistribuirlo e/o modificarlo nei termini della GNU Affero General Public License come pubblicata dalla Free Software Foundation, sia la versione 3 della Licenza, o (a propria scelta) qualsiasi versione successiva. diff --git a/README.ja.md b/README.ja.md index 621e3e0ff..f1c2e9c66 100644 --- a/README.ja.md +++ b/README.ja.md @@ -1,6 +1,6 @@ # Trilium Notes -[English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) +[English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md) Trilium Notes は、大規模な個人知識ベースの構築に焦点を当てた、階層型ノートアプリケーションです。概要は[スクリーンショット](https://github.com/zadam/trilium/wiki/Screenshot-tour)をご覧ください: diff --git a/README.md b/README.md index e1cb2808b..9868d1896 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,8 @@ Preliminary disccusions on the successor organization are taking place in [Trilium Next discussions](https://github.com/orgs/TriliumNext/discussions). -[![Join the chat at https://gitter.im/trilium-notes/Lobby](https://badges.gitter.im/trilium-notes/Lobby.svg)](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) +[![Join the chat at https://gitter.im/trilium-notes/Lobby](https://badges.gitter.im/trilium-notes/Lobby.svg)](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md) + Trilium Notes is a hierarchical note taking application with focus on building large personal knowledge bases. diff --git a/README.ru.md b/README.ru.md index f79341e79..4bf087deb 100644 --- a/README.ru.md +++ b/README.ru.md @@ -1,6 +1,6 @@ # Trilium Notes -[English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) +[English](https://github.com/zadam/trilium/blob/master/README.md) | [Chinese](https://github.com/zadam/trilium/blob/master/README-ZH_CN.md) | [Russian](https://github.com/zadam/trilium/blob/master/README.ru.md) | [Japanese](https://github.com/zadam/trilium/blob/master/README.ja.md) | [Italian](https://github.com/zadam/trilium/blob/master/README.it.md) [![Join the chat at https://gitter.im/trilium-notes/Lobby](https://badges.gitter.im/trilium-notes/Lobby.svg)](https://gitter.im/trilium-notes/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) Trilium Notes – это приложение для заметок с иерархической структурой, ориентированное на создание больших персональных баз знаний. Для быстрого ознакомления посмотрите [скриншот-тур](https://github.com/zadam/trilium/wiki/Screenshot-tour): diff --git a/bin/better-sqlite3/mac-arm64-better_sqlite3.node b/bin/better-sqlite3/mac-arm64-better_sqlite3.node new file mode 100644 index 000000000..9709dcd23 Binary files /dev/null and b/bin/better-sqlite3/mac-arm64-better_sqlite3.node differ diff --git a/bin/better-sqlite3/mac-better_sqlite3.node b/bin/better-sqlite3/mac-x64-better_sqlite3.node similarity index 100% rename from bin/better-sqlite3/mac-better_sqlite3.node rename to bin/better-sqlite3/mac-x64-better_sqlite3.node diff --git a/bin/build-mac-arm64.sh b/bin/build-mac-arm64.sh new file mode 100755 index 000000000..8d1f595a6 --- /dev/null +++ b/bin/build-mac-arm64.sh @@ -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 diff --git a/bin/build-mac-x64.sh b/bin/build-mac-x64.sh index 0e63c7fb2..8e560ba41 100755 --- a/bin/build-mac-x64.sh +++ b/bin/build-mac-x64.sh @@ -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.* diff --git a/bin/build.sh b/bin/build.sh index ff90c288d..6092b2011 100755 --- a/bin/build.sh +++ b/bin/build.sh @@ -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 diff --git a/bin/release.sh b/bin/release.sh index cdaa324d2..a6e193657 100755 --- a/bin/release.sh +++ b/bin/release.sh @@ -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" diff --git a/package-lock.json b/package-lock.json index c8c24644e..3f8ebc301 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "trilium", - "version": "0.63.3", + "version": "0.63.6", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "trilium", - "version": "0.63.3", + "version": "0.63.6", "hasInstallScript": true, "license": "AGPL-3.0-only", "dependencies": { diff --git a/package.json b/package.json index 648ea6974..15956516f 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "trilium", "productName": "Trilium Notes", "description": "Trilium Notes", - "version": "0.63.5", + "version": "0.63.6", "license": "AGPL-3.0-only", "main": "electron.js", "bin": { diff --git a/src/public/app/menus/tree_context_menu.js b/src/public/app/menus/tree_context_menu.js index feba6d69e..38c245251 100644 --- a/src/public/app/menus/tree_context_menu.js +++ b/src/public/app/menus/tree_context_menu.js @@ -50,10 +50,10 @@ export default class TreeContextMenu { { title: 'Open in a new tab Ctrl+Click', 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 ', 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 ', 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 ', command: "deleteNotes", uiIcon: "bx bx-trash", enabled: isNotRoot && !isHoisted && parentNotSearch }, diff --git a/src/public/app/services/note_types.js b/src/public/app/services/note_types.js index 6a44e03b3..40bc4a88b 100644 --- a/src/public/app/services/note_types.js +++ b/src/public/app/services/note_types.js @@ -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); diff --git a/src/public/app/widgets/type_widgets/canvas.js b/src/public/app/widgets/type_widgets/canvas.js index b0be9f845..08f7128e3 100644 --- a/src/public/app/widgets/type_widgets/canvas.js +++ b/src/public/app/widgets/type_widgets/canvas.js @@ -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 = `
@@ -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, diff --git a/src/public/app/widgets/type_widgets/relation_map.js b/src/public/app/widgets/type_widgets/relation_map.js index 6fea5eb6a..beb16ff07 100644 --- a/src/public/app/widgets/type_widgets/relation_map.js +++ b/src/public/app/widgets/type_widgets/relation_map.js @@ -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 diff --git a/src/routes/api/files.js b/src/routes/api/files.js index 72bd0ee11..ee4e5c884 100644 --- a/src/routes/api/files.js +++ b/src/routes/api/files.js @@ -154,12 +154,16 @@ function saveAttachmentToTmpDir(req) { return saveToTmpDir(fileName, content, 'attachments', attachment.attachmentId); } +const createdTemporaryFiles = new Set(); + function saveToTmpDir(fileName, content, entityType, entityId) { const tmpObj = tmp.fileSync({ postfix: fileName }); fs.writeSync(tmpObj.fd, content); fs.closeSync(tmpObj.fd); + createdTemporaryFiles.add(tmpObj.name); + log.info(`Saved temporary file ${tmpObj.name}`); if (utils.isElectron()) { @@ -183,6 +187,10 @@ function uploadModifiedFileToNote(req) { 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}'`); diff --git a/src/services/build.js b/src/services/build.js index aaae9be51..635923928 100644 --- a/src/services/build.js +++ b/src/services/build.js @@ -1 +1 @@ -module.exports = { buildDate:"2024-03-28T07:11:39+01:00", buildRevision: "399458b52f250b22be22d980a78de0b3390d7521" }; +module.exports = { buildDate:"2024-05-18T06:17:21+02:00", buildRevision: "c7f19e04fafc031910f6f9a45d2015387618e902" }; diff --git a/src/services/notes.js b/src/services/notes.js index 80a3b8e84..581811863 100644 --- a/src/services/notes.js +++ b/src/services/notes.js @@ -458,13 +458,18 @@ function findIncludeNoteLinks(content, foundLinks) { } function findRelationMapLinks(content, foundLinks) { - const obj = JSON.parse(content); + try { + const obj = JSON.parse(content); - for (const note of obj.notes) { - foundLinks.push({ - name: 'relationMapLink', - value: note.noteId - }); + for (const note of obj.notes) { + foundLinks.push({ + name: 'relationMapLink', + value: note.noteId + }); + } + } + catch (e) { + log.error("Could not scan for relation map links: " + e.message); } }