diff --git a/.gitpod.yml b/.gitpod.yml index eaadcb1e8..40dcc1b95 100644 --- a/.gitpod.yml +++ b/.gitpod.yml @@ -2,7 +2,7 @@ image: file: .gitpod.dockerfile tasks: - - before: nvm install 14.18.1 && nvm use 14.18.1 + - before: nvm install 16.13.0 && nvm use 16.13.0 init: npm install command: npm run start-server diff --git a/Dockerfile b/Dockerfile index 7961fda95..0258e6c6d 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,4 +1,4 @@ -FROM node:14.18.1-alpine +FROM node:16.13.0-alpine # Create app directory WORKDIR /usr/src/app diff --git a/bin/build-server.sh b/bin/build-server.sh index 6aefca983..437c87c5a 100755 --- a/bin/build-server.sh +++ b/bin/build-server.sh @@ -1,7 +1,7 @@ #!/usr/bin/env bash PKG_DIR=dist/trilium-linux-x64-server -NODE_VERSION=14.18.1 +NODE_VERSION=16.13.0 if [ "$1" != "DONTCOPY" ] then diff --git a/bin/copy-trilium.sh b/bin/copy-trilium.sh index b68c0cf1c..975917b35 100755 --- a/bin/copy-trilium.sh +++ b/bin/copy-trilium.sh @@ -5,7 +5,7 @@ if [[ $# -eq 0 ]] ; then exit 1 fi -n exec 14.18.1 npm run webpack +n exec 16.13.0 npm run webpack DIR=$1 @@ -27,7 +27,7 @@ cp -r electron.js $DIR/ cp webpack-* $DIR/ # run in subshell (so we return to original dir) -(cd $DIR && n exec 14.18.1 npm install --only=prod) +(cd $DIR && n exec 16.13.0 npm install --only=prod) # cleanup of useless files in dependencies rm -r $DIR/node_modules/image-q/demo diff --git a/package-lock.json b/package-lock.json index d3fac698a..18042ea05 100644 --- a/package-lock.json +++ b/package-lock.json @@ -98,6 +98,12 @@ } } }, + "@electron/remote": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/@electron/remote/-/remote-2.0.1.tgz", + "integrity": "sha512-bGX4/yB2bPZwXm1DsxgoABgH0Cz7oFtXJgkerB8VrStYdTyvhGAULzNLRn9rVmeAuC3VUDXaXpZIlZAZHpsLIA==", + "dev": true + }, "@electron/universal": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/@electron/universal/-/universal-1.0.5.tgz", @@ -610,9 +616,9 @@ } }, "@types/eslint": { - "version": "7.28.1", - "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.28.1.tgz", - "integrity": "sha512-XhZKznR3i/W5dXqUhgU9fFdJekufbeBd5DALmkuXoeFcjbQcPk+2cL+WLHf6Q81HWAnM2vrslIHpGVyCAviRwg==", + "version": "7.29.0", + "resolved": "https://registry.npmjs.org/@types/eslint/-/eslint-7.29.0.tgz", + "integrity": "sha512-VNcvioYDH8/FxaeTKkM4/TiTwt6pBV9E3OfGmvaw8tPl0rrHCJ4Ll15HRT+pMiFAf/MLQvAzC+6RzUMEL9Ceng==", "dev": true, "requires": { "@types/estree": "*", @@ -1375,9 +1381,8 @@ } }, "better-sqlite3": { - "version": "7.4.4", - "resolved": "https://registry.npmjs.org/better-sqlite3/-/better-sqlite3-7.4.4.tgz", - "integrity": "sha512-CnK1JjchxbEumd2J6lqfzSG5nT4B/v+J9P0AKSm3NHSfcPsEGE4rHUp9lDlslJ1TL701RM7GWlTp3Pbacpn1/Q==", + "version": "github:mceachen/better-sqlite3#773ab4868bca2afe041a73a2af542db1e3382891", + "from": "github:mceachen/better-sqlite3#main", "requires": { "bindings": "^1.5.0", "prebuild-install": "^6.1.4", @@ -1606,15 +1611,15 @@ "integrity": "sha512-9o5UecI3GhkpM6DrXr69PblIuWxPKk9Y0jHBRhdocZ2y7YECBFCsHm79Pr3OyR2AvjhDkabFJaDJMYRazHgsow==" }, "browserslist": { - "version": "4.17.4", - "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.17.4.tgz", - "integrity": "sha512-Zg7RpbZpIJRW3am9Lyckue7PLytvVxxhJj1CaJVlCWENsGEAOlnlt8X0ZxGRPp7Bt9o8tIRM5SEXy4BCPMJjLQ==", + "version": "4.18.1", + "resolved": "https://registry.npmjs.org/browserslist/-/browserslist-4.18.1.tgz", + "integrity": "sha512-8ScCzdpPwR2wQh8IT82CA2VgDwjHyqMovPBZSNH54+tm4Jk2pCuv90gmAdH6J84OCRWi0b4gMe6O6XPXuJnjgQ==", "dev": true, "requires": { - "caniuse-lite": "^1.0.30001265", - "electron-to-chromium": "^1.3.867", + "caniuse-lite": "^1.0.30001280", + "electron-to-chromium": "^1.3.896", "escalade": "^3.1.1", - "node-releases": "^2.0.0", + "node-releases": "^2.0.1", "picocolors": "^1.0.0" } }, @@ -1896,9 +1901,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001269", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001269.tgz", - "integrity": "sha512-UOy8okEVs48MyHYgV+RdW1Oiudl1H6KolybD6ZquD0VcrPSgj25omXO1S7rDydjpqaISCwA8Pyx+jUQKZwWO5w==", + "version": "1.0.30001280", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001280.tgz", + "integrity": "sha512-kFXwYvHe5rix25uwueBxC569o53J6TpnGu0BEEn+6Lhl2vsnAumRFWEBhDft1fwyo6m1r4i+RqA4+163FpeFcA==", "dev": true }, "caseless": { @@ -2334,12 +2339,19 @@ "integrity": "sha512-+Hp8fLp57wnUSt0tY0tHEXh4voZRDnoIrZPqlo3DPiI4y9lwg/jqx+1Om94/W6ZaPDOUbnjOt/99w66zk+l1Xg==" }, "cookie-parser": { - "version": "1.4.5", - "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.5.tgz", - "integrity": "sha512-f13bPUj/gG/5mDr+xLmSxxDsB9DQiTIfhJS/sqjrmfAWiAN+x2O4i/XguTL9yDZ+/IFDanJ+5x7hC4CXT9Tdzw==", + "version": "1.4.6", + "resolved": "https://registry.npmjs.org/cookie-parser/-/cookie-parser-1.4.6.tgz", + "integrity": "sha512-z3IzaNjdwUC2olLIB5/ITd0/setiaFMLYiZJle7xg5Fe9KWAceil7xszYfHHBtDFYLSgJduS2Ty0P1uJdPDJeA==", "requires": { - "cookie": "0.4.0", + "cookie": "0.4.1", "cookie-signature": "1.0.6" + }, + "dependencies": { + "cookie": { + "version": "0.4.1", + "resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz", + "integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==" + } } }, "cookie-signature": { @@ -2856,21 +2868,145 @@ } }, "electron": { - "version": "13.6.1", - "resolved": "https://registry.npmjs.org/electron/-/electron-13.6.1.tgz", - "integrity": "sha512-rZ6Y7RberigruefQpWOiI4bA9ppyT88GQF8htY6N1MrAgal5RrBc+Mh92CcGU7zT9QO+XO3DarSgZafNTepffQ==", + "version": "16.0.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-16.0.0.tgz", + "integrity": "sha512-B+K/UnEV8NsP7IUOd4VAIYLT0uShLQ/V0p1QQLX0McF8d185AV522faklgMGMtPVWNVL2qifx9rZAsKtHPzmEg==", "dev": true, "requires": { - "@electron/get": "^1.0.1", + "@electron/get": "^1.13.0", "@types/node": "^14.6.2", "extract-zip": "^1.0.3" }, "dependencies": { + "@electron/get": { + "version": "1.13.1", + "resolved": "https://registry.npmjs.org/@electron/get/-/get-1.13.1.tgz", + "integrity": "sha512-U5vkXDZ9DwXtkPqlB45tfYnnYBN8PePp1z/XDCupnSpdrxT8/ThCv9WCwPLf9oqiSGZTkH6dx2jDUPuoXpjkcA==", + "dev": true, + "requires": { + "debug": "^4.1.1", + "env-paths": "^2.2.0", + "fs-extra": "^8.1.0", + "global-agent": "^3.0.0", + "global-tunnel-ng": "^2.7.1", + "got": "^9.6.0", + "progress": "^2.0.3", + "semver": "^6.2.0", + "sumchecker": "^3.0.1" + } + }, "@types/node": { "version": "14.17.33", "resolved": "https://registry.npmjs.org/@types/node/-/node-14.17.33.tgz", "integrity": "sha512-noEeJ06zbn3lOh4gqe2v7NMGS33jrulfNqYFDjjEbhpDEHR5VTxgYNQSBqBlJIsBJW3uEYDgD6kvMnrrhGzq8g==", "dev": true + }, + "boolean": { + "version": "3.1.4", + "resolved": "https://registry.npmjs.org/boolean/-/boolean-3.1.4.tgz", + "integrity": "sha512-3hx0kwU3uzG6ReQ3pnaFQPSktpBw6RHN3/ivDKEuU8g1XSfafowyvDnadjv1xp8IZqhtSukxlwv9bF6FhX8m0w==", + "dev": true, + "optional": true + }, + "escape-string-regexp": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-4.0.0.tgz", + "integrity": "sha512-TtpcNJ3XAzx3Gq8sWRzJaVajRs0uVxA2YAkdb1jm2YkPz4G6egUFAyA3n5vtEIZefPk5Wa4UXbKuS5fKkJWdgA==", + "dev": true, + "optional": true + }, + "fs-extra": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-8.1.0.tgz", + "integrity": "sha512-yhlQgA6mnOJUKOsRUFsgJdQCvkKhcz8tlZG5HBQfReYZy46OwLcY+Zia0mtdHsOo9y/hP+CxMN0TU9QxoOtG4g==", + "dev": true, + "requires": { + "graceful-fs": "^4.2.0", + "jsonfile": "^4.0.0", + "universalify": "^0.1.0" + } + }, + "global-agent": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/global-agent/-/global-agent-3.0.0.tgz", + "integrity": "sha512-PT6XReJ+D07JvGoxQMkT6qji/jVNfX/h364XHZOWeRzy64sSFr+xJ5OX7LI3b4MPQzdL4H8Y8M0xzPpsVMwA8Q==", + "dev": true, + "optional": true, + "requires": { + "boolean": "^3.0.1", + "es6-error": "^4.1.1", + "matcher": "^3.0.0", + "roarr": "^2.15.3", + "semver": "^7.3.2", + "serialize-error": "^7.0.1" + }, + "dependencies": { + "semver": { + "version": "7.3.5", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.3.5.tgz", + "integrity": "sha512-PoeGJYh8HK4BTO/a9Tf6ZG3veo/A7ZVsYrSA6J8ny9nb3B1VrpkuN+z9OE5wfE5p6H4LchYZsegiQgbJD94ZFQ==", + "dev": true, + "optional": true, + "requires": { + "lru-cache": "^6.0.0" + } + } + } + }, + "matcher": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/matcher/-/matcher-3.0.0.tgz", + "integrity": "sha512-OkeDaAZ/bQCxeFAozM55PKcKU0yJMPGifLwV4Qgjitu+5MoAfSQN4lsLJeXZ1b8w0x+/Emda6MZgXS1jvsapng==", + "dev": true, + "optional": true, + "requires": { + "escape-string-regexp": "^4.0.0" + } + }, + "roarr": { + "version": "2.15.4", + "resolved": "https://registry.npmjs.org/roarr/-/roarr-2.15.4.tgz", + "integrity": "sha512-CHhPh+UNHD2GTXNYhPWLnU8ONHdI+5DI+4EYIAOaiD63rHeYlZvyh8P+in5999TTSFgUYuKUAjzRI4mdh/p+2A==", + "dev": true, + "optional": true, + "requires": { + "boolean": "^3.0.1", + "detect-node": "^2.0.4", + "globalthis": "^1.0.1", + "json-stringify-safe": "^5.0.1", + "semver-compare": "^1.0.0", + "sprintf-js": "^1.1.2" + } + }, + "semver": { + "version": "6.3.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-6.3.0.tgz", + "integrity": "sha512-b39TBaTSfV6yBrapU89p5fKekE2m/NwnDocOVruQFS1/veMgdzuPcnOM34M6CwxW8jH/lxEa5rBoDeUwu5HHTw==", + "dev": true + }, + "serialize-error": { + "version": "7.0.1", + "resolved": "https://registry.npmjs.org/serialize-error/-/serialize-error-7.0.1.tgz", + "integrity": "sha512-8I8TjW5KMOKsZQTvoxjuSIa7foAwPWGOts+6o7sgjz41/qMD9VQHEDxi6PBvK2l0MXUmqZyNpUK+T2tQaaElvw==", + "dev": true, + "optional": true, + "requires": { + "type-fest": "^0.13.1" + } + }, + "sprintf-js": { + "version": "1.1.2", + "resolved": "https://registry.npmjs.org/sprintf-js/-/sprintf-js-1.1.2.tgz", + "integrity": "sha512-VE0SOVEHCk7Qc8ulkWw3ntAzXuqf7S2lvwQaDLRnUeIEaKNQJzV6BwmLKhOqT61aGhfUMrXeaBk+oDGCzvhcug==", + "dev": true, + "optional": true + }, + "type-fest": { + "version": "0.13.1", + "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.13.1.tgz", + "integrity": "sha512-34R7HTnG0XIJcBSn5XhDd7nNFPRcXYRZrBB2O2jdKqYODldSzBAqzsWoZYYvduky73toYS/ESqxPvkDf/F0XMg==", + "dev": true, + "optional": true } } }, @@ -3538,9 +3674,9 @@ } }, "electron-to-chromium": { - "version": "1.3.872", - "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.872.tgz", - "integrity": "sha512-qG96atLFY0agKyEETiBFNhpRLSXGSXOBuhXWpbkYqrLKKASpRyRBUtfkn0ZjIf/yXfA7FA4nScVOMpXSHFlUCQ==", + "version": "1.3.899", + "resolved": "https://registry.npmjs.org/electron-to-chromium/-/electron-to-chromium-1.3.899.tgz", + "integrity": "sha512-w16Dtd2zl7VZ4N4Db+FIa7n36sgPGCKjrKvUUmp5ialsikvcQLjcJR9RWnlYNxIyEHLdHaoIZEqKsPxU9MdyBg==", "dev": true }, "electron-window-state": { @@ -5780,9 +5916,9 @@ "dev": true }, "node-abi": { - "version": "3.3.0", - "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.3.0.tgz", - "integrity": "sha512-/+2sCVPXmj07GY/l0ggRr7+trqzX7F9d4QVfSArqIVYmRzc/LkXKr5FlRO6U8uZ/gVVclDDaBxBNITj1z1Z/Zw==", + "version": "3.5.0", + "resolved": "https://registry.npmjs.org/node-abi/-/node-abi-3.5.0.tgz", + "integrity": "sha512-LtHvNIBgOy5mO8mPEUtkCW/YCRWYEKshIvqhe1GHHyXEHEB5mgICyYnAcl4qan3uFeRROErKGzatFHPf6kDxWw==", "requires": { "semver": "^7.3.5" } @@ -5828,9 +5964,9 @@ "dev": true }, "node-releases": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.0.tgz", - "integrity": "sha512-aA87l0flFYMzCHpTM3DERFSYxc6lv/BltdbRTOMZuxZ0cwZCD3mejE5n9vLhSJCN++/eOqr77G1IO5uXxlQYWA==", + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/node-releases/-/node-releases-2.0.1.tgz", + "integrity": "sha512-CqyzN6z7Q6aMeF/ktcMVTzhAHCEpf8SOarwpzpf8pNBY2k5/oM34UHldUwp8VKI7uxct2HxSRdJjBaZeESzcxA==", "dev": true }, "nopt": { @@ -6433,6 +6569,12 @@ "resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz", "integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag==" }, + "progress": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/progress/-/progress-2.0.3.tgz", + "integrity": "sha512-7PiHtLll5LdnKIMw100I+8xJXR5gW2QwWYkT6iJva0bXitZKa/XMrSbdmg3r2Xnaidz9Qumd0VPaMrZlF9V9sA==", + "dev": true + }, "promise-inflight": { "version": "1.0.1", "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", @@ -7452,6 +7594,15 @@ "resolved": "https://registry.npmjs.org/striptags/-/striptags-3.2.0.tgz", "integrity": "sha512-g45ZOGzHDMe2bdYMdIvdAfCQkCTDMGBazSw1ypMowwGIee7ZQ5dU0rBJ8Jqgl+jAKIv4dbeE1jscZq9wid1Tkw==" }, + "sumchecker": { + "version": "3.0.1", + "resolved": "https://registry.npmjs.org/sumchecker/-/sumchecker-3.0.1.tgz", + "integrity": "sha512-MvjXzkz/BOfyVDkG0oFOtBxHX2u3gKbMHIF/dXblZsgD3BWOFLmHovIpZY7BykJdAjcqRCBi1WYBNdEC9yI7vg==", + "dev": true, + "requires": { + "debug": "^4.1.0" + } + }, "supports-color": { "version": "7.2.0", "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz", @@ -7549,9 +7700,9 @@ } }, "terser": { - "version": "5.9.0", - "resolved": "https://registry.npmjs.org/terser/-/terser-5.9.0.tgz", - "integrity": "sha512-h5hxa23sCdpzcye/7b8YqbE5OwKca/ni0RQz1uRX3tGh8haaGHqcuSqbGRybuAKNdntZ0mDgFNXPJ48xQ2RXKQ==", + "version": "5.10.0", + "resolved": "https://registry.npmjs.org/terser/-/terser-5.10.0.tgz", + "integrity": "sha512-AMmF99DMfEDiRJfxfY5jj5wNH/bYO09cniSqhfoyxc8sFoYIgkJy86G04UoZU5VjlpnplVu0K6Tx6E9b5+DlHA==", "dev": true, "requires": { "commander": "^2.20.0", @@ -7574,28 +7725,16 @@ } }, "terser-webpack-plugin": { - "version": "5.2.4", - "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.4.tgz", - "integrity": "sha512-E2CkNMN+1cho04YpdANyRrn8CyN4yMy+WdFKZIySFZrGXZxJwJP6PMNGGc/Mcr6qygQHUUqRxnAPmi0M9f00XA==", + "version": "5.2.5", + "resolved": "https://registry.npmjs.org/terser-webpack-plugin/-/terser-webpack-plugin-5.2.5.tgz", + "integrity": "sha512-3luOVHku5l0QBeYS8r4CdHYWEGMmIj3H1U64jgkdZzECcSOJAyJ9TjuqcQZvw1Y+4AOBN9SeYJPJmFn2cM4/2g==", "dev": true, "requires": { "jest-worker": "^27.0.6", - "p-limit": "^3.1.0", "schema-utils": "^3.1.1", "serialize-javascript": "^6.0.0", "source-map": "^0.6.1", "terser": "^5.7.2" - }, - "dependencies": { - "p-limit": { - "version": "3.1.0", - "resolved": "https://registry.npmjs.org/p-limit/-/p-limit-3.1.0.tgz", - "integrity": "sha512-TYOanM3wGwNGsZN2cVTYPArw454xnXj5qmWF1bEoAc4+cU/ol7GVh7odevjp1FNHduHc3KZMcFduxU5Xc6uJRQ==", - "dev": true, - "requires": { - "yocto-queue": "^0.1.0" - } - } } }, "timm": { @@ -8023,9 +8162,9 @@ "integrity": "sha512-VwddBukDzu71offAQR975unBIGqfKZpM+8ZX6ySk8nYhVoo5CYaZyzt3YBvYtRtO+aoGlqxPg/B87NGVZ/fu6g==" }, "webpack": { - "version": "5.64.0", - "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.64.0.tgz", - "integrity": "sha512-UclnN24m054HaPC45nmDEosX6yXWD+UGC12YtUs5i356DleAUGMDC9LBAw37xRRfgPKYIdCYjGA7RZ1AA+ZnGg==", + "version": "5.64.1", + "resolved": "https://registry.npmjs.org/webpack/-/webpack-5.64.1.tgz", + "integrity": "sha512-b4FHmRgaaAjP+aVOVz41a9Qa5SmkUPQ+u8FntTQ1roPHahSComB6rXnLwc976VhUY4CqTaLu5mCswuHiNhOfVw==", "dev": true, "requires": { "@types/eslint-scope": "^3.7.0", @@ -8051,7 +8190,7 @@ "tapable": "^2.1.1", "terser-webpack-plugin": "^5.1.3", "watchpack": "^2.2.0", - "webpack-sources": "^3.2.0" + "webpack-sources": "^3.2.2" } }, "webpack-cli": { @@ -8093,9 +8232,9 @@ } }, "webpack-sources": { - "version": "3.2.1", - "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.1.tgz", - "integrity": "sha512-t6BMVLQ0AkjBOoRTZgqrWm7xbXMBzD+XDq2EZ96+vMfn3qKgsvdXZhbPZ4ElUOpdv4u+iiGe+w3+J75iy/bYGA==", + "version": "3.2.2", + "resolved": "https://registry.npmjs.org/webpack-sources/-/webpack-sources-3.2.2.tgz", + "integrity": "sha512-cp5qdmHnu5T8wRg2G3vZZHoJPN14aqQ89SyQ11NpGH5zEMDCclt49rzo+MaRazk7/UeILhAI+/sEtcM+7Fr0nw==", "dev": true }, "whatwg-encoding": { @@ -8498,12 +8637,6 @@ "fd-slicer": "~1.1.0" } }, - "yocto-queue": { - "version": "0.1.0", - "resolved": "https://registry.npmjs.org/yocto-queue/-/yocto-queue-0.1.0.tgz", - "integrity": "sha512-rVksvsnNCdJ/ohGc6xgPwyN8eheCxsiLM8mxuE/t/mOVqJewPuO1miLpTHQiRgTKCLexL4MeAFVagts7HmNZ2Q==", - "dev": true - }, "zip-stream": { "version": "4.1.0", "resolved": "https://registry.npmjs.org/zip-stream/-/zip-stream-4.1.0.tgz", diff --git a/package.json b/package.json index 4fadec1c9..272267bc9 100644 --- a/package.json +++ b/package.json @@ -27,12 +27,12 @@ "archiver": "5.3.0", "async-mutex": "0.3.2", "axios": "0.24.0", - "better-sqlite3": "7.4.4", + "better-sqlite3": "mceachen/better-sqlite3#main", "body-parser": "1.19.0", "chokidar": "3.5.2", "cls-hooked": "4.2.2", "commonmark": "0.30.0", - "cookie-parser": "1.4.5", + "cookie-parser": "1.4.6", "csurf": "1.11.0", "dayjs": "1.10.7", "ejs": "3.1.6", @@ -59,7 +59,7 @@ "jsdom": "18.1.0", "mime-types": "2.1.34", "multer": "1.4.3", - "node-abi": "3.3.0", + "node-abi": "3.5.0", "open": "8.4.0", "portscanner": "2.2.0", "rand-token": "1.0.1", @@ -81,7 +81,8 @@ }, "devDependencies": { "cross-env": "7.0.3", - "electron": "13.6.1", + "electron": "16.0.0", + "@electron/remote": "2.0.1", "electron-builder": "22.13.1", "electron-packager": "15.4.0", "electron-rebuild": "3.2.5", @@ -90,7 +91,7 @@ "jsdoc": "3.6.7", "lorem-ipsum": "2.0.4", "rcedit": "3.0.1", - "webpack": "5.64.0", + "webpack": "5.64.1", "webpack-cli": "4.9.1" }, "optionalDependencies": { diff --git a/src/app.js b/src/app.js index 462d07342..dbfec9f4d 100644 --- a/src/app.js +++ b/src/app.js @@ -101,6 +101,8 @@ require('./services/consistency_checks'); require('./services/scheduler'); +require('@electron/remote/main').initialize(); + module.exports = { app, sessionParser diff --git a/src/public/app/desktop.js b/src/public/app/desktop.js index b60e30371..6ab84b3b3 100644 --- a/src/public/app/desktop.js +++ b/src/public/app/desktop.js @@ -34,7 +34,9 @@ noteAutocompleteService.init(); if (utils.isElectron()) { const electron = utils.dynamicRequire('electron'); - const {webContents} = electron.remote.getCurrentWindow(); + + const remote = utils.dynamicRequire('@electron/remote'); + const {webContents} = remote.getCurrentWindow(); webContents.on('context-menu', (event, params) => { const {editFlags} = params; diff --git a/src/public/app/dialogs/options/other.js b/src/public/app/dialogs/options/other.js index 99bde91ec..c3a60c301 100644 --- a/src/public/app/dialogs/options/other.js +++ b/src/public/app/dialogs/options/other.js @@ -122,7 +122,7 @@ export default class ProtectedSessionOptions { this.$availableLanguageCodes = $("#available-language-codes"); if (utils.isElectron()) { - const {webContents} = utils.dynamicRequire('electron').remote.getCurrentWindow(); + const {webContents} = utils.dynamicRequire('@electron/remote').getCurrentWindow(); this.$availableLanguageCodes.text(webContents.session.availableSpellCheckerLanguages.join(', ')); } diff --git a/src/public/app/services/entrypoints.js b/src/public/app/services/entrypoints.js index 2daa21b25..073150d52 100644 --- a/src/public/app/services/entrypoints.js +++ b/src/public/app/services/entrypoints.js @@ -35,7 +35,7 @@ export default class Entrypoints extends Component { openDevToolsCommand() { if (utils.isElectron()) { - utils.dynamicRequire('electron').remote.getCurrentWindow().toggleDevTools(); + utils.dynamicRequire('@electron/remote').getCurrentWindow().toggleDevTools(); } } @@ -44,7 +44,7 @@ export default class Entrypoints extends Component { return; } - const {remote} = utils.dynamicRequire('electron'); + const remote = utils.dynamicRequire('@electron/remote'); const {FindInPage} = utils.dynamicRequire('electron-find'); const findInPage = new FindInPage(remote.getCurrentWebContents(), { offsetTop: 10, @@ -116,7 +116,7 @@ export default class Entrypoints extends Component { toggleFullscreenCommand() { if (utils.isElectron()) { - const win = utils.dynamicRequire('electron').remote.getCurrentWindow(); + const win = utils.dynamicRequire('@electron/remote').getCurrentWindow(); if (win.isFullScreenable()) { win.setFullScreen(!win.isFullScreen()); @@ -143,7 +143,7 @@ export default class Entrypoints extends Component { backInNoteHistoryCommand() { if (utils.isElectron()) { // standard JS version does not work completely correctly in electron - const webContents = utils.dynamicRequire('electron').remote.getCurrentWebContents(); + const webContents = utils.dynamicRequire('@electron/remote').getCurrentWebContents(); const activeIndex = parseInt(webContents.getActiveIndex()); webContents.goToIndex(activeIndex - 1); @@ -156,7 +156,7 @@ export default class Entrypoints extends Component { forwardInNoteHistoryCommand() { if (utils.isElectron()) { // standard JS version does not work completely correctly in electron - const webContents = utils.dynamicRequire('electron').remote.getCurrentWebContents(); + const webContents = utils.dynamicRequire('@electron/remote').getCurrentWebContents(); const activeIndex = parseInt(webContents.getActiveIndex()); webContents.goToIndex(activeIndex + 1); diff --git a/src/public/app/services/open.js b/src/public/app/services/open.js index 2482ae714..86d5f0af5 100644 --- a/src/public/app/services/open.js +++ b/src/public/app/services/open.js @@ -7,7 +7,7 @@ function getFileUrl(noteId) { function download(url) { if (utils.isElectron()) { - const remote = utils.dynamicRequire('electron').remote; + const remote = utils.dynamicRequire('@electron/remote'); remote.getCurrentWebContents().downloadURL(url); } else { diff --git a/src/public/app/services/tree.js b/src/public/app/services/tree.js index 7bed9a7a9..20949f43d 100644 --- a/src/public/app/services/tree.js +++ b/src/public/app/services/tree.js @@ -138,7 +138,7 @@ ws.subscribeToMessages(message => { appContext.tabManager.activateOrOpenNote(message.noteId); if (utils.isElectron()) { - const currentWindow = utils.dynamicRequire("electron").remote.getCurrentWindow(); + const currentWindow = utils.dynamicRequire('@electron/remote').getCurrentWindow(); currentWindow.show(); } diff --git a/src/public/app/services/utils.js b/src/public/app/services/utils.js index c710c5cf9..1c9c16a47 100644 --- a/src/public/app/services/utils.js +++ b/src/public/app/services/utils.js @@ -279,7 +279,7 @@ function isHtmlEmpty(html) { async function clearBrowserCache() { if (isElectron()) { - const win = dynamicRequire('electron').remote.getCurrentWindow(); + const win = utils.dynamicRequire('@electron/remote').getCurrentWindow(); await win.webContents.session.clearCache(); } } diff --git a/src/public/app/setup.js b/src/public/app/setup.js index b7df9ae72..288b69eb3 100644 --- a/src/public/app/setup.js +++ b/src/public/app/setup.js @@ -122,7 +122,7 @@ async function checkOutstandingSyncs() { if (initialized) { if (utils.isElectron()) { - const remote = utils.dynamicRequire('electron').remote; + const remote = utils.dynamicRequire('@electron/remote'); remote.app.relaunch(); remote.app.exit(0); } diff --git a/src/public/app/widgets/history_navigation.js b/src/public/app/widgets/history_navigation.js index 09ab85984..f7e7513fb 100644 --- a/src/public/app/widgets/history_navigation.js +++ b/src/public/app/widgets/history_navigation.js @@ -42,8 +42,7 @@ export default class HistoryNavigationWidget extends BasicWidget { this.$forwardInHistory = this.$widget.find("[data-trigger-command='forwardInNoteHistory']"); this.$forwardInHistory.on('contextmenu', contextMenuHandler); - const electron = utils.dynamicRequire('electron'); - this.webContents = electron.remote.getCurrentWindow().webContents; + this.webContents = utils.dynamicRequire('@electron/remote').webContents; // without this the history is preserved across frontend reloads this.webContents.clearHistory(); diff --git a/src/public/app/widgets/title_bar_buttons.js b/src/public/app/widgets/title_bar_buttons.js index ed84b19d4..16cac5a2d 100644 --- a/src/public/app/widgets/title_bar_buttons.js +++ b/src/public/app/widgets/title_bar_buttons.js @@ -49,13 +49,13 @@ export default class TitleBarButtonsWidget extends BasicWidget { $minimizeBtn.on('click', () => { $minimizeBtn.trigger('blur'); - const {remote} = utils.dynamicRequire('electron'); + const remote = utils.dynamicRequire('@electron/remote'); remote.BrowserWindow.getFocusedWindow().minimize(); }); $maximizeBtn.on('click', () => { $maximizeBtn.trigger('blur'); - const {remote} = utils.dynamicRequire('electron'); + const remote = utils.dynamicRequire('@electron/remote'); const focusedWindow = remote.BrowserWindow.getFocusedWindow(); if (focusedWindow.isMaximized()) { @@ -67,7 +67,7 @@ export default class TitleBarButtonsWidget extends BasicWidget { $closeBtn.on('click', () => { $closeBtn.trigger('blur'); - const {remote} = utils.dynamicRequire('electron'); + const remote = utils.dynamicRequire('@electron/remote'); remote.BrowserWindow.getFocusedWindow().close(); }); } diff --git a/src/services/window.js b/src/services/window.js index 4a7a47a4b..a64af52d3 100644 --- a/src/services/window.js +++ b/src/services/window.js @@ -59,7 +59,6 @@ async function createMainWindow() { height: mainWindowState.height, title: 'Trilium Notes', webPreferences: { - enableRemoteModule: true, nodeIntegration: true, contextIsolation: false, spellcheck: spellcheckEnabled @@ -76,6 +75,8 @@ async function createMainWindow() { const {webContents} = mainWindow; + require("@electron/remote/main").enable(webContents); + webContents.on('new-window', (e, url) => { if (url !== webContents.getURL()) { e.preventDefault();