mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 11:39:01 +01:00 
			
		
		
		
	Merge branch 'feature/update_electron' into feature/update_bettersqlite3
This commit is contained in:
		
						commit
						043313c71a
					
				
							
								
								
									
										8
									
								
								.github/workflows/dev.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										8
									
								
								.github/workflows/dev.yml
									
									
									
									
										vendored
									
									
								
							| @ -1,6 +1,14 @@ | |||||||
| name: Dev | name: Dev | ||||||
| on: | on: | ||||||
|   push: |   push: | ||||||
|  |     branches-ignore: | ||||||
|  |       - 'develop' | ||||||
|  |       - 'feature/update**' | ||||||
|  | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-${{ github.ref }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   build_docker: |   build_docker: | ||||||
|     name: Build Docker image |     name: Build Docker image | ||||||
|  | |||||||
							
								
								
									
										51
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										51
									
								
								.github/workflows/main.yml
									
									
									
									
										vendored
									
									
								
							| @ -3,9 +3,16 @@ on: | |||||||
|   push: |   push: | ||||||
|     branches: |     branches: | ||||||
|       - 'develop' |       - 'develop' | ||||||
|  |       - 'feature/update*' | ||||||
|  | 
 | ||||||
|  | concurrency: | ||||||
|  |   group: ${{ github.workflow }}-${{ github.ref }} | ||||||
|  |   cancel-in-progress: true | ||||||
|  | 
 | ||||||
| env: | env: | ||||||
|   REGISTRY: ghcr.io |   REGISTRY: ghcr.io | ||||||
|   IMAGE_NAME: ${{ github.repository }} |   IMAGE_NAME: ${{ github.repository }} | ||||||
|  | 
 | ||||||
| jobs: | jobs: | ||||||
|   build_darwin-x64: |   build_darwin-x64: | ||||||
|     name: Build macOS x86_64 |     name: Build macOS x86_64 | ||||||
| @ -18,7 +25,9 @@ jobs: | |||||||
|           node-version: 20 |           node-version: 20 | ||||||
|           cache: "npm" |           cache: "npm" | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - run: ./bin/build-mac-x64.sh |       - run: | | ||||||
|  |           npm run update-build-info | ||||||
|  |           ./bin/build-mac-x64.sh | ||||||
|       - uses: actions/upload-artifact@v4 |       - uses: actions/upload-artifact@v4 | ||||||
|         with: |         with: | ||||||
|           name: trilium-mac-x64.zip |           name: trilium-mac-x64.zip | ||||||
| @ -34,7 +43,9 @@ jobs: | |||||||
|           node-version: 20 |           node-version: 20 | ||||||
|           cache: "npm" |           cache: "npm" | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - run: ./bin/build-mac-arm64.sh |       - run: | | ||||||
|  |           npm run update-build-info | ||||||
|  |           ./bin/build-mac-arm64.sh | ||||||
|       - uses: actions/upload-artifact@v4 |       - uses: actions/upload-artifact@v4 | ||||||
|         with: |         with: | ||||||
|           name: trilium-mac-arm64.zip |           name: trilium-mac-arm64.zip | ||||||
| @ -50,7 +61,9 @@ jobs: | |||||||
|           node-version: 20 |           node-version: 20 | ||||||
|           cache: "npm" |           cache: "npm" | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - run: ./bin/build-linux-x64.sh |       - run: | | ||||||
|  |           npm run update-build-info | ||||||
|  |           ./bin/build-linux-x64.sh | ||||||
|       - uses: actions/upload-artifact@v4 |       - uses: actions/upload-artifact@v4 | ||||||
|         with: |         with: | ||||||
|           name: trilium-linux-x64.tar.xz |           name: trilium-linux-x64.tar.xz | ||||||
| @ -70,7 +83,9 @@ jobs: | |||||||
|           node-version: 20 |           node-version: 20 | ||||||
|           cache: "npm" |           cache: "npm" | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - run: ./bin/build-server.sh |       - run: | | ||||||
|  |           npm run update-build-info | ||||||
|  |           ./bin/build-server.sh | ||||||
|       - uses: actions/upload-artifact@v4 |       - uses: actions/upload-artifact@v4 | ||||||
|         with: |         with: | ||||||
|           name: trilium-linux-x64-server.tar.xz |           name: trilium-linux-x64-server.tar.xz | ||||||
| @ -93,11 +108,33 @@ jobs: | |||||||
|           node-version: 20 |           node-version: 20 | ||||||
|           cache: "npm" |           cache: "npm" | ||||||
|       - run: npm ci |       - run: npm ci | ||||||
|       - run: ./bin/build-win-x64.sh |       - run: | | ||||||
|  |           npm run update-build-info | ||||||
|  |           ./bin/build-win-x64.sh DONTPACK | ||||||
|       - uses: actions/upload-artifact@v4 |       - uses: actions/upload-artifact@v4 | ||||||
|         with: |         with: | ||||||
|           name: trilium-windows-x64.zip |           name: trilium-windows-x64 | ||||||
|           path: dist/trilium-windows-x64-*.zip |           path: dist/trilium-windows-x64 | ||||||
|  |   build_windows-installer: | ||||||
|  |     name: Build Windows x86_64 (Setup) | ||||||
|  |     runs-on: windows-latest | ||||||
|  |     steps: | ||||||
|  |       - uses: actions/checkout@v4 | ||||||
|  |       - name: Set up node & dependencies | ||||||
|  |         uses: actions/setup-node@v4 | ||||||
|  |         with: | ||||||
|  |           node-version: 20 | ||||||
|  |           cache: "npm" | ||||||
|  |       - run: npm ci | ||||||
|  |       - name: Run installer build | ||||||
|  |         run: | | ||||||
|  |           npm run update-build-info | ||||||
|  |           npm run make-electron | ||||||
|  |       - name: Publish installer artifact | ||||||
|  |         uses: actions/upload-artifact@v4 | ||||||
|  |         with: | ||||||
|  |           name: TriliumNext Notes for Windows (Setup) | ||||||
|  |           path: out/make/squirrel.windows/x64/*.exe | ||||||
|   build_docker: |   build_docker: | ||||||
|     name: Build Docker image |     name: Build Docker image | ||||||
|     runs-on: ubuntu-latest |     runs-on: ubuntu-latest | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -15,3 +15,5 @@ data/ | |||||||
| data-test/ | data-test/ | ||||||
| tmp/ | tmp/ | ||||||
| .eslintcache | .eslintcache | ||||||
|  | 
 | ||||||
|  | out/ | ||||||
| @ -35,7 +35,7 @@ echo "Packaging linux x64 electron build" | |||||||
| BUILD_DIR=./dist/trilium-linux-x64 | BUILD_DIR=./dist/trilium-linux-x64 | ||||||
| rm -rf "$BUILD_DIR" | rm -rf "$BUILD_DIR" | ||||||
| 
 | 
 | ||||||
| mv "./dist/Trilium Notes-linux-x64" "$BUILD_DIR" | mv "./dist/TriliumNext Notes-linux-x64" "$BUILD_DIR" | ||||||
| 
 | 
 | ||||||
| cp images/app-icons/png/128x128.png "$BUILD_DIR"/icon.png | cp images/app-icons/png/128x128.png "$BUILD_DIR"/icon.png | ||||||
| cp bin/tpl/anonymize-database.sql "$BUILD_DIR"/ | cp bin/tpl/anonymize-database.sql "$BUILD_DIR"/ | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ BUILD_DIR=./dist/trilium-mac-arm64 | |||||||
| rm -rf $BUILD_DIR | rm -rf $BUILD_DIR | ||||||
| 
 | 
 | ||||||
| # Mac build has by default useless directory level | # Mac build has by default useless directory level | ||||||
| mv "./dist/Trilium Notes-darwin-arm64" $BUILD_DIR | mv "./dist/TriliumNext Notes-darwin-arm64" $BUILD_DIR | ||||||
| 
 | 
 | ||||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -21,7 +21,7 @@ BUILD_DIR=./dist/trilium-mac-x64 | |||||||
| rm -rf $BUILD_DIR | rm -rf $BUILD_DIR | ||||||
| 
 | 
 | ||||||
| # Mac build has by default useless directory level | # Mac build has by default useless directory level | ||||||
| mv "./dist/Trilium Notes-darwin-x64" $BUILD_DIR | mv "./dist/TriliumNext Notes-darwin-x64" $BUILD_DIR | ||||||
| 
 | 
 | ||||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -25,7 +25,7 @@ echo "Packaging windows x64 electron build" | |||||||
| BUILD_DIR=./dist/trilium-windows-x64 | BUILD_DIR=./dist/trilium-windows-x64 | ||||||
| rm -rf $BUILD_DIR | rm -rf $BUILD_DIR | ||||||
| 
 | 
 | ||||||
| mv "./dist/Trilium Notes-win32-x64" $BUILD_DIR | mv "./dist/TriliumNext Notes-win32-x64" $BUILD_DIR | ||||||
| 
 | 
 | ||||||
| cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | cp bin/tpl/anonymize-database.sql $BUILD_DIR/ | ||||||
| 
 | 
 | ||||||
| @ -34,9 +34,11 @@ rm -rf $BUILD_DIR/dump-db/node_modules | |||||||
| 
 | 
 | ||||||
| cp bin/tpl/trilium-{portable,no-cert-check,safe-mode}.bat $BUILD_DIR/ | cp bin/tpl/trilium-{portable,no-cert-check,safe-mode}.bat $BUILD_DIR/ | ||||||
| 
 | 
 | ||||||
| echo "Zipping windows x64 electron distribution..." | if [ "$1" != "DONTPACK" ] | ||||||
| VERSION=`jq -r ".version" package.json` | then | ||||||
|  |   echo "Zipping windows x64 electron distribution..." | ||||||
|  |   VERSION=`jq -r ".version" package.json` | ||||||
| 
 | 
 | ||||||
| cd dist |   cd dist | ||||||
| 
 |   zip -r9 trilium-windows-x64-${VERSION}.zip trilium-windows-x64 | ||||||
| zip -r9 trilium-windows-x64-${VERSION}.zip trilium-windows-x64 | fi | ||||||
| @ -35,27 +35,36 @@ for f in 'package.json' 'package-lock.json' 'README.md' 'LICENSE' 'config-sample | |||||||
|     cp "$f" "$DIR"/ |     cp "$f" "$DIR"/ | ||||||
| done | done | ||||||
| 
 | 
 | ||||||
|  | # Patch package.json main | ||||||
|  | sed -i 's/.\/dist\/electron.js/electron.js/g' "$DIR/package.json" | ||||||
|  | 
 | ||||||
| script_dir=$(realpath $(dirname $0)) | script_dir=$(realpath $(dirname $0)) | ||||||
| cp -Rv "$script_dir/../build/src" "$DIR" | cp -R "$script_dir/../build/src" "$DIR" | ||||||
| cp "$script_dir/../build/electron.js" "$DIR" | cp "$script_dir/../build/electron.js" "$DIR" | ||||||
| 
 | 
 | ||||||
| # run in subshell (so we return to original dir) | # run in subshell (so we return to original dir) | ||||||
| (cd $DIR && npm install --only=prod) | (cd $DIR && npm install --omit=dev) | ||||||
| (cd $DIR && npm run switch-electron) |  | ||||||
| 
 | 
 | ||||||
| if [[ -d "$DIR"/node_modules ]]; then | if [[ -d "$DIR"/node_modules ]]; then | ||||||
| # cleanup of useless files in dependencies |     # cleanup of useless files in dependencies | ||||||
|     for d in 'image-q/demo' 'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' '@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do |     for d in 'image-q/demo' \ | ||||||
|         [[ -e "$DIR"/node_modules/"$d" ]] && rm -rv "$DIR"/node_modules/"$d" |         '@excalidraw/excalidraw/dist/excalidraw-assets-dev' '@excalidraw/excalidraw/dist/excalidraw.development.js' '@excalidraw/excalidraw/dist/excalidraw-with-preact.development.js' \ | ||||||
|  |         'mermaid/dist/mermaid.js' \ | ||||||
|  |         'boxicons/svg' 'boxicons/node_modules/react'/* \ | ||||||
|  |         'better-sqlite3/Release' 'better-sqlite3/deps/sqlite3.tar.gz' 'better-sqlite3/deps/sqlite3' \ | ||||||
|  |         '@jimp/plugin-print/fonts' 'jimp/browser' 'jimp/fonts'; do | ||||||
|  |         [[ -e "$DIR"/node_modules/"$d" ]] && rm -r "$DIR"/node_modules/"$d" | ||||||
|     done |     done | ||||||
| 
 | 
 | ||||||
| # delete all tests (there are often large images as test file for jimp etc.) |     # delete all tests (there are often large images as test file for jimp etc.) | ||||||
|     for d in 'test' 'docs' 'demo'; do |     for d in 'test' 'docs' 'demo' 'example'; do | ||||||
|         find "$DIR"/node_modules -name "$d" -exec rm -rf {} \; |         find "$DIR"/node_modules -name "$d" -exec rm -rf {} + | ||||||
|     done |     done | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| find $DIR/libraries -name "*.map" -type f -delete | find $DIR/libraries -name "*.map" -type f -delete | ||||||
|  | find $DIR/node_modules -name "*.map" -type f -delete | ||||||
|  | find $DIR -name "*.ts" -type f -delete | ||||||
| 
 | 
 | ||||||
| d="$DIR"/src/public | d="$DIR"/src/public | ||||||
| [[ -d "$d"/app-dist ]] || mkdir -pv "$d"/app-dist | [[ -d "$d"/app-dist ]] || mkdir -pv "$d"/app-dist | ||||||
|  | |||||||
							
								
								
									
										2
									
								
								bin/docs/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								bin/docs/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							| @ -0,0 +1,2 @@ | |||||||
|  | output | ||||||
|  | .env | ||||||
| @ -32,7 +32,7 @@ mv package.json.tmp package.json | |||||||
| 
 | 
 | ||||||
| git add package.json | git add package.json | ||||||
| 
 | 
 | ||||||
| echo 'export = { buildDate:"'`date --iso-8601=seconds`'", buildRevision: "'`git log -1 --format="%H"`'" };' > src/services/build.ts | npm run update-build-info | ||||||
| 
 | 
 | ||||||
| git add src/services/build.ts | git add src/services/build.ts | ||||||
| 
 | 
 | ||||||
| @ -65,7 +65,9 @@ if [[ $TAG == *"beta"* ]]; then | |||||||
|   EXTRA=--prerelease |   EXTRA=--prerelease | ||||||
| fi | fi | ||||||
| 
 | 
 | ||||||
| echo "$GITHUB_CLI_AUTH_TOKEN" | gh auth login --with-token | if [ ! -z "$GITHUB_CLI_AUTH_TOKEN" ]; then | ||||||
|  |   echo "$GITHUB_CLI_AUTH_TOKEN" | gh auth login --with-token | ||||||
|  | fi | ||||||
| 
 | 
 | ||||||
| gh release create "$TAG" \ | gh release create "$TAG" \ | ||||||
|     --title "$TAG release" \ |     --title "$TAG release" \ | ||||||
|  | |||||||
							
								
								
									
										25
									
								
								bin/update-build-info.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										25
									
								
								bin/update-build-info.ts
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,25 @@ | |||||||
|  | import child_process from "child_process"; | ||||||
|  | import fs from "fs"; | ||||||
|  | 
 | ||||||
|  | function getBuildDate() { | ||||||
|  |     const now = new Date(); | ||||||
|  |     now.setMilliseconds(0); | ||||||
|  |     return now | ||||||
|  |         .toISOString() | ||||||
|  |         .replace(".000", ""); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | function getGitRevision() { | ||||||
|  |     return child_process.execSync('git log -1 --format="%H"') | ||||||
|  |         .toString("utf-8") | ||||||
|  |         .trimEnd(); | ||||||
|  | } | ||||||
|  | 
 | ||||||
|  | const output = `\ | ||||||
|  | export = { | ||||||
|  |     buildDate: "${getBuildDate()}", | ||||||
|  |     buildRevision: "${getGitRevision()}" | ||||||
|  | }; | ||||||
|  | `;
 | ||||||
|  | 
 | ||||||
|  | fs.writeFileSync("src/services/build.ts", output); | ||||||
| @ -1,4 +0,0 @@ | |||||||
| SHARE_PROTOCOL=https |  | ||||||
| SHARE_HOST=notes.eliandoran.me |  | ||||||
| ROOT_NOTE_ID=4yYHqKbLovVX |  | ||||||
| SHARE_URL=https://notes.eliandoran.me/share/4yYHqKbLovVX |  | ||||||
							
								
								
									
										1
									
								
								docs-new/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1
									
								
								docs-new/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -1 +0,0 @@ | |||||||
| output |  | ||||||
| @ -6,6 +6,11 @@ import appIconService = require("./src/services/app_icon"); | |||||||
| import windowService = require("./src/services/window"); | import windowService = require("./src/services/window"); | ||||||
| import tray = require("./src/services/tray"); | import tray = require("./src/services/tray"); | ||||||
| 
 | 
 | ||||||
|  | // Prevent Trilium starting twice on first install and on uninstall for the Windows installer.
 | ||||||
|  | if (require('electron-squirrel-startup')) { | ||||||
|  |   process.exit(0); | ||||||
|  | } | ||||||
|  | 
 | ||||||
| // Adds debug features like hotkeys for triggering dev tools and reload
 | // Adds debug features like hotkeys for triggering dev tools and reload
 | ||||||
| require("electron-debug")(); | require("electron-debug")(); | ||||||
| 
 | 
 | ||||||
|  | |||||||
							
								
								
									
										23
									
								
								forge.config.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								forge.config.js
									
									
									
									
									
										Normal file
									
								
							| @ -0,0 +1,23 @@ | |||||||
|  | module.exports = { | ||||||
|  |   packagerConfig: { | ||||||
|  |     asar: true, | ||||||
|  |     // icon will break once we add .dmg support, since the .ico & .icns have to be in same dir (see https://www.electronforge.io/guides/create-and-add-icons#windows-and-macos)
 | ||||||
|  |     icon: "./images/app-icons/win/icon" | ||||||
|  |   }, | ||||||
|  |   rebuildConfig: {}, | ||||||
|  |   makers: [ | ||||||
|  |     { | ||||||
|  |       name: '@electron-forge/maker-squirrel', | ||||||
|  |       config: { | ||||||
|  |         setupIcon: "./images/app-icons/win/icon.ico", | ||||||
|  |         loadingGif: "./images/app-icons/win/setup-banner.gif" | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   ], | ||||||
|  |   plugins: [ | ||||||
|  |     { | ||||||
|  |       name: '@electron-forge/plugin-auto-unpack-natives', | ||||||
|  |       config: {}, | ||||||
|  |     }, | ||||||
|  |   ], | ||||||
|  | }; | ||||||
							
								
								
									
										
											BIN
										
									
								
								images/app-icons/win/setup-banner.gif
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								images/app-icons/win/setup-banner.gif
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							| After Width: | Height: | Size: 8.5 KiB | 
							
								
								
									
										
											BIN
										
									
								
								images/app-icons/win/setup-banner.xcf
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										
											BIN
										
									
								
								images/app-icons/win/setup-banner.xcf
									
									
									
									
									
										Normal file
									
								
							
										
											Binary file not shown.
										
									
								
							
							
								
								
									
										13755
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										13755
									
								
								package-lock.json
									
									
									
										generated
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							
							
								
								
									
										78
									
								
								package.json
									
									
									
									
									
								
							
							
						
						
									
										78
									
								
								package.json
									
									
									
									
									
								
							| @ -1,23 +1,29 @@ | |||||||
| { | { | ||||||
|   "name": "trilium", |   "name": "trilium", | ||||||
|   "productName": "Trilium Notes", |   "productName": "TriliumNext Notes", | ||||||
|   "description": "Trilium Notes", |   "description": "Build your personal knowledge base with TriliumNext Notes", | ||||||
|   "version": "0.90.0-beta", |   "version": "0.90.1-beta", | ||||||
|   "license": "AGPL-3.0-only", |   "license": "AGPL-3.0-only", | ||||||
|   "main": "electron.js", |   "main": "./dist/electron.js", | ||||||
|  |   "author": { | ||||||
|  |     "name": "TriliumNext Notes Teams", | ||||||
|  |     "email": "contact@eliandoran.me", | ||||||
|  |     "url": "https://github.com/TriliumNext/Notes" | ||||||
|  |   }, | ||||||
|  |   "copyright": "", | ||||||
|   "bin": { |   "bin": { | ||||||
|     "trilium": "src/www.js" |     "trilium": "src/www.js" | ||||||
|   }, |   }, | ||||||
|   "repository": { |   "repository": { | ||||||
|     "type": "git", |     "type": "git", | ||||||
|     "url": "https://github.com/zadam/trilium.git" |     "url": "https://github.com/TriliumNext/Notes.git" | ||||||
|   }, |   }, | ||||||
|   "scripts": { |   "scripts": { | ||||||
|     "start-server": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", |     "start-server": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", | ||||||
|     "start-server-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", |     "start-server-no-dir": "cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", | ||||||
|     "qstart-server": "npm run qswitch-server && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", |     "qstart-server": "npm run qswitch-server && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_ENV=dev TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 nodemon src/www.ts", | ||||||
|     "start-electron": "rimraf ./dist && tsc && ts-node ./bin/copy-dist.ts && cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron ./dist/electron.js --inspect=5858 .", |     "start-electron": "npm run prepare-dist && cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron ./dist/electron.js --inspect=5858 .", | ||||||
|     "start-electron-no-dir": "rimraf ./dist && tsc && ts-node ./bin/copy-dist.ts && cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev electron ./dist/electron.js --inspect=5858 .", |     "start-electron-no-dir": "npm run prepare-dist && cross-env TRILIUM_SAFE_MODE=1 TRILIUM_ENV=dev electron ./dist/electron.js --inspect=5858 .", | ||||||
|     "qstart-electron": "npm run qswitch-electron && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron --inspect=5858 .", |     "qstart-electron": "npm run qswitch-electron && TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev electron --inspect=5858 .", | ||||||
|     "start-test-server": "npm run qswitch-server; rimraf ./data-test; cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data-test TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev TRILIUM_PORT=9999 ts-node src/www.ts", |     "start-test-server": "npm run qswitch-server; rimraf ./data-test; cross-env TRILIUM_SAFE_MODE=1 TRILIUM_DATA_DIR=./data-test TRILIUM_SYNC_SERVER_HOST=http://tsyncserver:4000 TRILIUM_ENV=dev TRILIUM_PORT=9999 ts-node src/www.ts", | ||||||
|     "switch-server": "rimraf ./node_modules/better-sqlite3 && npm install", |     "switch-server": "rimraf ./node_modules/better-sqlite3 && npm install", | ||||||
| @ -31,15 +37,19 @@ | |||||||
|     "test-jasmine": "cross-env TRILIUM_DATA_DIR=./data-test ts-node ./node_modules/jasmine/bin/jasmine", |     "test-jasmine": "cross-env TRILIUM_DATA_DIR=./data-test ts-node ./node_modules/jasmine/bin/jasmine", | ||||||
|     "test-es6": "ts-node -r esm spec-es6/attribute_parser.spec.ts", |     "test-es6": "ts-node -r esm spec-es6/attribute_parser.spec.ts", | ||||||
|     "test": "npm run test-jasmine && npm run test-es6", |     "test": "npm run test-jasmine && npm run test-es6", | ||||||
|     "postinstall": "rimraf ./node_modules/canvas" |     "start-electron-forge": "npm run prepare-dist && electron-forge start", | ||||||
|  |     "make-electron": "npm run webpack && npm run prepare-dist && electron-forge make", | ||||||
|  |     "package-electron": "electron-forge package", | ||||||
|  |     "prepare-dist": "rimraf ./dist && tsc && ts-node ./bin/copy-dist.ts", | ||||||
|  |     "update-build-info": "ts-node bin/update-build-info.ts" | ||||||
|   }, |   }, | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@braintree/sanitize-url": "6.0.4", |     "@braintree/sanitize-url": "^7.1.0", | ||||||
|     "@electron/remote": "2.1.2", |     "@electron/remote": "2.1.2", | ||||||
|     "@excalidraw/excalidraw": "^0.17.6", |     "@excalidraw/excalidraw": "^0.17.6", | ||||||
|     "archiver": "7.0.0", |     "archiver": "^7.0.1", | ||||||
|     "async-mutex": "0.4.1", |     "async-mutex": "^0.5.0", | ||||||
|     "axios": "1.6.7", |     "axios": "^1.7.2", | ||||||
|     "better-sqlite3": "^11.1.2", |     "better-sqlite3": "^11.1.2", | ||||||
|     "boxicons": "2.1.4", |     "boxicons": "2.1.4", | ||||||
|     "chokidar": "3.6.0", |     "chokidar": "3.6.0", | ||||||
| @ -47,17 +57,18 @@ | |||||||
|     "compression": "1.7.4", |     "compression": "1.7.4", | ||||||
|     "cookie-parser": "1.4.6", |     "cookie-parser": "1.4.6", | ||||||
|     "csurf": "1.11.0", |     "csurf": "1.11.0", | ||||||
|     "dayjs": "1.11.10", |     "dayjs": "^1.11.12", | ||||||
|     "dayjs-plugin-utc": "0.1.2", |     "dayjs-plugin-utc": "0.1.2", | ||||||
|     "debounce": "1.2.1", |     "debounce": "^2.1.0", | ||||||
|     "ejs": "3.1.9", |     "ejs": "^3.1.10", | ||||||
|     "electron-debug": "3.2.0", |     "electron-debug": "3.2.0", | ||||||
|     "electron-dl": "3.5.2", |     "electron-dl": "3.5.2", | ||||||
|  |     "electron-squirrel-startup": "^1.0.0", | ||||||
|     "electron-window-state": "5.0.3", |     "electron-window-state": "5.0.3", | ||||||
|     "escape-html": "1.0.3", |     "escape-html": "1.0.3", | ||||||
|     "express": "4.18.3", |     "express": "^4.19.2", | ||||||
|     "express-partial-content": "1.0.2", |     "express-partial-content": "1.0.2", | ||||||
|     "express-rate-limit": "7.2.0", |     "express-rate-limit": "^7.3.1", | ||||||
|     "express-session": "1.18.0", |     "express-session": "1.18.0", | ||||||
|     "force-graph": "1.43.5", |     "force-graph": "1.43.5", | ||||||
|     "fs-extra": "11.2.0", |     "fs-extra": "11.2.0", | ||||||
| @ -65,36 +76,34 @@ | |||||||
|     "html": "1.0.0", |     "html": "1.0.0", | ||||||
|     "html2plaintext": "2.1.4", |     "html2plaintext": "2.1.4", | ||||||
|     "http-proxy-agent": "7.0.2", |     "http-proxy-agent": "7.0.2", | ||||||
|     "https-proxy-agent": "7.0.4", |     "https-proxy-agent": "^7.0.5", | ||||||
|     "image-type": "4.1.0", |     "image-type": "4.1.0", | ||||||
|     "ini": "3.0.1", |     "ini": "^4.1.3", | ||||||
|     "is-animated": "2.0.2", |     "is-animated": "2.0.2", | ||||||
|     "is-svg": "4.3.2", |     "is-svg": "4.3.2", | ||||||
|     "jimp": "0.22.12", |     "jimp": "0.22.12", | ||||||
|     "joplin-turndown-plugin-gfm": "1.0.12", |     "joplin-turndown-plugin-gfm": "1.0.12", | ||||||
|     "jquery": "3.7.1", |     "jquery": "3.7.1", | ||||||
|     "jquery-hotkeys": "0.2.2", |     "jquery-hotkeys": "0.2.2", | ||||||
|     "jsdom": "24.0.0", |     "jsdom": "^24.1.0", | ||||||
|     "katex": "^0.16.11", |     "katex": "^0.16.11", | ||||||
|     "marked": "12.0.0", |     "marked": "^13.0.2", | ||||||
|     "mermaid": "^10.9.1", |     "mermaid": "^10.9.1", | ||||||
|     "mime-types": "2.1.35", |     "mime-types": "2.1.35", | ||||||
|     "multer": "1.4.5-lts.1", |     "multer": "1.4.5-lts.1", | ||||||
|     "node-abi": "^3.65.0", |     "node-abi": "^3.65.0", | ||||||
|     "normalize-strings": "1.1.1", |     "normalize-strings": "1.1.1", | ||||||
|     "open": "8.4.1", |  | ||||||
|     "panzoom": "9.4.3", |     "panzoom": "9.4.3", | ||||||
|     "print-this": "2.0.0", |     "print-this": "2.0.0", | ||||||
|     "rand-token": "1.0.1", |     "rand-token": "1.0.1", | ||||||
|     "react": "^18.3.1", |     "react": "^18.3.1", | ||||||
|     "react-dom": "^18.3.1", |     "react-dom": "^18.3.1", | ||||||
|     "request": "2.88.2", |     "request": "2.88.2", | ||||||
|     "rimraf": "5.0.5", |  | ||||||
|     "safe-compare": "1.1.4", |     "safe-compare": "1.1.4", | ||||||
|     "sanitize-filename": "1.6.3", |     "sanitize-filename": "1.6.3", | ||||||
|     "sanitize-html": "2.12.1", |     "sanitize-html": "^2.13.0", | ||||||
|     "sax": "1.3.0", |     "sax": "^1.4.1", | ||||||
|     "semver": "7.6.0", |     "semver": "^7.6.3", | ||||||
|     "serve-favicon": "2.5.0", |     "serve-favicon": "2.5.0", | ||||||
|     "session-file-store": "1.5.0", |     "session-file-store": "1.5.0", | ||||||
|     "split.js": "1.6.5", |     "split.js": "1.6.5", | ||||||
| @ -102,13 +111,16 @@ | |||||||
|     "striptags": "3.2.0", |     "striptags": "3.2.0", | ||||||
|     "tmp": "0.2.3", |     "tmp": "0.2.3", | ||||||
|     "tree-kill": "1.2.2", |     "tree-kill": "1.2.2", | ||||||
|     "turndown": "7.1.2", |     "turndown": "^7.2.0", | ||||||
|     "unescape": "1.0.1", |     "unescape": "1.0.1", | ||||||
|     "ws": "8.16.0", |     "ws": "^8.18.0", | ||||||
|     "xml2js": "0.6.2", |     "xml2js": "0.6.2", | ||||||
|     "yauzl": "3.1.2" |     "yauzl": "^3.1.3" | ||||||
|   }, |   }, | ||||||
|   "devDependencies": { |   "devDependencies": { | ||||||
|  |     "@electron-forge/cli": "^6.4.2", | ||||||
|  |     "@electron-forge/maker-squirrel": "^6.4.2", | ||||||
|  |     "@electron-forge/plugin-auto-unpack-natives": "^6.4.2", | ||||||
|     "@types/archiver": "^6.0.2", |     "@types/archiver": "^6.0.2", | ||||||
|     "@types/better-sqlite3": "^7.6.9", |     "@types/better-sqlite3": "^7.6.9", | ||||||
|     "@types/cls-hooked": "^4.3.8", |     "@types/cls-hooked": "^4.3.8", | ||||||
| @ -138,19 +150,19 @@ | |||||||
|     "@types/xml2js": "^0.4.14", |     "@types/xml2js": "^0.4.14", | ||||||
|     "cross-env": "7.0.3", |     "cross-env": "7.0.3", | ||||||
|     "electron": "^31.2.1", |     "electron": "^31.2.1", | ||||||
|     "electron-builder": "24.13.3", |  | ||||||
|     "electron-packager": "17.1.2", |     "electron-packager": "17.1.2", | ||||||
|     "electron-rebuild": "3.2.9", |     "electron-rebuild": "3.2.9", | ||||||
|     "esm": "3.2.25", |     "esm": "3.2.25", | ||||||
|     "jasmine": "5.1.0", |     "jasmine": "5.1.0", | ||||||
|     "jsdoc": "4.0.2", |     "jsdoc": "^4.0.3", | ||||||
|     "lorem-ipsum": "2.0.8", |     "lorem-ipsum": "2.0.8", | ||||||
|     "nodemon": "3.1.0", |     "nodemon": "^3.1.4", | ||||||
|     "rcedit": "4.0.1", |     "rcedit": "4.0.1", | ||||||
|  |     "rimraf": "^6.0.1", | ||||||
|     "ts-node": "^10.9.2", |     "ts-node": "^10.9.2", | ||||||
|     "tslib": "^2.6.2", |     "tslib": "^2.6.2", | ||||||
|     "typescript": "^5.3.3", |     "typescript": "^5.3.3", | ||||||
|     "webpack": "5.90.3", |     "webpack": "^5.93.0", | ||||||
|     "webpack-cli": "5.1.4" |     "webpack-cli": "5.1.4" | ||||||
|   }, |   }, | ||||||
|   "optionalDependencies": { |   "optionalDependencies": { | ||||||
|  | |||||||
| @ -5,7 +5,6 @@ import { JSDOM } from "jsdom"; | |||||||
| import BNote = require('../../becca/entities/bnote'); | import BNote = require('../../becca/entities/bnote'); | ||||||
| import BAttribute = require('../../becca/entities/battribute'); | import BAttribute = require('../../becca/entities/battribute'); | ||||||
| import { Request } from 'express'; | import { Request } from 'express'; | ||||||
| import ValidationError = require('../../errors/validation_error'); |  | ||||||
| 
 | 
 | ||||||
| function buildDescendantCountMap(noteIdsToCount: string[]) { | function buildDescendantCountMap(noteIdsToCount: string[]) { | ||||||
|     if (!Array.isArray(noteIdsToCount)) { |     if (!Array.isArray(noteIdsToCount)) { | ||||||
|  | |||||||
| @ -1 +1,4 @@ | |||||||
| export = { buildDate:"2024-07-14T22:32:45+03:00", buildRevision: "b811f3d399aed7e740bd8e92ef7edc7d15de7038" }; | export = { | ||||||
|  |     buildDate: "2024-07-21T10:25:01Z", | ||||||
|  |     buildRevision: "715a952148ae6e83fda0886f5ceec8dc329972ae" | ||||||
|  | }; | ||||||
|  | |||||||
| @ -41,15 +41,13 @@ function updateEntities(entityChanges: EntityChangeRecord[], instanceId: string) | |||||||
|             atLeastOnePullApplied = true; |             atLeastOnePullApplied = true; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         if (entity) { |  | ||||||
|         updateEntity(entityChange, entity, instanceId, updateContext); |         updateEntity(entityChange, entity, instanceId, updateContext); | ||||||
|     } |     } | ||||||
|     } |  | ||||||
| 
 | 
 | ||||||
|     logUpdateContext(updateContext); |     logUpdateContext(updateContext); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function updateEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow, instanceId: string, updateContext: UpdateContext) { | function updateEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow | undefined, instanceId: string, updateContext: UpdateContext) { | ||||||
|     if (!remoteEntityRow && remoteEC.entityName === 'options') { |     if (!remoteEntityRow && remoteEC.entityName === 'options') { | ||||||
|         return; // can be undefined for options with isSynced=false
 |         return; // can be undefined for options with isSynced=false
 | ||||||
|     } |     } | ||||||
| @ -74,7 +72,7 @@ function updateEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow, instan | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function updateNormalEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow, instanceId: string, updateContext: UpdateContext) { | function updateNormalEntity(remoteEC: EntityChange, remoteEntityRow: EntityRow | undefined, instanceId: string, updateContext: UpdateContext) { | ||||||
|     const localEC = sql.getRow<EntityChange | undefined>(`SELECT * FROM entity_changes WHERE entityName = ? AND entityId = ?`, [remoteEC.entityName, remoteEC.entityId]); |     const localEC = sql.getRow<EntityChange | undefined>(`SELECT * FROM entity_changes WHERE entityName = ? AND entityId = ?`, [remoteEC.entityName, remoteEC.entityId]); | ||||||
|     const localECIsOlderOrSameAsRemote = ( |     const localECIsOlderOrSameAsRemote = ( | ||||||
|             localEC && localEC.utcDateChanged && remoteEC.utcDateChanged && |             localEC && localEC.utcDateChanged && remoteEC.utcDateChanged && | ||||||
| @ -139,7 +137,7 @@ function preProcessContent(remoteEC: EntityChange, remoteEntityRow: EntityRow) { | |||||||
|     } |     } | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| function updateNoteReordering(remoteEC: EntityChange, remoteEntityRow: EntityRow, instanceId: string) { | function updateNoteReordering(remoteEC: EntityChange, remoteEntityRow: EntityRow | undefined, instanceId: string) { | ||||||
|     if (!remoteEntityRow) { |     if (!remoteEntityRow) { | ||||||
|         throw new Error(`Empty note_reordering body for: ${JSON.stringify(remoteEC)}`); |         throw new Error(`Empty note_reordering body for: ${JSON.stringify(remoteEC)}`); | ||||||
|     } |     } | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 Elian Doran
						Elian Doran