From 71ce14a4de9c29c8b2f8110c641ab41c32b6a73d Mon Sep 17 00:00:00 2001 From: jat Date: Fri, 17 Nov 2023 11:32:35 +0100 Subject: [PATCH 01/14] Update electron & better-sqlite3 & node-gyp Updates `node-gyp` to resolve an issue where msvc was falsely flagging the node API as having syntax errors --- package-lock.json | 500 ++++++++++++++++++++++++++++++++++++---------- package.json | 6 +- 2 files changed, 399 insertions(+), 107 deletions(-) diff --git a/package-lock.json b/package-lock.json index 793c3b52bbc..0d60c91d9b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,10 +25,10 @@ "@types/qrcode-svg": "1.1.1", "@types/systemjs": "6.1.1", "@types/winreg": "1.2.31", - "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#e2c61e6122bc56c6cfc29e61d21001faf43e2b8e", + "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#393abb9520e0f7b5fb24fb606ec49eca672e33a1", "cborg": "1.5.4", "dompurify": "3.0.4", - "electron": "26.5.0", + "electron": "27.0.4", "electron-updater": "6.1.1", "jszip": "3.10.1", "keytar": "git+https://github.com/tutao/node-keytar#12593c5809c9ed6bfc063ed3e862dd85a1506aca", @@ -71,7 +71,7 @@ "full-icu": "1.3.4", "js-yaml": "4.1.0", "jsdom": "22.1.0", - "node-gyp": "9.0.0", + "node-gyp": "9.4.0", "octokit": "1.3.0", "prettier": "2.8.1", "rollup": "3.20.2", @@ -967,12 +967,6 @@ "node": ">=14" } }, - "node_modules/@gar/promisify": { - "version": "1.1.3", - "resolved": "https://registry.npmjs.org/@gar/promisify/-/promisify-1.1.3.tgz", - "integrity": "sha512-k2Ty1JcVojjJFwrg/ThKi2ujJ7XNLYaFGNB/bWT9wGR+oSMJHMa5w+CUq6p/pVrKeNNgA7pCqEcjSnHVoqJQFw==", - "dev": true - }, "node_modules/@humanwhocodes/config-array": { "version": "0.11.13", "resolved": "https://registry.npmjs.org/@humanwhocodes/config-array/-/config-array-0.11.13.tgz", @@ -1028,6 +1022,102 @@ "integrity": "sha512-dvuCeX5fC9dXgJn9t+X5atfmgQAzUOWqS1254Gh0m6i8wKd10ebXkfNKiRK+1GWi/yTvvLDHpoxLr0xxxeslWw==", "dev": true }, + "node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dev": true, + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "dev": true, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==", + "dev": true + }, + "node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dev": true, + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dev": true, + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dev": true, + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/@jridgewell/gen-mapping": { "version": "0.3.3", "resolved": "https://registry.npmjs.org/@jridgewell/gen-mapping/-/gen-mapping-0.3.3.tgz", @@ -1171,30 +1261,15 @@ } }, "node_modules/@npmcli/fs": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-2.1.2.tgz", - "integrity": "sha512-yOJKRvohFOaLqipNtwYB9WugyZKhC/DZC4VYPmpaCzDBrA8YpK3qHZ8/HGscMnE4GqbkLNuVcCnxkeQEdGt6LQ==", + "version": "3.1.0", + "resolved": "https://registry.npmjs.org/@npmcli/fs/-/fs-3.1.0.tgz", + "integrity": "sha512-7kZUAaLscfgbwBQRbvdMYaZOWyMEcPTH/tJjnyAWJ/dvvs9Ef+CERx/qJb9GExJpl1qipaDGn7KqHnFGGixd0w==", "dev": true, "dependencies": { - "@gar/promisify": "^1.1.3", "semver": "^7.3.5" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" - } - }, - "node_modules/@npmcli/move-file": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/@npmcli/move-file/-/move-file-2.0.1.tgz", - "integrity": "sha512-mJd2Z5TjYWq/ttPLLGqArdtnC74J6bOzg4rMDnN+p1xTacZ2yPRCk2y0oSWQtygLR9YVQXgOcONrwtnk3JupxQ==", - "deprecated": "This functionality has been moved to @npmcli/fs", - "dev": true, - "dependencies": { - "mkdirp": "^1.0.4", - "rimraf": "^3.0.2" - }, - "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/@octokit/app": { @@ -1785,6 +1860,16 @@ "integrity": "sha512-8adktjIb76A7viIdayQSFuBEwOzwhDC+9yxZpKNHjfzrlostHCw0/N7JWpWMObfElwvJMk2fY2l1noENCk9wmw==", "dev": true }, + "node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "dev": true, + "optional": true, + "engines": { + "node": ">=14" + } + }, "node_modules/@rollup/plugin-commonjs": { "version": "24.0.1", "resolved": "https://registry.npmjs.org/@rollup/plugin-commonjs/-/plugin-commonjs-24.0.1.tgz", @@ -3351,9 +3436,9 @@ }, "node_modules/better-sqlite3": { "name": "@tutao/better-sqlite3-sqlcipher", - "version": "7.5.0", - "resolved": "git+ssh://git@github.com/tutao/better-sqlite3-sqlcipher.git#e2c61e6122bc56c6cfc29e61d21001faf43e2b8e", - "integrity": "sha512-5Glt/vVhCWmRgiK92M6ci3SDtANi9cx72UpLalzak71ScUDTX5SzEaxeDYhQZv+io9UsY0C6RJjbdc+5gsnWbw==", + "version": "8.5.2", + "resolved": "git+ssh://git@github.com/tutao/better-sqlite3-sqlcipher.git#393abb9520e0f7b5fb24fb606ec49eca672e33a1", + "integrity": "sha512-WV06ZovF2vmFad0hbRU4KDbNFw5SvKipH5pbnNYpxM4oOuk38UM08NtjXXeuYZjdW7dacRWHWTr3OqGLeUGLgg==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -3655,32 +3740,60 @@ } }, "node_modules/cacache": { - "version": "16.1.3", - "resolved": "https://registry.npmjs.org/cacache/-/cacache-16.1.3.tgz", - "integrity": "sha512-/+Emcj9DAXxX4cwlLmRI9c166RuL3w30zp4R7Joiv2cQTtTtA+jeuCAjH3ZlGnYS3tKENSrKhAzVVP9GVyzeYQ==", + "version": "17.1.4", + "resolved": "https://registry.npmjs.org/cacache/-/cacache-17.1.4.tgz", + "integrity": "sha512-/aJwG2l3ZMJ1xNAnqbMpA40of9dj/pIH3QfiuQSqjfPJF747VR0J/bHn+/KdNnHKc6XQcWt/AfRSBft82W1d2A==", "dev": true, "dependencies": { - "@npmcli/fs": "^2.1.0", - "@npmcli/move-file": "^2.0.0", - "chownr": "^2.0.0", - "fs-minipass": "^2.1.0", - "glob": "^8.0.1", - "infer-owner": "^1.0.4", + "@npmcli/fs": "^3.1.0", + "fs-minipass": "^3.0.0", + "glob": "^10.2.2", "lru-cache": "^7.7.1", - "minipass": "^3.1.6", + "minipass": "^7.0.3", "minipass-collect": "^1.0.2", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", - "mkdirp": "^1.0.4", "p-map": "^4.0.0", - "promise-inflight": "^1.0.1", - "rimraf": "^3.0.2", - "ssri": "^9.0.0", + "ssri": "^10.0.0", "tar": "^6.1.11", - "unique-filename": "^2.0.0" + "unique-filename": "^3.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/cacache/node_modules/fs-minipass": { + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", + "dev": true, + "dependencies": { + "minipass": "^7.0.3" + }, + "engines": { + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/cacache/node_modules/glob": { + "version": "10.3.10", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", + "integrity": "sha512-fa46+tv1Ak0UPK1TOy/pZrIybNNt4HCv7SDzwyfiOZkvZLEbjsZkJBPtDHVshZjbecAoAGSC20MjLDG/qr679g==", + "dev": true, + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.3.5", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/esm/bin.mjs" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, "node_modules/cacache/node_modules/lru-cache": { @@ -3692,6 +3805,30 @@ "node": ">=12" } }, + "node_modules/cacache/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dev": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/cacache/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/cacheable-lookup": { "version": "5.0.4", "resolved": "https://registry.npmjs.org/cacheable-lookup/-/cacheable-lookup-5.0.4.tgz", @@ -4488,6 +4625,12 @@ "resolved": "https://registry.npmjs.org/duplexer/-/duplexer-0.1.2.tgz", "integrity": "sha512-jtD6YG370ZCIi/9GTaJKQxWTZD045+4R4hTk/x1UyoqadyJ9x9CgSi1RlVDQF8U2sxLLSnFkCaMihqljHIWgMg==" }, + "node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==", + "dev": true + }, "node_modules/ecdsa-sig-formatter": { "version": "1.0.11", "resolved": "https://registry.npmjs.org/ecdsa-sig-formatter/-/ecdsa-sig-formatter-1.0.11.tgz", @@ -4519,9 +4662,9 @@ } }, "node_modules/electron": { - "version": "26.5.0", - "resolved": "https://registry.npmjs.org/electron/-/electron-26.5.0.tgz", - "integrity": "sha512-j65/SMEqf+sKBUmAwYU0E5d/OKPmhRVyMntVulHKTNEazxF2TuRr/+GoEVxBq4l9jfLEXhheVOuOW0J5Tme1kA==", + "version": "27.0.4", + "resolved": "https://registry.npmjs.org/electron/-/electron-27.0.4.tgz", + "integrity": "sha512-ob29rN1mtiyAXzF8HsHd5jh8bYKd9OQDakfdOExi0F7epU97gXPHaj6JPjbBJ/vpki5d32SyKVePW4vxeNZk1A==", "hasInstallScript": true, "dependencies": { "@electron/get": "^2.0.0", @@ -5222,6 +5365,12 @@ "node": ">=6" } }, + "node_modules/exponential-backoff": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/exponential-backoff/-/exponential-backoff-3.1.1.tgz", + "integrity": "sha512-dX7e/LHVJ6W3DE1MHWi9S1EYzDESENfLrYohG2G++ovZrYOkm4Knwa0mc1cn84xJOR4KEU0WSchhLbd0UklbHw==", + "dev": true + }, "node_modules/express": { "version": "4.18.2", "resolved": "https://registry.npmjs.org/express/-/express-4.18.2.tgz", @@ -5616,6 +5765,34 @@ "is-callable": "^1.1.3" } }, + "node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dev": true, + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "dev": true, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/form-data": { "version": "4.0.0", "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz", @@ -6384,12 +6561,6 @@ "node": ">=8" } }, - "node_modules/infer-owner": { - "version": "1.0.4", - "resolved": "https://registry.npmjs.org/infer-owner/-/infer-owner-1.0.4.tgz", - "integrity": "sha512-IClj+Xz94+d7irH5qRyfJonOdfTzuDaifE6ZPWfx0N0+/ATZCbuTPq2prFl526urkQd90WyUKIh1DfBQ2hMz9A==", - "dev": true - }, "node_modules/inflight": { "version": "1.0.6", "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", @@ -6688,6 +6859,24 @@ "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" }, + "node_modules/jackspeak": { + "version": "2.3.6", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.6.tgz", + "integrity": "sha512-N3yCS/NegsOBokc8GAdM8UcmfsKiSS8cipheD/nivzr700H+nsMOxJjQnvwOcRYVuFkdH0wGUvW2WbXGmrZGbQ==", + "dev": true, + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, "node_modules/jake": { "version": "10.8.7", "resolved": "https://registry.npmjs.org/jake/-/jake-10.8.7.tgz", @@ -7167,30 +7356,29 @@ } }, "node_modules/make-fetch-happen": { - "version": "10.2.1", - "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-10.2.1.tgz", - "integrity": "sha512-NgOPbRiaQM10DYXvN3/hhGVI2M5MtITFryzBGxHM5p4wnFxsVCbxkrBrDsk+EZ5OB4jEOT7AjDxtdF+KVEFT7w==", + "version": "11.1.1", + "resolved": "https://registry.npmjs.org/make-fetch-happen/-/make-fetch-happen-11.1.1.tgz", + "integrity": "sha512-rLWS7GCSTcEujjVBs2YqG7Y4643u8ucvCJeSRqiLYhesrDuzeuFIk37xREzAsfQaqzl8b9rNCE4m6J8tvX4Q8w==", "dev": true, "dependencies": { "agentkeepalive": "^4.2.1", - "cacache": "^16.1.0", - "http-cache-semantics": "^4.1.0", + "cacache": "^17.0.0", + "http-cache-semantics": "^4.1.1", "http-proxy-agent": "^5.0.0", "https-proxy-agent": "^5.0.0", "is-lambda": "^1.0.1", "lru-cache": "^7.7.1", - "minipass": "^3.1.6", - "minipass-collect": "^1.0.2", - "minipass-fetch": "^2.0.3", + "minipass": "^5.0.0", + "minipass-fetch": "^3.0.0", "minipass-flush": "^1.0.5", "minipass-pipeline": "^1.2.4", "negotiator": "^0.6.3", "promise-retry": "^2.0.1", "socks-proxy-agent": "^7.0.0", - "ssri": "^9.0.0" + "ssri": "^10.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/make-fetch-happen/node_modules/lru-cache": { @@ -7202,6 +7390,15 @@ "node": ">=12" } }, + "node_modules/make-fetch-happen/node_modules/minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "dev": true, + "engines": { + "node": ">=8" + } + }, "node_modules/map-stream": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", @@ -7357,22 +7554,31 @@ } }, "node_modules/minipass-fetch": { - "version": "2.1.2", - "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-2.1.2.tgz", - "integrity": "sha512-LT49Zi2/WMROHYoqGgdlQIZh8mLPZmOrN2NdJjMXxYe4nkN6FUyuPuOAOedNJDrx0IRGg9+4guZewtp8hE6TxA==", + "version": "3.0.4", + "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz", + "integrity": "sha512-jHAqnA728uUpIaFm7NWsCnqKT6UqZz7GcI/bDpPATuwYyKwJwW0remxSCxUlKiEty+eopHGa3oc8WxgQ1FFJqg==", "dev": true, "dependencies": { - "minipass": "^3.1.6", + "minipass": "^7.0.3", "minipass-sized": "^1.0.3", "minizlib": "^2.1.2" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" }, "optionalDependencies": { "encoding": "^0.1.13" } }, + "node_modules/minipass-fetch/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/minipass-flush": { "version": "1.0.5", "resolved": "https://registry.npmjs.org/minipass-flush/-/minipass-flush-1.0.5.tgz", @@ -7558,16 +7764,17 @@ } }, "node_modules/node-gyp": { - "version": "9.0.0", - "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.0.0.tgz", - "integrity": "sha512-Ma6p4s+XCTPxCuAMrOA/IJRmVy16R8Sdhtwl4PrCr7IBlj4cPawF0vg/l7nOT1jPbuNS7lIRJpBSvVsXwEZuzw==", + "version": "9.4.0", + "resolved": "https://registry.npmjs.org/node-gyp/-/node-gyp-9.4.0.tgz", + "integrity": "sha512-dMXsYP6gc9rRbejLXmTbVRYjAHw7ppswsKyMxuxJxxOHzluIO1rGp9TOQgjFJ+2MCqcOcQTOPB/8Xwhr+7s4Eg==", "dev": true, "dependencies": { "env-paths": "^2.2.0", + "exponential-backoff": "^3.1.1", "glob": "^7.1.4", "graceful-fs": "^4.2.6", - "make-fetch-happen": "^10.0.3", - "nopt": "^5.0.0", + "make-fetch-happen": "^11.0.3", + "nopt": "^6.0.0", "npmlog": "^6.0.0", "rimraf": "^3.0.2", "semver": "^7.3.5", @@ -7578,7 +7785,7 @@ "node-gyp": "bin/node-gyp.js" }, "engines": { - "node": "^12.22 || ^14.13 || >=16" + "node": "^12.13 || ^14.13 || >=16" } }, "node_modules/node-gyp/node_modules/brace-expansion": { @@ -7624,18 +7831,18 @@ } }, "node_modules/nopt": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/nopt/-/nopt-5.0.0.tgz", - "integrity": "sha512-Tbj67rffqceeLpcRXrT7vKAN8CwfPeIBgM7E6iBkmKLV7bEMwpGgYLGv0jACUsECaa/vuxP0IjEont6umdMgtQ==", + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/nopt/-/nopt-6.0.0.tgz", + "integrity": "sha512-ZwLpbTgdhuZUnZzjd7nb1ZV+4DoiC6/sfiVKok72ym/4Tlf+DFdlHYmT2JPmcNNWV6Pi3SDf1kT+A4r9RTuT9g==", "dev": true, "dependencies": { - "abbrev": "1" + "abbrev": "^1.0.0" }, "bin": { "nopt": "bin/nopt.js" }, "engines": { - "node": ">=6" + "node": "^12.13.0 || ^14.15.0 || >=16.0.0" } }, "node_modules/normalize-package-data": { @@ -8014,6 +8221,43 @@ "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" }, + "node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dev": true, + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.0.2", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.2.tgz", + "integrity": "sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==", + "dev": true, + "dependencies": { + "semver": "^7.3.5" + }, + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/path-scurry/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -8219,12 +8463,6 @@ "node": ">=0.4.0" } }, - "node_modules/promise-inflight": { - "version": "1.0.1", - "resolved": "https://registry.npmjs.org/promise-inflight/-/promise-inflight-1.0.1.tgz", - "integrity": "sha512-6zWPyEOFaQBJYcGMHBKTKJ3u6TBsnMFOIZSa6ce1e/ZrrsOlnHRHbabMjLiBYKp+n44X9eUI6VUPaukCXHuG4g==", - "dev": true - }, "node_modules/promise-retry": { "version": "2.0.1", "resolved": "https://registry.npmjs.org/promise-retry/-/promise-retry-2.0.1.tgz", @@ -9309,15 +9547,24 @@ "integrity": "sha512-AGCfA12UoGNjJd1qITaOyMcS2sg3or20Flx3qNEUK4k6CLO8Ld6F9TSDIVGK/54wyBjF2n/dAeO5d1m0E4XJ/Q==" }, "node_modules/ssri": { - "version": "9.0.1", - "resolved": "https://registry.npmjs.org/ssri/-/ssri-9.0.1.tgz", - "integrity": "sha512-o57Wcn66jMQvfHG1FlYbWeZWW/dHZhJXjpIcTfXldXEk5nz5lStPo3mK0OJQfGR3RbZUlbISexbljkJzuEj/8Q==", + "version": "10.0.5", + "resolved": "https://registry.npmjs.org/ssri/-/ssri-10.0.5.tgz", + "integrity": "sha512-bSf16tAFkGeRlUNDjXu8FzaMQt6g2HZJrun7mtMbIPOddxt3GLMSz5VWUWcqTJUPfLEaDIepGxv+bYQW49596A==", "dev": true, "dependencies": { - "minipass": "^3.1.1" + "minipass": "^7.0.3" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/ssri/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" } }, "node_modules/stat-mode": { @@ -9373,6 +9620,21 @@ "node": ">=8" } }, + "node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/stringify-object-es5": { "version": "2.5.0", "resolved": "https://registry.npmjs.org/stringify-object-es5/-/stringify-object-es5-2.5.0.tgz", @@ -9397,6 +9659,19 @@ "node": ">=8" } }, + "node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/strip-bom": { "version": "3.0.0", "resolved": "https://registry.npmjs.org/strip-bom/-/strip-bom-3.0.0.tgz", @@ -9842,27 +10117,27 @@ "integrity": "sha512-JlCMO+ehdEIKqlFxk6IfVoAUVmgz7cU7zD/h9XZ0qzeosSHmUJVOzSQvvYSYWXkFXC+IfLKSIffhv0sVZup6pA==" }, "node_modules/unique-filename": { - "version": "2.0.1", - "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-2.0.1.tgz", - "integrity": "sha512-ODWHtkkdx3IAR+veKxFV+VBkUMcN+FaqzUUd7IZzt+0zhDZFPFxhlqwPF3YQvMHx1TD0tdgYl+kuPnJ8E6ql7A==", + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/unique-filename/-/unique-filename-3.0.0.tgz", + "integrity": "sha512-afXhuC55wkAmZ0P18QsVE6kp8JaxrEokN2HGIoIVv2ijHQd419H0+6EigAFcIzXeMIkcIkNBpB3L/DXB3cTS/g==", "dev": true, "dependencies": { - "unique-slug": "^3.0.0" + "unique-slug": "^4.0.0" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/unique-slug": { - "version": "3.0.0", - "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-3.0.0.tgz", - "integrity": "sha512-8EyMynh679x/0gqE9fT9oilG+qEt+ibFyqjuVTsZn1+CMxH+XLlpvr2UZx4nVcCwTpx81nICr2JQFkM+HPLq4w==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/unique-slug/-/unique-slug-4.0.0.tgz", + "integrity": "sha512-WrcA6AyEfqDX5bWige/4NQfPZMtASNVxdmWR76WESYQVAACSgWcR6e9i0mofqqBxYFtL4oAxPIptY73/0YE1DQ==", "dev": true, "dependencies": { "imurmurhash": "^0.1.4" }, "engines": { - "node": "^12.13.0 || ^14.15.0 || >=16.0.0" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, "node_modules/universal-github-app-jwt": { @@ -10177,6 +10452,24 @@ "url": "https://github.com/chalk/wrap-ansi?sponsor=1" } }, + "node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dev": true, + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, "node_modules/wrappy": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", @@ -10668,9 +10961,8 @@ }, "packages/tutanota-utils/node_modules/typescript": { "version": "5.0.3", - "resolved": "https://registry.npmjs.org/typescript/-/typescript-5.0.3.tgz", - "integrity": "sha512-xv8mOEDnigb/tN9PSMTwSEqAnUvkoXMQlicOb0IUVDBSQCgBSaAAROUZYy2IcUy5qU6XajK5jjjO7TMWqBTKZA==", "dev": true, + "license": "Apache-2.0", "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" diff --git a/package.json b/package.json index 4401d90f39c..c992946d122 100644 --- a/package.json +++ b/package.json @@ -44,10 +44,10 @@ "@types/qrcode-svg": "1.1.1", "@types/systemjs": "6.1.1", "@types/winreg": "1.2.31", - "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#e2c61e6122bc56c6cfc29e61d21001faf43e2b8e", + "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#393abb9520e0f7b5fb24fb606ec49eca672e33a1", "cborg": "1.5.4", "dompurify": "3.0.4", - "electron": "26.5.0", + "electron": "27.0.4", "electron-updater": "6.1.1", "jszip": "3.10.1", "keytar": "git+https://github.com/tutao/node-keytar#12593c5809c9ed6bfc063ed3e862dd85a1506aca", @@ -90,7 +90,7 @@ "full-icu": "1.3.4", "js-yaml": "4.1.0", "jsdom": "22.1.0", - "node-gyp": "9.0.0", + "node-gyp": "9.4.0", "octokit": "1.3.0", "prettier": "2.8.1", "rollup": "3.20.2", From 4f03731e1d7bfb125242a736666625e9ec92aec9 Mon Sep 17 00:00:00 2001 From: nig Date: Fri, 17 Nov 2023 16:22:16 +0100 Subject: [PATCH 02/14] update better-sqlite3 to include arm64 target --- buildSrc/electron-package-json-template.js | 13 +- package-lock.json | 146 ++++++++++++++------- package.json | 2 +- 3 files changed, 111 insertions(+), 50 deletions(-) diff --git a/buildSrc/electron-package-json-template.js b/buildSrc/electron-package-json-template.js index 0a500ee2f3d..a8539f548e5 100644 --- a/buildSrc/electron-package-json-template.js +++ b/buildSrc/electron-package-json-template.js @@ -135,7 +135,10 @@ export default async function generateTemplate({ nameSuffix, version, updateUrl, LSUIElement: 1, //hide dock icon on startup }, target: unpacked - ? [{ target: "dir", arch: "x64" }] + ? [ + { target: "dir", arch: "x64" }, + { target: "dir", arch: "arm64" }, + ] : [ { target: "zip", @@ -145,6 +148,14 @@ export default async function generateTemplate({ nameSuffix, version, updateUrl, target: "dmg", arch: "x64", }, + { + target: "zip", + arch: "arm64", + }, + { + target: "dmg", + arch: "arm64", + }, ], }, linux: { diff --git a/package-lock.json b/package-lock.json index 0d60c91d9b8..b2aea6aec98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -25,7 +25,7 @@ "@types/qrcode-svg": "1.1.1", "@types/systemjs": "6.1.1", "@types/winreg": "1.2.31", - "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#393abb9520e0f7b5fb24fb606ec49eca672e33a1", + "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", "dompurify": "3.0.4", "electron": "27.0.4", @@ -3437,8 +3437,8 @@ "node_modules/better-sqlite3": { "name": "@tutao/better-sqlite3-sqlcipher", "version": "8.5.2", - "resolved": "git+ssh://git@github.com/tutao/better-sqlite3-sqlcipher.git#393abb9520e0f7b5fb24fb606ec49eca672e33a1", - "integrity": "sha512-WV06ZovF2vmFad0hbRU4KDbNFw5SvKipH5pbnNYpxM4oOuk38UM08NtjXXeuYZjdW7dacRWHWTr3OqGLeUGLgg==", + "resolved": "git+ssh://git@github.com/tutao/better-sqlite3-sqlcipher.git#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", + "integrity": "sha512-UWpi4688FOLkl5jow7aRv8S0cLhdNonn0n5WshvqMc8R9NGs1YzwHjVtNDGwSrsq0FfnzFAaOE18bs0ISdysPg==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -3762,18 +3762,6 @@ "node": "^14.17.0 || ^16.13.0 || >=18.0.0" } }, - "node_modules/cacache/node_modules/fs-minipass": { - "version": "3.0.3", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", - "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", - "dev": true, - "dependencies": { - "minipass": "^7.0.3" - }, - "engines": { - "node": "^14.17.0 || ^16.13.0 || >=18.0.0" - } - }, "node_modules/cacache/node_modules/glob": { "version": "10.3.10", "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.10.tgz", @@ -5881,14 +5869,24 @@ } }, "node_modules/fs-minipass": { - "version": "2.1.0", - "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", - "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "version": "3.0.3", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-3.0.3.tgz", + "integrity": "sha512-XUBA9XClHbnJWSfBzjkm6RvPsyg3sryZt06BEQoXcF7EK/xpGaQYJgQKDJSUH5SGZ76Y7pFx1QBnXz09rU5Fbw==", + "dev": true, "dependencies": { - "minipass": "^3.0.0" + "minipass": "^7.0.3" }, "engines": { - "node": ">= 8" + "node": "^14.17.0 || ^16.13.0 || >=18.0.0" + } + }, + "node_modules/fs-minipass/node_modules/minipass": { + "version": "7.0.4", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", + "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", + "dev": true, + "engines": { + "node": ">=16 || 14 >=14.17" } }, "node_modules/fs.realpath": { @@ -7390,15 +7388,6 @@ "node": ">=12" } }, - "node_modules/make-fetch-happen/node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", - "dev": true, - "engines": { - "node": ">=8" - } - }, "node_modules/map-stream": { "version": "0.1.0", "resolved": "https://registry.npmjs.org/map-stream/-/map-stream-0.1.0.tgz", @@ -7531,12 +7520,9 @@ } }, "node_modules/minipass": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", - "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", - "dependencies": { - "yallist": "^4.0.0" - }, + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", "engines": { "node": ">=8" } @@ -7553,6 +7539,18 @@ "node": ">= 8" } }, + "node_modules/minipass-collect/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/minipass-fetch": { "version": "3.0.4", "resolved": "https://registry.npmjs.org/minipass-fetch/-/minipass-fetch-3.0.4.tgz", @@ -7591,6 +7589,18 @@ "node": ">= 8" } }, + "node_modules/minipass-flush/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/minipass-pipeline": { "version": "1.2.4", "resolved": "https://registry.npmjs.org/minipass-pipeline/-/minipass-pipeline-1.2.4.tgz", @@ -7603,6 +7613,18 @@ "node": ">=8" } }, + "node_modules/minipass-pipeline/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/minipass-sized": { "version": "1.0.3", "resolved": "https://registry.npmjs.org/minipass-sized/-/minipass-sized-1.0.3.tgz", @@ -7615,6 +7637,18 @@ "node": ">=8" } }, + "node_modules/minipass-sized/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dev": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/minizlib": { "version": "2.1.2", "resolved": "https://registry.npmjs.org/minizlib/-/minizlib-2.1.2.tgz", @@ -7627,6 +7661,17 @@ "node": ">= 8" } }, + "node_modules/minizlib/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=8" + } + }, "node_modules/mithril": { "version": "2.2.2", "resolved": "https://registry.npmjs.org/mithril/-/mithril-2.2.2.tgz", @@ -8249,15 +8294,6 @@ "node": "14 || >=16.14" } }, - "node_modules/path-scurry/node_modules/minipass": { - "version": "7.0.4", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.4.tgz", - "integrity": "sha512-jYofLM5Dam9279rdkWzqHozUo4ybjdZmCsDHePy5V/PbBcVMiSZR97gmAy45aqi8CK1lG2ECd356FU86avfwUQ==", - "dev": true, - "engines": { - "node": ">=16 || 14 >=14.17" - } - }, "node_modules/path-to-regexp": { "version": "0.1.7", "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz", @@ -9831,10 +9867,24 @@ "node": ">= 6" } }, - "node_modules/tar/node_modules/minipass": { - "version": "5.0.0", - "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", - "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==", + "node_modules/tar/node_modules/fs-minipass": { + "version": "2.1.0", + "resolved": "https://registry.npmjs.org/fs-minipass/-/fs-minipass-2.1.0.tgz", + "integrity": "sha512-V/JgOLFCS+R6Vcq0slCuaeWEdNC3ouDlJMNIsacH2VtALiu9mV4LPrHc5cDl8k5aw6J8jwgWWpiTo5RYhmIzvg==", + "dependencies": { + "minipass": "^3.0.0" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/tar/node_modules/fs-minipass/node_modules/minipass": { + "version": "3.3.6", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-3.3.6.tgz", + "integrity": "sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw==", + "dependencies": { + "yallist": "^4.0.0" + }, "engines": { "node": ">=8" } diff --git a/package.json b/package.json index c992946d122..42d3d46d016 100644 --- a/package.json +++ b/package.json @@ -44,7 +44,7 @@ "@types/qrcode-svg": "1.1.1", "@types/systemjs": "6.1.1", "@types/winreg": "1.2.31", - "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#393abb9520e0f7b5fb24fb606ec49eca672e33a1", + "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", "dompurify": "3.0.4", "electron": "27.0.4", From 434c61207ec0740e7f84eb0f33b13c28697ced3b Mon Sep 17 00:00:00 2001 From: jat Date: Fri, 17 Nov 2023 17:51:46 +0100 Subject: [PATCH 03/14] Fix desktop script building both x86_64 and arm64 at the same time Added a new flag `-a` which allows the developer to set the architecture of the built client. It causes an error when an unsupported combination of platform & architecture is used. By default, it uses the architecture the installed node binary uses. --- buildSrc/DesktopBuilder.js | 6 ++++-- buildSrc/DevBuild.js | 1 + buildSrc/buildUtils.js | 17 ++++++++++++++++ buildSrc/electron-package-json-template.js | 23 ++++++---------------- desktop.js | 10 ++++++++-- 5 files changed, 36 insertions(+), 21 deletions(-) diff --git a/buildSrc/DesktopBuilder.js b/buildSrc/DesktopBuilder.js index 5cdd1ef67c9..71576985deb 100644 --- a/buildSrc/DesktopBuilder.js +++ b/buildSrc/DesktopBuilder.js @@ -23,6 +23,7 @@ const projectRoot = path.resolve(path.join(buildSrc, "..")) * @param dirname directory this was called from * @param version application version that gets built * @param platform: {"linux"|"win32"|"darwin"} - Canonical platform name of the desktop target to be built + * @param architecture: {"arm64"|"x64"} the instruction set used in the built desktop binary * @param updateUrl where the client should pull its updates from, if any * @param nameSuffix suffix used to distinguish test-, prod- or snapshot builds on the same machine * @param notarize for the MacOs notarization feature @@ -30,7 +31,7 @@ const projectRoot = path.resolve(path.join(buildSrc, "..")) * @param unpacked output desktop client without packing it into an installer * @returns {Promise} */ -export async function buildDesktop({ dirname, version, platform, updateUrl, nameSuffix, notarize, outDir, unpacked, disableMinify }) { +export async function buildDesktop({ dirname, version, platform, architecture, updateUrl, nameSuffix, notarize, outDir, unpacked, disableMinify }) { // The idea is that we // - build desktop code into build/desktop // - package the whole dist directory into the app @@ -38,7 +39,7 @@ export async function buildDesktop({ dirname, version, platform, updateUrl, name // - cleanup dist directory // It's messy - console.log(`Building ${platform} desktop client for v${version}`) + console.log(`Building ${architecture} ${platform} desktop client for v${version}`) updateUrl = updateUrl?.toString() const updateSubDir = `desktop${nameSuffix}` const distDir = path.join(dirname, "build") @@ -61,6 +62,7 @@ export async function buildDesktop({ dirname, version, platform, updateUrl, name unpacked, sign: (process.env.DEBUG_SIGN && updateUrl !== "") || !!process.env.JENKINS_HOME, linux: platform === "linux", + architecture, }) console.log("updateUrl is", updateUrl) await fs.promises.writeFile("./build/package.json", JSON.stringify(content), "utf-8") diff --git a/buildSrc/DevBuild.js b/buildSrc/DevBuild.js index b6c419596ef..47b2348173e 100644 --- a/buildSrc/DevBuild.js +++ b/buildSrc/DevBuild.js @@ -122,6 +122,7 @@ async function buildDesktopPart({ version }) { iconPath: path.join(desktopIconsPath, "logo-solo-red.png"), sign: false, linux: process.platform === "linux", + architecture: "x64", }) const content = JSON.stringify(packageJSON, null, 2) diff --git a/buildSrc/buildUtils.js b/buildSrc/buildUtils.js index 757164b638b..ff0d1b6876a 100644 --- a/buildSrc/buildUtils.js +++ b/buildSrc/buildUtils.js @@ -159,6 +159,23 @@ export function getCanonicalPlatformName(platformName) { } } +/** + * Checks whether the combination of OS & architecture is supported by the build system + * @param platformName {"darwin"|"win32"|"linux"} + * @param architecture {"arm"|"arm64"|"ia32"|"mips"|"mipsel"|"ppc"|"ppc64"|"riscv64"|"s390"|"s390x"|"x64"} + * @returns {boolean} + */ +export function checkArchitectureIsSupported(platformName, architecture) { + switch (architecture) { + case "x64": + return true + case "arm64": + return platformName === "darwin" + default: + return false + } +} + export async function runStep(name, cmd) { const before = Date.now() console.log("Build >", name) diff --git a/buildSrc/electron-package-json-template.js b/buildSrc/electron-package-json-template.js index a8539f548e5..374de1d0c3a 100644 --- a/buildSrc/electron-package-json-template.js +++ b/buildSrc/electron-package-json-template.js @@ -8,7 +8,7 @@ import { getElectronVersion } from "./buildUtils.js" * 2. copied to app-desktop/build from dist.js (DesktopBuilder) */ -export default async function generateTemplate({ nameSuffix, version, updateUrl, iconPath, sign, notarize, unpacked, linux }) { +export default async function generateTemplate({ nameSuffix, version, updateUrl, iconPath, sign, notarize, unpacked, linux, architecture }) { const appName = "tutanota-desktop" + nameSuffix const appId = "de.tutao.tutanota" + nameSuffix if (process.env.JENKINS_HOME && process.env.DEBUG_SIGN) throw new Error("Tried to DEBUG_SIGN in CI!") @@ -111,7 +111,7 @@ export default async function generateTemplate({ nameSuffix, version, updateUrl, target: [ { target: unpacked ? "dir" : "nsis", - arch: "x64", + arch: architecture, }, ], }, @@ -135,26 +135,15 @@ export default async function generateTemplate({ nameSuffix, version, updateUrl, LSUIElement: 1, //hide dock icon on startup }, target: unpacked - ? [ - { target: "dir", arch: "x64" }, - { target: "dir", arch: "arm64" }, - ] + ? [{ target: "dir", arch: architecture }] : [ { target: "zip", - arch: "x64", + arch: architecture, }, { target: "dmg", - arch: "x64", - }, - { - target: "zip", - arch: "arm64", - }, - { - target: "dmg", - arch: "arm64", + arch: architecture, }, ], }, @@ -168,7 +157,7 @@ export default async function generateTemplate({ nameSuffix, version, updateUrl, target: [ { target: unpacked ? "dir" : "AppImage", - arch: "x64", + arch: architecture, }, ], }, diff --git a/desktop.js b/desktop.js index 9d2d2908fa6..425da03920b 100644 --- a/desktop.js +++ b/desktop.js @@ -4,7 +4,7 @@ import * as env from "./buildSrc/env.js" import os from "node:os" import { buildWebapp } from "./buildSrc/buildWebapp.js" -import { getCanonicalPlatformName, getTutanotaAppVersion, measure } from "./buildSrc/buildUtils.js" +import { checkArchitectureIsSupported, getCanonicalPlatformName, getTutanotaAppVersion, measure } from "./buildSrc/buildUtils.js" import { dirname } from "node:path" import { fileURLToPath } from "node:url" import { createHtml } from "./buildSrc/createHtml.js" @@ -23,6 +23,7 @@ await program .addArgument(new Argument("host").argOptional()) .option("-e, --existing", "Use existing prebuilt Webapp files in /build/") .option("-p, --platform ", "For which platform to build: linux|win|mac", process.platform) + .option("-a, --architecture ", "For which CPU architecture to build: x64|arm_64", process.arch) .option( "-c,--custom-desktop-release", "use if manually building desktop client from source. doesn't install auto updates, but may still notify about new releases.", @@ -46,6 +47,10 @@ await program opts.platform = getCanonicalPlatformName(opts.platform) + if (!checkArchitectureIsSupported(opts.platform, opts.architecture)) { + throw new Error(`Platform ${opts.platform} on ${opts.architecture} is not supported`) + } + await doBuild(opts) }) .parseAsync(process.argv) @@ -84,7 +89,7 @@ async function doBuild(opts) { } } -async function buildDesktopClient(version, { stage, host, platform, customDesktopRelease, unpacked, outDir, disableMinify }) { +async function buildDesktopClient(version, { stage, host, platform, architecture, customDesktopRelease, unpacked, outDir, disableMinify }) { const { buildDesktop } = await import("./buildSrc/DesktopBuilder.js") const updateUrl = new URL(tutaAppUrl) updateUrl.pathname = "desktop" @@ -92,6 +97,7 @@ async function buildDesktopClient(version, { stage, host, platform, customDeskto dirname: __dirname, version, platform: platform, + architecture, updateUrl: customDesktopRelease ? "" : updateUrl, nameSuffix: "", notarize: !customDesktopRelease, From bb06896d0e8254dee1fca4c33aa8edc73b694742 Mon Sep 17 00:00:00 2001 From: jat Date: Mon, 20 Nov 2023 08:37:27 +0100 Subject: [PATCH 04/14] Add support for universal architecture on macOS `electron-builder` has undocumented support for building universal binaries with `electron/universal`. It's mentioned in `electron-builder`'s change logs & in /packages/app-builder-lib/src/macPackager.ts#L109 inside `electron-builder`'s repo. --- buildSrc/DesktopBuilder.js | 2 +- buildSrc/buildUtils.js | 3 ++- desktop.js | 2 +- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/buildSrc/DesktopBuilder.js b/buildSrc/DesktopBuilder.js index 71576985deb..0542cc1d27e 100644 --- a/buildSrc/DesktopBuilder.js +++ b/buildSrc/DesktopBuilder.js @@ -23,7 +23,7 @@ const projectRoot = path.resolve(path.join(buildSrc, "..")) * @param dirname directory this was called from * @param version application version that gets built * @param platform: {"linux"|"win32"|"darwin"} - Canonical platform name of the desktop target to be built - * @param architecture: {"arm64"|"x64"} the instruction set used in the built desktop binary + * @param architecture: {"arm64"|"x64"|"universal"} the instruction set used in the built desktop binary * @param updateUrl where the client should pull its updates from, if any * @param nameSuffix suffix used to distinguish test-, prod- or snapshot builds on the same machine * @param notarize for the MacOs notarization feature diff --git a/buildSrc/buildUtils.js b/buildSrc/buildUtils.js index ff0d1b6876a..666cd25bb5a 100644 --- a/buildSrc/buildUtils.js +++ b/buildSrc/buildUtils.js @@ -162,7 +162,7 @@ export function getCanonicalPlatformName(platformName) { /** * Checks whether the combination of OS & architecture is supported by the build system * @param platformName {"darwin"|"win32"|"linux"} - * @param architecture {"arm"|"arm64"|"ia32"|"mips"|"mipsel"|"ppc"|"ppc64"|"riscv64"|"s390"|"s390x"|"x64"} + * @param architecture {"arm"|"arm64"|"ia32"|"mips"|"mipsel"|"ppc"|"ppc64"|"riscv64"|"s390"|"s390x"|"x64"|"universal"} * @returns {boolean} */ export function checkArchitectureIsSupported(platformName, architecture) { @@ -170,6 +170,7 @@ export function checkArchitectureIsSupported(platformName, architecture) { case "x64": return true case "arm64": + case "universal": return platformName === "darwin" default: return false diff --git a/desktop.js b/desktop.js index 425da03920b..f9e97da7bfa 100644 --- a/desktop.js +++ b/desktop.js @@ -23,7 +23,7 @@ await program .addArgument(new Argument("host").argOptional()) .option("-e, --existing", "Use existing prebuilt Webapp files in /build/") .option("-p, --platform ", "For which platform to build: linux|win|mac", process.platform) - .option("-a, --architecture ", "For which CPU architecture to build: x64|arm_64", process.arch) + .option("-a, --architecture ", "For which CPU architecture to build: x64|arm_64|universal", process.arch) .option( "-c,--custom-desktop-release", "use if manually building desktop client from source. doesn't install auto updates, but may still notify about new releases.", From f809c26179cd788a12d993cb5f018544d9befa49 Mon Sep 17 00:00:00 2001 From: jat Date: Mon, 20 Nov 2023 13:34:28 +0100 Subject: [PATCH 05/14] Use Mac M1 agent to build Mac releases during Jenkins build --- ci/Desktop.Jenkinsfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ci/Desktop.Jenkinsfile b/ci/Desktop.Jenkinsfile index 47b32634cf1..326ffb2ead3 100644 --- a/ci/Desktop.Jenkinsfile +++ b/ci/Desktop.Jenkinsfile @@ -108,7 +108,7 @@ pipeline { PATH = "${env.NODE_MAC_PATH}:${env.PATH}" } agent { - label 'mac' + label 'mac-m1' } steps { initBuildArea() @@ -125,7 +125,7 @@ pipeline { export APPLEID=${APPLEIDVAR}; export APPLEIDPASS=${APPLEIDPASSVAR}; export APPLETEAMID=${APPLETEAMIDVAR}; - node desktop --existing --platform mac ''' + "${stage}" + node desktop --existing --architecture universal --platform mac ''' + "${stage}" dir('artifacts') { if (params.RELEASE) { stash includes: 'desktop-test/*', name:'mac_installer_test' From a778036ee3014b294dbfa75c6a357f359cfc7629 Mon Sep 17 00:00:00 2001 From: tutao Date: Mon, 20 Nov 2023 17:47:22 +0100 Subject: [PATCH 06/14] Fix non-universal libraries being included when building universal --- buildSrc/DesktopBuilder.js | 6 ++- buildSrc/DevBuild.js | 2 + buildSrc/esbuildUtils.js | 6 ++- buildSrc/nativeLibraryProvider.js | 73 +++++++++++++++++++-------- buildSrc/nativeLibraryRollupPlugin.js | 5 +- package-lock.json | 63 ++++------------------- package.json | 1 + test/TestBuilder.js | 2 + 8 files changed, 77 insertions(+), 81 deletions(-) diff --git a/buildSrc/DesktopBuilder.js b/buildSrc/DesktopBuilder.js index 0542cc1d27e..f49b29347ad 100644 --- a/buildSrc/DesktopBuilder.js +++ b/buildSrc/DesktopBuilder.js @@ -78,7 +78,7 @@ export async function buildDesktop({ dirname, version, platform, architecture, u } console.log("Bundling desktop client") - await rollupDesktop(dirname, path.join(distDir, "desktop"), version, platform, disableMinify) + await rollupDesktop(dirname, path.join(distDir, "desktop"), version, platform, architecture, disableMinify) console.log("Starting installer build...") if (process.platform.startsWith("darwin")) { @@ -114,7 +114,7 @@ export async function buildDesktop({ dirname, version, platform, architecture, u ]) } -async function rollupDesktop(dirname, outDir, version, platform, disableMinify) { +async function rollupDesktop(dirname, outDir, version, platform, architecture, disableMinify) { platform = getCanonicalPlatformName(platform) const mainBundle = await rollup({ input: [path.join(dirname, "src/desktop/DesktopMain.ts"), path.join(dirname, "src/desktop/sqlworker.ts")], @@ -127,12 +127,14 @@ async function rollupDesktop(dirname, outDir, version, platform, disableMinify) rootDir: projectRoot, dstPath: "./build/desktop/", platform, + architecture, nodeModule: "better-sqlite3", }), copyNativeModulePlugin({ rootDir: projectRoot, dstPath: "./build/desktop/", platform, + architecture, nodeModule: "keytar", }), typescript({ diff --git a/buildSrc/DevBuild.js b/buildSrc/DevBuild.js index 47b2348173e..a4ed1f1176c 100644 --- a/buildSrc/DevBuild.js +++ b/buildSrc/DevBuild.js @@ -97,6 +97,7 @@ async function buildDesktopPart({ version }) { environment: "electron", dstPath: "./build/desktop/better_sqlite3.node", platform: process.platform, + architecture: process.arch, nativeBindingPath: "./better_sqlite3.node", }), keytarNativePlugin({ @@ -104,6 +105,7 @@ async function buildDesktopPart({ version }) { dstPath: "./build/desktop/keytar.node", nativeBindingPath: "./keytar.node", platform: process.platform, + architecture: process.arch, }), preludeEnvPlugin(env.create({ staticUrl: null, version, mode: "Desktop", dist: false, domainConfigs })), externalTranslationsPlugin(), diff --git a/buildSrc/esbuildUtils.js b/buildSrc/esbuildUtils.js index 1aa81917cfd..224cf56d44f 100644 --- a/buildSrc/esbuildUtils.js +++ b/buildSrc/esbuildUtils.js @@ -8,7 +8,7 @@ import { aliasPath as esbuildPluginAliasPath } from "esbuild-plugin-alias-path" * Little plugin that obtains compiled keytar, copies it to dstPath and sets the path to nativeBindingPath. * We do not use default file loader from esbuild, it is much simpler and reliable to do it manually. */ -export function keytarNativePlugin({ environment, dstPath, nativeBindingPath, platform }) { +export function keytarNativePlugin({ environment, dstPath, nativeBindingPath, platform, architecture }) { return { name: "keytar-native-plugin", setup(build) { @@ -19,6 +19,7 @@ export function keytarNativePlugin({ environment, dstPath, nativeBindingPath, pl rootDir: process.cwd(), log: console.log.bind(console), platform, + architecture, copyTarget: "keytar", }) await fs.promises.mkdir(path.dirname(dstPath), { recursive: true }) @@ -41,7 +42,7 @@ export function keytarNativePlugin({ environment, dstPath, nativeBindingPath, pl * anyway. * It will also replace `buildOptions.sqliteNativePath` with the nativeBindingPath */ -export function sqliteNativePlugin({ environment, dstPath, nativeBindingPath, platform }) { +export function sqliteNativePlugin({ environment, dstPath, nativeBindingPath, platform, architecture }) { return { name: "sqlite-native-plugin", setup(build) { @@ -58,6 +59,7 @@ export function sqliteNativePlugin({ environment, dstPath, nativeBindingPath, pl rootDir: process.cwd(), log: console.log.bind(console), platform, + architecture, copyTarget: "better_sqlite3", }) await fs.promises.mkdir(path.dirname(dstPath), { recursive: true }) diff --git a/buildSrc/nativeLibraryProvider.js b/buildSrc/nativeLibraryProvider.js index 6bd7a607b84..30339bcb73f 100644 --- a/buildSrc/nativeLibraryProvider.js +++ b/buildSrc/nativeLibraryProvider.js @@ -40,7 +40,8 @@ function validateOpts(opts) { async function cli(nodeModule, { environment, rootDir, forceRebuild, useExisting, copyTarget }) { const platform = getCanonicalPlatformName(process.platform) - const path = await getCachedLibPath({ rootDir, nodeModule, environment, platform }, console.log.bind(console)) + const architecture = process.arch + const path = await getCachedLibPath({ rootDir, nodeModule, environment, platform, architecture }, console.log.bind(console)) if (forceRebuild) { await fs.promises.rm(path, { force: true }) @@ -53,6 +54,7 @@ async function cli(nodeModule, { environment, rootDir, forceRebuild, useExisting log: console.log.bind(console), useExisting, platform, + architecture, copyTarget, }) } @@ -64,6 +66,7 @@ async function cli(nodeModule, { environment, rootDir, forceRebuild, useExisting * to avoid rebuilding between different invocations (e.g. running desktop and running tests). * @param environment {"electron"|"node"} * @param platform {"win32"|"linux"|"darwin"} platform to compile for in case of cross compilation + * @param architecture: {"arm64"|"x64"|"universal"} the instruction set used in the built desktop binary * @param rootDir {string} path to the root of the project * @param nodeModule {string} name of the npm module to rebuild * @param log {(...string) => void} @@ -72,8 +75,8 @@ async function cli(nodeModule, { environment, rootDir, forceRebuild, useExisting * @param prebuildTarget: {{ runtime: string, version: number} | undefined} Target parameters to use when getting a prebuild * @returns {Promise} path to cached native module */ -export async function getNativeLibModulePath({ environment, platform, rootDir, nodeModule, log, noBuild, copyTarget }) { - const libPath = await getCachedLibPath({ rootDir, nodeModule, environment, platform }, log) +export async function getNativeLibModulePath({ environment, platform, architecture, rootDir, nodeModule, log, noBuild, copyTarget }) { + const libPath = await getCachedLibPath({ rootDir, nodeModule, environment, platform, architecture }, log) if (await fileExists(libPath)) { log(`Using cached ${nodeModule} at`, libPath) @@ -104,6 +107,8 @@ export async function getNativeLibModulePath({ environment, platform, rootDir, n rootDir, log, nodeModule, + copyTarget, + architecture, }) } @@ -120,26 +125,46 @@ export async function getNativeLibModulePath({ environment, platform, rootDir, n * @param nodeModule {string} the node module being built. Must be installed, and must be a native module project with a `binding.gyp` at the root * @param environment {"node"|"electron"} Used to determine which node version to use * @param rootDir {string} the root dir of the project + * @param architecture the architecture to build for: "x64" | "arm64" | "universal" * @param log {(string) => void} a logger * @returns {Promise} */ -export async function buildNativeModule({ nodeModule, environment, rootDir, log }) { - await callProgram({ - command: "npm exec", - args: [ - "--", - "node-gyp", - "rebuild", - "--release", - "--build-from-source", - `--arch=${process.arch}`, - ...(environment === "electron" - ? ["--runtime=electron", "--dist-url=https://www.electronjs.org/headers", `--target=${await getElectronVersion(log)}`] - : []), - ], - cwd: await getModuleDir(rootDir, nodeModule), - log, - }) +export async function buildNativeModule({ nodeModule, copyTarget, environment, rootDir, log, architecture }) { + const moduleDir = await getModuleDir(rootDir, nodeModule) + const electronVersion = await getElectronVersion(log) + const doBuild = (arch) => + callProgram({ + command: "npm exec", + args: [ + "--", + "node-gyp", + "rebuild", + "--release", + "--build-from-source", + `--arch=${arch}`, + ...(environment === "electron" ? ["--runtime=electron", "--dist-url=https://www.electronjs.org/headers", `--target=${electronVersion}`] : []), + ], + cwd: moduleDir, + log, + }) + + if (architecture === "universal") { + const artifactPath = path.join(moduleDir, "build/Release", `${copyTarget}.node`) + const intelArtifactPath = path.join(moduleDir, `${copyTarget}-x64.node`) + const armArtifactPath = path.join(moduleDir, `${copyTarget}-arm64.node`) + await doBuild("x64") + await fs.promises.copyFile(artifactPath, intelArtifactPath) + await doBuild("arm64") + await fs.promises.copyFile(artifactPath, armArtifactPath) + await callProgram({ + command: "lipo", + args: ["-create", "-output", artifactPath, intelArtifactPath, armArtifactPath], + cwd: path.join(rootDir, "native-cache"), + log, + }) + } else { + await doBuild(architecture) + } } /** @@ -241,15 +266,19 @@ function callProgram({ command, args, cwd, log }) { * @param nodeModule * @param environment * @param platform + * @param architecture: {"arm64"|"x64"|"universal"} the instruction set used in the built desktop binary * @returns {Promise} */ -async function getCachedLibPath({ rootDir, nodeModule, environment, platform }, log) { +async function getCachedLibPath({ rootDir, nodeModule, environment, platform, architecture }, log) { const dir = path.join(rootDir, "native-cache", environment) const libraryVersion = await getInstalledModuleVersion(nodeModule, log) await fs.promises.mkdir(dir, { recursive: true }) if (environment === "electron") { - return path.resolve(dir, `${nodeModule}-${libraryVersion}-electron-${await getInstalledModuleVersion("electron", log)}-${platform}.node`) + return path.resolve( + dir, + `${nodeModule}-${libraryVersion}-electron-${await getInstalledModuleVersion("electron", log)}-${platform}-${architecture}.node`, + ) } else { return path.resolve(dir, `${nodeModule}-${libraryVersion}-${platform}.node`) } diff --git a/buildSrc/nativeLibraryRollupPlugin.js b/buildSrc/nativeLibraryRollupPlugin.js index 8fb410adc4c..4d9c4661493 100644 --- a/buildSrc/nativeLibraryRollupPlugin.js +++ b/buildSrc/nativeLibraryRollupPlugin.js @@ -3,7 +3,7 @@ import path from "node:path" import { getNativeLibModulePath } from "./nativeLibraryProvider.js" /** copy either a fresh build or a cached version of a native module for the platform client being built into the build directory.*/ -export function copyNativeModulePlugin({ rootDir, dstPath, platform, nodeModule }, log = console.log.bind(console)) { +export function copyNativeModulePlugin({ rootDir, dstPath, platform, architecture, nodeModule }, log = console.log.bind(console)) { return { name: "copy-native-module-plugin", async buildStart() { @@ -13,7 +13,8 @@ export function copyNativeModulePlugin({ rootDir, dstPath, platform, nodeModule rootDir, log, platform, - // for some reason, the binary produced by better-sqlite3 is called better_sqlite3.node + architecture, + // because its name is used as a C identifier, the binary produced by better-sqlite3 is called better_sqlite3.node copyTarget: nodeModule.replace("-", "_"), }) const normalDst = path.join(path.normalize(dstPath), `${nodeModule}.node`) diff --git a/package-lock.json b/package-lock.json index b2aea6aec98..7cd1d2fd55f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,6 +27,7 @@ "@types/winreg": "1.2.31", "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", + "dmg-license": "^1.0.11", "dompurify": "3.0.4", "electron": "27.0.4", "electron-updater": "6.1.1", @@ -2284,8 +2285,6 @@ "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.5.tgz", "integrity": "sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA==", - "dev": true, - "optional": true, "dependencies": { "@types/node": "*", "xmlbuilder": ">=11.0.1" @@ -2388,9 +2387,7 @@ "node_modules/@types/verror": { "version": "1.10.9", "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz", - "integrity": "sha512-MLx9Z+9lGzwEuW16ubGeNkpBDE84RpB/NyGgg6z2BTpWzKkGU451cAY3UkUzZEp72RHF585oJ3V8JVNqIplcAQ==", - "dev": true, - "optional": true + "integrity": "sha512-MLx9Z+9lGzwEuW16ubGeNkpBDE84RpB/NyGgg6z2BTpWzKkGU451cAY3UkUzZEp72RHF585oJ3V8JVNqIplcAQ==" }, "node_modules/@types/which": { "version": "2.0.2", @@ -2895,7 +2892,6 @@ "version": "0.8.10", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", - "dev": true, "engines": { "node": ">=10.0.0" } @@ -3021,7 +3017,6 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3046,7 +3041,6 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, "engines": { "node": ">=8" } @@ -3055,7 +3049,6 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -3224,8 +3217,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "dev": true, - "optional": true, "engines": { "node": ">=0.8" } @@ -3234,8 +3225,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, - "optional": true, "engines": { "node": ">=8" } @@ -3985,8 +3974,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", - "dev": true, - "optional": true, "dependencies": { "slice-ansi": "^3.0.0", "string-width": "^4.2.0" @@ -4027,7 +4014,6 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -4038,8 +4024,7 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" }, "node_modules/color-support": { "version": "1.1.3", @@ -4207,8 +4192,6 @@ "version": "3.8.0", "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", - "dev": true, - "optional": true, "dependencies": { "buffer": "^5.1.0" } @@ -4542,8 +4525,6 @@ "version": "1.0.11", "resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz", "integrity": "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q==", - "dev": true, - "optional": true, "os": [ "darwin" ], @@ -4841,8 +4822,7 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" }, "node_modules/encodeurl": { "version": "1.0.2", @@ -5490,17 +5470,14 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz", "integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==", - "dev": true, "engines": [ "node >=0.6.0" - ], - "optional": true + ] }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" }, "node_modules/fast-glob": { "version": "3.3.2", @@ -5520,8 +5497,7 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -6469,8 +6445,6 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", "integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==", - "dev": true, - "optional": true, "os": [ "darwin" ], @@ -6706,7 +6680,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, "engines": { "node": ">=8" } @@ -7010,8 +6983,7 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -7744,9 +7716,7 @@ "node_modules/node-addon-api": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", - "dev": true, - "optional": true + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" }, "node_modules/node-domexception": { "version": "1.0.0", @@ -8418,7 +8388,6 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", - "dev": true, "dependencies": { "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", @@ -8558,7 +8527,6 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, "engines": { "node": ">=6" } @@ -9454,8 +9422,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", - "dev": true, - "optional": true, "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -9469,7 +9435,6 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -9646,7 +9611,6 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -9687,7 +9651,6 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -10227,7 +10190,6 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -10325,8 +10287,6 @@ "version": "1.10.1", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", "integrity": "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==", - "dev": true, - "optional": true, "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -10339,9 +10299,7 @@ "node_modules/verror/node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true, - "optional": true + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", @@ -10592,7 +10550,6 @@ "version": "15.1.1", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", - "dev": true, "engines": { "node": ">=8.0" } diff --git a/package.json b/package.json index 42d3d46d016..cbd7ff32215 100644 --- a/package.json +++ b/package.json @@ -46,6 +46,7 @@ "@types/winreg": "1.2.31", "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", + "dmg-license": "^1.0.11", "dompurify": "3.0.4", "electron": "27.0.4", "electron-updater": "6.1.1", diff --git a/test/TestBuilder.js b/test/TestBuilder.js index 3d1b3a2c9ca..74bb777ee90 100644 --- a/test/TestBuilder.js +++ b/test/TestBuilder.js @@ -96,12 +96,14 @@ export async function runTestBuild({ clean, fast = false }) { // We put it back into node_modules because we don't bundle it. If we remove node_modules but keep the cached one we will not run build. dstPath: "../node_modules/better-sqlite3/build/Release/better_sqlite3.node", platform: process.platform, + architecture: process.arch, nativeBindingPath: path.resolve("../node_modules/better-sqlite3/build/Release/better_sqlite3.node"), }), keytarNativePlugin({ environment: "node", dstPath: "./build/keytar.node", platform: process.platform, + architecture: process.arch, }), watPlugin({ loader: "file", From 0ddf1061e32ead238823cdeb839f0f3300e6f1fb Mon Sep 17 00:00:00 2001 From: tutao Date: Tue, 21 Nov 2023 11:15:26 +0100 Subject: [PATCH 07/14] Fix missing entitlement when building universal binary on macOS Updated electron-builder and its dependencies. #2625 --- buildSrc/mac-entitlements.plist | 2 + package-lock.json | 142 +++++++++++++++++++------------- package.json | 4 +- 3 files changed, 88 insertions(+), 60 deletions(-) diff --git a/buildSrc/mac-entitlements.plist b/buildSrc/mac-entitlements.plist index 3e5a15790d7..346ff2cbbdb 100644 --- a/buildSrc/mac-entitlements.plist +++ b/buildSrc/mac-entitlements.plist @@ -4,6 +4,8 @@ com.apple.security.cs.allow-unsigned-executable-memory + com.apple.security.cs.allow-jit + com.apple.security.cs.disable-library-validation diff --git a/package-lock.json b/package-lock.json index 7cd1d2fd55f..986c29f5ced 100644 --- a/package-lock.json +++ b/package-lock.json @@ -43,7 +43,7 @@ "winreg": "1.2.4" }, "devDependencies": { - "@electron/notarize": "1.2.3", + "@electron/notarize": "2.2.0", "@octokit/auth-token": "2.5.0", "@octokit/rest": "18.12.0", "@rollup/plugin-commonjs": "24.0.1", @@ -59,7 +59,7 @@ "body-parser": "1.20.0", "chokidar": "3.5.2", "commander": "9.2.0", - "electron-builder": "24.8.1", + "electron-builder": "24.9.1", "electron-packager": "17.1.2", "esbuild": "0.17.15", "esbuild-plugin-alias-path": "2.0.2", @@ -95,12 +95,12 @@ } }, "node_modules/@babel/code-frame": { - "version": "7.22.13", - "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.22.13.tgz", - "integrity": "sha512-XktuhWlJ5g+3TJXc5upd9Ks1HutSArik6jf2eAjYFyIOf4ej3RN+184cZbzDvbPnuTJIUhPKKJE3cIsYTiAT3w==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.23.4.tgz", + "integrity": "sha512-r1IONyb6Ia+jYR2vvIDhdWdlTGhqbBoFqLTQidzZ4kepUFH15ejXvFHxCVbtl7BOXIudsIubf4E81xeA3h3IXA==", "dev": true, "dependencies": { - "@babel/highlight": "^7.22.13", + "@babel/highlight": "^7.23.4", "chalk": "^2.4.2" }, "engines": { @@ -188,9 +188,9 @@ } }, "node_modules/@babel/highlight": { - "version": "7.22.20", - "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.22.20.tgz", - "integrity": "sha512-dkdMCN3py0+ksCgYmGG8jKeGA/8Tk+gJwSYYlFGxG5lmhfKNoAy004YpLxpS1W2J8m/EK2Ew+yOs9pVRwO89mg==", + "version": "7.23.4", + "resolved": "https://registry.npmjs.org/@babel/highlight/-/highlight-7.23.4.tgz", + "integrity": "sha512-acGdbYSfp2WheJoJm/EBBBLh/ID8KDc64ISZ9DYtBmC8/Q204PZJLHyzeB5qMzJ5trcOkybd78M4x2KWsUq++A==", "dev": true, "dependencies": { "@babel/helper-validator-identifier": "^7.22.20", @@ -415,13 +415,14 @@ } }, "node_modules/@electron/notarize": { - "version": "1.2.3", - "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.3.tgz", - "integrity": "sha512-9oRzT56rKh5bspk3KpAVF8lPKHYQrBnRwcgiOeR0hdilVEQmszDaAu0IPCPrwwzJN0ugNs0rRboTreHMt/6mBQ==", + "version": "2.2.0", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-2.2.0.tgz", + "integrity": "sha512-Sf7RG47rafeGuUm+kLEbTXMN8XZeYXN70dMBstrcgiykxCq3SLl1uqxFWndxSI1LfMqv4Eq9PTDHLPwiya31Kg==", "dev": true, "dependencies": { "debug": "^4.1.1", - "fs-extra": "^9.0.1" + "fs-extra": "^9.0.1", + "promise-retry": "^2.0.1" }, "engines": { "node": ">= 10.0.0" @@ -2259,9 +2260,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.9.1", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.1.tgz", - "integrity": "sha512-HhmzZh5LSJNS5O8jQKpJ/3ZcrrlG6L70hpGqMIAoM9YVD0YBRNWYsfwcXq8VnSjlNpCpgLzMXdiPo+dxcvSmiA==", + "version": "20.9.3", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.3.tgz", + "integrity": "sha512-nk5wXLAXGBKfrhLB0cyHGbSqopS+nz0BUgZkUQqSHSSgdee0kssp1IAqlQOu333bW+gMNs2QREx7iynm19Abxw==", "dependencies": { "undici-types": "~5.26.4" } @@ -2291,14 +2292,14 @@ } }, "node_modules/@types/prop-types": { - "version": "15.7.10", - "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.10.tgz", - "integrity": "sha512-mxSnDQxPqsZxmeShFH+uwQ4kO4gcJcGahjjMFeLbKE95IAZiiZyiEepGZjtXJ7hN/yfu0bu9xN2ajcU0JcxX6A==" + "version": "15.7.11", + "resolved": "https://registry.npmjs.org/@types/prop-types/-/prop-types-15.7.11.tgz", + "integrity": "sha512-ga8y9v9uyeiLdpKddhxYQkxNDrfvuPrlFb0N1qnZZByvcElJaXthF1UhvCh9TLWJBEHeNtdnbysW7Y6Uq8CVng==" }, "node_modules/@types/ps-tree": { - "version": "1.1.5", - "resolved": "https://registry.npmjs.org/@types/ps-tree/-/ps-tree-1.1.5.tgz", - "integrity": "sha512-3LU5a3EZYI1/HvvOkQmmVGrdXopwKXpr3K5cxlZ0zRiP0QzW7IH0o1z4UDI7KdnyQnpPfYHXOOqflEXIl23LFw==", + "version": "1.1.6", + "resolved": "https://registry.npmjs.org/@types/ps-tree/-/ps-tree-1.1.6.tgz", + "integrity": "sha512-PtrlVaOaI44/3pl3cvnlK+GxOM3re2526TJvPvh7W+keHIXdV4TE0ylpPBAcvFQCbGitaTXwL9u+RF7qtVeazQ==", "dev": true }, "node_modules/@types/qrcode-svg": { @@ -2319,9 +2320,9 @@ "dev": true }, "node_modules/@types/react": { - "version": "18.2.37", - "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.37.tgz", - "integrity": "sha512-RGAYMi2bhRgEXT3f4B92WTohopH6bIXw05FuGlmJEnv/omEn190+QYEIYxIAuIBdKgboYYdVved2p1AxZVQnaw==", + "version": "18.2.38", + "resolved": "https://registry.npmjs.org/@types/react/-/react-18.2.38.tgz", + "integrity": "sha512-cBBXHzuPtQK6wNthuVMV6IjHAFkdl/FOPFIlkd81/Cd1+IqkHu/A+w4g43kaQQoYHik/ruaQBDL72HyCy1vuMw==", "dependencies": { "@types/prop-types": "*", "@types/scheduler": "*", @@ -2343,14 +2344,14 @@ } }, "node_modules/@types/scheduler": { - "version": "0.16.6", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.6.tgz", - "integrity": "sha512-Vlktnchmkylvc9SnwwwozTv04L/e1NykF5vgoQ0XTmI8DD+wxfjQuHuvHS3p0r2jz2x2ghPs2h1FVeDirIteWA==" + "version": "0.16.7", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.7.tgz", + "integrity": "sha512-8g25Nl3AuB1KulTlSUsUhUo/oBgBU6XIXQ+XURpeioEbEJvkO7qI4vDfREv3vJYHHzqXjcAHvoJy4pTtSQNZtA==" }, "node_modules/@types/semver": { - "version": "7.5.5", - "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.5.tgz", - "integrity": "sha512-+d+WYC1BxJ6yVOgUgzK8gWvp5qF8ssV5r4nsDcZWKRWcDQLQ619tvWAxJQYGgBrO1MnLJC7a5GtiYsAoQ47dJg==", + "version": "7.5.6", + "resolved": "https://registry.npmjs.org/@types/semver/-/semver-7.5.6.tgz", + "integrity": "sha512-dn1l8LaMea/IjDoHNd9J52uBbInB796CDffS6VdIxvqYCPSG0V0DzHp76GpaWnlhg88uYyPbXCDIowa86ybd5A==", "dev": true }, "node_modules/@types/send": { @@ -2380,9 +2381,9 @@ "integrity": "sha512-d1M6eDKBGWx7RbYy295VEFoOF9YDJkPI959QYnmzcmeaV+SP4D0xV7dEh3sN5XF3GvO3PhGzm+17Z598nvHQuQ==" }, "node_modules/@types/trusted-types": { - "version": "2.0.6", - "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.6.tgz", - "integrity": "sha512-HYtNooPvUY9WAVRBr4u+4Qa9fYD1ze2IUlAD3HoA6oehn1taGwBx3Oa52U4mTslTS+GAExKpaFu39Y5xUEwfjg==" + "version": "2.0.7", + "resolved": "https://registry.npmjs.org/@types/trusted-types/-/trusted-types-2.0.7.tgz", + "integrity": "sha512-ScaPdn1dQczgbl0QFTeTOmVHFULt394XJgOQNoyVhZ6r2vLnMLJfBPd53SB52T/3G36VI1/g2MZaX0cwDuXsfw==" }, "node_modules/@types/verror": { "version": "1.10.9", @@ -3079,9 +3080,9 @@ "dev": true }, "node_modules/app-builder-lib": { - "version": "24.8.1", - "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-24.8.1.tgz", - "integrity": "sha512-97BnnROP3Fedv5yEMHfvacTcazs6PE6DAYDYtXpZjLgidaxoZU4yZqRP+epXgvqsYW3zJMmZtFaqSFuW6+1u6w==", + "version": "24.9.1", + "resolved": "https://registry.npmjs.org/app-builder-lib/-/app-builder-lib-24.9.1.tgz", + "integrity": "sha512-Q1nYxZcio4r+W72cnIRVYofEAyjBd3mG47o+zms8HlD51zWtA/YxJb01Jei5F+jkWhge/PTQK+uldsPh6d0/4g==", "dev": true, "dependencies": { "@develar/schema-utils": "~2.6.5", @@ -3336,9 +3337,9 @@ "optional": true }, "node_modules/aws-sdk": { - "version": "2.1498.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1498.0.tgz", - "integrity": "sha512-m3yxYWrXsn9FJRcWBZZ4ySOEKxodP8KMhwoGJMALd0MLtfPUl/Yf0YuwVyTct2ZzRGMU8i7XoZYPY1fr76LD1w==", + "version": "2.1500.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1500.0.tgz", + "integrity": "sha512-e6ISdnxgHbq+QWYYILdSMfTuTJgLSR9PLKEz4RCxaybKIe05z75jYgc2WSPt9++3rQPSdqSc4wYSlwuE0m7jjA==", "dev": true, "optional": true, "dependencies": { @@ -4491,12 +4492,12 @@ } }, "node_modules/dmg-builder": { - "version": "24.8.1", - "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-24.8.1.tgz", - "integrity": "sha512-WqIZ+M5nplY4jFrkO+wajYdF9RNvcou6LEjvonHUGKNapsxuuLfArdVi3iNFAZm9vZzAcHA8VJRsOdKR9xkFDw==", + "version": "24.9.1", + "resolved": "https://registry.npmjs.org/dmg-builder/-/dmg-builder-24.9.1.tgz", + "integrity": "sha512-huC+O6hvHd24Ubj3cy2GMiGLe2xGFKN3klqVMLAdcbB6SWMd1yPSdZvV8W1O01ICzCCRlZDHiv4VrNUgnPUfbQ==", "dev": true, "dependencies": { - "app-builder-lib": "24.8.1", + "app-builder-lib": "24.9.1", "builder-util": "24.8.1", "builder-util-runtime": "9.2.3", "fs-extra": "^10.1.0", @@ -4648,16 +4649,16 @@ } }, "node_modules/electron-builder": { - "version": "24.8.1", - "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-24.8.1.tgz", - "integrity": "sha512-05sYUAZ27ykYTFUy3/W7tVpGCNYXZEPIsnTZrO4P8uiXFLXI2DvgggIytjynlB55rqaHbu4mTmYXN97LPo/HLg==", + "version": "24.9.1", + "resolved": "https://registry.npmjs.org/electron-builder/-/electron-builder-24.9.1.tgz", + "integrity": "sha512-v7BuakDuY6sKMUYM8mfQGrwyjBpZ/ObaqnenU0H+igEL10nc6ht049rsCw2HghRBdEwJxGIBuzs3jbEhNaMDmg==", "dev": true, "dependencies": { - "app-builder-lib": "24.8.1", + "app-builder-lib": "24.9.1", "builder-util": "24.8.1", "builder-util-runtime": "9.2.3", "chalk": "^4.1.2", - "dmg-builder": "24.8.1", + "dmg-builder": "24.9.1", "fs-extra": "^10.1.0", "is-ci": "^3.0.0", "lazy-val": "^1.0.5", @@ -4723,6 +4724,34 @@ "url": "https://github.com/electron/electron-packager?sponsor=1" } }, + "node_modules/electron-packager/node_modules/@electron/notarize": { + "version": "1.2.4", + "resolved": "https://registry.npmjs.org/@electron/notarize/-/notarize-1.2.4.tgz", + "integrity": "sha512-W5GQhJEosFNafewnS28d3bpQ37/s91CDWqxVchHfmv2dQSTWpOzNlUVQwYzC1ay5bChRV/A9BTL68yj0Pa+TSg==", + "dev": true, + "dependencies": { + "debug": "^4.1.1", + "fs-extra": "^9.0.1" + }, + "engines": { + "node": ">= 10.0.0" + } + }, + "node_modules/electron-packager/node_modules/@electron/notarize/node_modules/fs-extra": { + "version": "9.1.0", + "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-9.1.0.tgz", + "integrity": "sha512-hcg3ZmepS30/7BSFqRvoo3DOMQu7IjqxO5nCDt+zM9XWjb33Wg7ziNT+Qvqbuc3+gWpzO02JubVyk2G4Zvo1OQ==", + "dev": true, + "dependencies": { + "at-least-node": "^1.0.0", + "graceful-fs": "^4.2.0", + "jsonfile": "^6.0.1", + "universalify": "^2.0.0" + }, + "engines": { + "node": ">=10" + } + }, "node_modules/electron-packager/node_modules/fs-extra": { "version": "11.1.1", "resolved": "https://registry.npmjs.org/fs-extra/-/fs-extra-11.1.1.tgz", @@ -4807,9 +4836,9 @@ } }, "node_modules/electron/node_modules/@types/node": { - "version": "18.18.9", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.9.tgz", - "integrity": "sha512-0f5klcuImLnG4Qreu9hPj/rEfFq6YRc5n2mAjSsH+ec/mJL+3voBH0+8T7o8RpFjH7ovc+TRsL/c7OYIQsPTfQ==", + "version": "18.18.11", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.11.tgz", + "integrity": "sha512-c1vku6qnTeujJneYH94/4aq73XrVcsJe35UPyAsSok1ijiKrkRzK+AxQPSpNMUnC03roWBBwJx/9I8V7lQoxmA==", "dependencies": { "undici-types": "~5.26.4" } @@ -8253,13 +8282,10 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.2.tgz", - "integrity": "sha512-Yj9mA8fPiVgOUpByoTZO5pNrcl5Yk37FcSHsUINpAsaBIEZIuqcCclDZJCVxqQShDsmYX8QG63svJiTbOATZwg==", + "version": "10.0.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.3.tgz", + "integrity": "sha512-B7gr+F6MkqB3uzINHXNctGieGsRTMwIBgxkp0yq/5BwcuDzD4A8wQpHQW6vDAm1uKSLQghmRdD9sKqf2vJ1cEg==", "dev": true, - "dependencies": { - "semver": "^7.3.5" - }, "engines": { "node": "14 || >=16.14" } diff --git a/package.json b/package.json index cbd7ff32215..d23166e45ea 100644 --- a/package.json +++ b/package.json @@ -62,7 +62,7 @@ "winreg": "1.2.4" }, "devDependencies": { - "@electron/notarize": "1.2.3", + "@electron/notarize": "2.2.0", "@octokit/auth-token": "2.5.0", "@octokit/rest": "18.12.0", "@rollup/plugin-commonjs": "24.0.1", @@ -78,7 +78,7 @@ "body-parser": "1.20.0", "chokidar": "3.5.2", "commander": "9.2.0", - "electron-builder": "24.8.1", + "electron-builder": "24.9.1", "electron-packager": "17.1.2", "esbuild": "0.17.15", "esbuild-plugin-alias-path": "2.0.2", From 6f4a75202b1a1e50a009b8dd37d5cec36e59f68b Mon Sep 17 00:00:00 2001 From: tutao Date: Tue, 21 Nov 2023 11:17:49 +0100 Subject: [PATCH 08/14] Fix type error breaking build on ARM macs Type error due to TUTANOTA_MAIL_ADDRESS_DOMAINS not being `readonly` --- src/api/common/TutanotaConstants.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/api/common/TutanotaConstants.ts b/src/api/common/TutanotaConstants.ts index b532dd3a820..a88e0c5364f 100644 --- a/src/api/common/TutanotaConstants.ts +++ b/src/api/common/TutanotaConstants.ts @@ -275,7 +275,14 @@ export const Const: ConstType = { U2F_LEGACY_APPID: "https://tutanota.com/u2f-appid.json", } as const -export const TUTANOTA_MAIL_ADDRESS_DOMAINS = Object.freeze(["tutanota.com", "tutanota.de", "tutamail.com", "tuta.io", "keemail.me", "tuta.com"]) +export const TUTANOTA_MAIL_ADDRESS_DOMAINS: ReadonlyArray = Object.freeze([ + "tutanota.com", + "tutanota.de", + "tutamail.com", + "tuta.io", + "keemail.me", + "tuta.com", +]) export const TUTANOTA_MAIL_ADDRESS_SIGNUP_DOMAINS = TUTANOTA_MAIL_ADDRESS_DOMAINS export const DEFAULT_PAID_MAIL_ADDRESS_SIGNUP_DOMAIN = "tuta.com" From 7b11fbef25d90c64a9be39a5596ff53d39993bdc Mon Sep 17 00:00:00 2001 From: tutao Date: Tue, 21 Nov 2023 11:26:53 +0100 Subject: [PATCH 09/14] Fix build breaking on Linux Removed "dmg-license" which requires the platform to be `darwin` to be installed. It only should be installed during the build process. --- ci/Desktop.Jenkinsfile | 1 + package-lock.json | 63 +++++++++++++++++++++++++++++++++++------- package.json | 1 - 3 files changed, 54 insertions(+), 11 deletions(-) diff --git a/ci/Desktop.Jenkinsfile b/ci/Desktop.Jenkinsfile index 326ffb2ead3..5dc106b46e7 100644 --- a/ci/Desktop.Jenkinsfile +++ b/ci/Desktop.Jenkinsfile @@ -1,5 +1,6 @@ pipeline { environment { + // on m1 macs, this is a symlink that must be updated. see wiki. NODE_MAC_PATH = '/usr/local/opt/node@18/bin/' VERSION = sh(returnStdout: true, script: "${env.NODE_PATH}/node -p -e \"require('./package.json').version\" | tr -d \"\n\"") } diff --git a/package-lock.json b/package-lock.json index 986c29f5ced..e83f7bb1d9d 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,7 +27,6 @@ "@types/winreg": "1.2.31", "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", - "dmg-license": "^1.0.11", "dompurify": "3.0.4", "electron": "27.0.4", "electron-updater": "6.1.1", @@ -2286,6 +2285,8 @@ "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.5.tgz", "integrity": "sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA==", + "dev": true, + "optional": true, "dependencies": { "@types/node": "*", "xmlbuilder": ">=11.0.1" @@ -2388,7 +2389,9 @@ "node_modules/@types/verror": { "version": "1.10.9", "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz", - "integrity": "sha512-MLx9Z+9lGzwEuW16ubGeNkpBDE84RpB/NyGgg6z2BTpWzKkGU451cAY3UkUzZEp72RHF585oJ3V8JVNqIplcAQ==" + "integrity": "sha512-MLx9Z+9lGzwEuW16ubGeNkpBDE84RpB/NyGgg6z2BTpWzKkGU451cAY3UkUzZEp72RHF585oJ3V8JVNqIplcAQ==", + "dev": true, + "optional": true }, "node_modules/@types/which": { "version": "2.0.2", @@ -2893,6 +2896,7 @@ "version": "0.8.10", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", + "dev": true, "engines": { "node": ">=10.0.0" } @@ -3018,6 +3022,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", + "dev": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3042,6 +3047,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "dev": true, "engines": { "node": ">=8" } @@ -3050,6 +3056,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dev": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -3218,6 +3225,8 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", + "dev": true, + "optional": true, "engines": { "node": ">=0.8" } @@ -3226,6 +3235,8 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", + "dev": true, + "optional": true, "engines": { "node": ">=8" } @@ -3975,6 +3986,8 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", + "dev": true, + "optional": true, "dependencies": { "slice-ansi": "^3.0.0", "string-width": "^4.2.0" @@ -4015,6 +4028,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dev": true, "dependencies": { "color-name": "~1.1.4" }, @@ -4025,7 +4039,8 @@ "node_modules/color-name": { "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", - "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", + "dev": true }, "node_modules/color-support": { "version": "1.1.3", @@ -4193,6 +4208,8 @@ "version": "3.8.0", "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", + "dev": true, + "optional": true, "dependencies": { "buffer": "^5.1.0" } @@ -4526,6 +4543,8 @@ "version": "1.0.11", "resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz", "integrity": "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q==", + "dev": true, + "optional": true, "os": [ "darwin" ], @@ -4851,7 +4870,8 @@ "node_modules/emoji-regex": { "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", - "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", + "dev": true }, "node_modules/encodeurl": { "version": "1.0.2", @@ -5499,14 +5519,17 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz", "integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==", + "dev": true, "engines": [ "node >=0.6.0" - ] + ], + "optional": true }, "node_modules/fast-deep-equal": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", - "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==" + "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", + "dev": true }, "node_modules/fast-glob": { "version": "3.3.2", @@ -5526,7 +5549,8 @@ "node_modules/fast-json-stable-stringify": { "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", - "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==" + "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", + "dev": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -6474,6 +6498,8 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", "integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==", + "dev": true, + "optional": true, "os": [ "darwin" ], @@ -6709,6 +6735,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "dev": true, "engines": { "node": ">=8" } @@ -7012,7 +7039,8 @@ "node_modules/json-schema-traverse": { "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", - "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==" + "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", + "dev": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -7745,7 +7773,9 @@ "node_modules/node-addon-api": { "version": "1.7.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", - "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==" + "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", + "dev": true, + "optional": true }, "node_modules/node-domexception": { "version": "1.0.0", @@ -8414,6 +8444,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", + "dev": true, "dependencies": { "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", @@ -8553,6 +8584,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", + "dev": true, "engines": { "node": ">=6" } @@ -9448,6 +9480,8 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", + "dev": true, + "optional": true, "dependencies": { "ansi-styles": "^4.0.0", "astral-regex": "^2.0.0", @@ -9461,6 +9495,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", + "dev": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -9637,6 +9672,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dev": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -9677,6 +9713,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dev": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -10216,6 +10253,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", + "dev": true, "dependencies": { "punycode": "^2.1.0" } @@ -10313,6 +10351,8 @@ "version": "1.10.1", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", "integrity": "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==", + "dev": true, + "optional": true, "dependencies": { "assert-plus": "^1.0.0", "core-util-is": "1.0.2", @@ -10325,7 +10365,9 @@ "node_modules/verror/node_modules/core-util-is": { "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", - "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==" + "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", + "dev": true, + "optional": true }, "node_modules/w3c-xmlserializer": { "version": "4.0.0", @@ -10576,6 +10618,7 @@ "version": "15.1.1", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", + "dev": true, "engines": { "node": ">=8.0" } diff --git a/package.json b/package.json index d23166e45ea..ff0bfe1f5e8 100644 --- a/package.json +++ b/package.json @@ -46,7 +46,6 @@ "@types/winreg": "1.2.31", "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", - "dmg-license": "^1.0.11", "dompurify": "3.0.4", "electron": "27.0.4", "electron-updater": "6.1.1", From d4f3c80f7a21100fa3c3ed5ef729bf9479c22fa4 Mon Sep 17 00:00:00 2001 From: jat Date: Wed, 22 Nov 2023 09:35:10 +0100 Subject: [PATCH 10/14] Add `dmg-license` as an optional dependency `dmg-license` is installed by `electron-builder` during the build, but causes the build to break on Linux & Windows. By adding it to the optional dependencies it only installs on macOS. --- package-lock.json | 52 +++++++++++++++++++---------------------------- package.json | 3 +++ 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/package-lock.json b/package-lock.json index e83f7bb1d9d..a637ce60154 100644 --- a/package-lock.json +++ b/package-lock.json @@ -82,6 +82,9 @@ }, "engines": { "npm": ">=8.0.0" + }, + "optionalDependencies": { + "dmg-license": "^1.0.11" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -2285,7 +2288,6 @@ "version": "3.0.5", "resolved": "https://registry.npmjs.org/@types/plist/-/plist-3.0.5.tgz", "integrity": "sha512-E6OCaRmAe4WDmWNsL/9RMqdkkzDCY1etutkflWk4c+AcjDU07Pcz1fQwTX0TQz+Pxqn9i4L1TU3UFpjnrcDgxA==", - "dev": true, "optional": true, "dependencies": { "@types/node": "*", @@ -2390,7 +2392,6 @@ "version": "1.10.9", "resolved": "https://registry.npmjs.org/@types/verror/-/verror-1.10.9.tgz", "integrity": "sha512-MLx9Z+9lGzwEuW16ubGeNkpBDE84RpB/NyGgg6z2BTpWzKkGU451cAY3UkUzZEp72RHF585oJ3V8JVNqIplcAQ==", - "dev": true, "optional": true }, "node_modules/@types/which": { @@ -2896,7 +2897,7 @@ "version": "0.8.10", "resolved": "https://registry.npmjs.org/@xmldom/xmldom/-/xmldom-0.8.10.tgz", "integrity": "sha512-2WALfTl4xo2SkGCYRt6rDTFfk9R1czmBvUQy12gK2KuRKIpWEhcbbzy8EZXtz/jkRqHX8bFEc6FC1HjX4TUWYw==", - "dev": true, + "devOptional": true, "engines": { "node": ">=10.0.0" } @@ -3022,7 +3023,7 @@ "version": "6.12.6", "resolved": "https://registry.npmjs.org/ajv/-/ajv-6.12.6.tgz", "integrity": "sha512-j3fVLgvTo527anyYyJOGTYJbG+vnnQYvE0m5mmkc1TK+nxAppkCLMIL0aZ4dblVCNoGShhm+kzE4ZUykBoMg4g==", - "dev": true, + "devOptional": true, "dependencies": { "fast-deep-equal": "^3.1.1", "fast-json-stable-stringify": "^2.0.0", @@ -3047,7 +3048,7 @@ "version": "5.0.1", "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8" } @@ -3056,7 +3057,7 @@ "version": "4.3.0", "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", - "dev": true, + "devOptional": true, "dependencies": { "color-convert": "^2.0.1" }, @@ -3225,7 +3226,6 @@ "version": "1.0.0", "resolved": "https://registry.npmjs.org/assert-plus/-/assert-plus-1.0.0.tgz", "integrity": "sha512-NfJ4UzBCcQGLDlQq7nHxH+tv3kyZ0hHQqF5BO6J7tNJeP5do1llPr8dZ8zHonfhAu0PHAdMkSo+8o0wxg9lZWw==", - "dev": true, "optional": true, "engines": { "node": ">=0.8" @@ -3235,7 +3235,6 @@ "version": "2.0.0", "resolved": "https://registry.npmjs.org/astral-regex/-/astral-regex-2.0.0.tgz", "integrity": "sha512-Z7tMw1ytTXt5jqMcOP+OQteU1VuNK9Y02uuJtKQ1Sv69jXQKKg5cibLwGJow8yzZP+eAc18EmLGPal0bp36rvQ==", - "dev": true, "optional": true, "engines": { "node": ">=8" @@ -3986,7 +3985,6 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/cli-truncate/-/cli-truncate-2.1.0.tgz", "integrity": "sha512-n8fOixwDD6b/ObinzTrp1ZKFzbgvKZvuz/TvejnLn1aQfC6r52XEx85FmuC+3HI+JM7coBRXUvNqEU2PHVrHpg==", - "dev": true, "optional": true, "dependencies": { "slice-ansi": "^3.0.0", @@ -4028,7 +4026,7 @@ "version": "2.0.1", "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", - "dev": true, + "devOptional": true, "dependencies": { "color-name": "~1.1.4" }, @@ -4040,7 +4038,7 @@ "version": "1.1.4", "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==", - "dev": true + "devOptional": true }, "node_modules/color-support": { "version": "1.1.3", @@ -4208,7 +4206,6 @@ "version": "3.8.0", "resolved": "https://registry.npmjs.org/crc/-/crc-3.8.0.tgz", "integrity": "sha512-iX3mfgcTMIq3ZKLIsVFAbv7+Mc10kxabAGQb8HvjA1o3T1PIYprbakQ65d3I+2HGHt6nSKkM9PYjgoJO2KcFBQ==", - "dev": true, "optional": true, "dependencies": { "buffer": "^5.1.0" @@ -4543,7 +4540,6 @@ "version": "1.0.11", "resolved": "https://registry.npmjs.org/dmg-license/-/dmg-license-1.0.11.tgz", "integrity": "sha512-ZdzmqwKmECOWJpqefloC5OJy1+WZBBse5+MR88z9g9Zn4VY+WYUkAyojmhzJckH5YbbZGcYIuGAkY5/Ys5OM2Q==", - "dev": true, "optional": true, "os": [ "darwin" @@ -4871,7 +4867,7 @@ "version": "8.0.0", "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==", - "dev": true + "devOptional": true }, "node_modules/encodeurl": { "version": "1.0.2", @@ -5519,7 +5515,6 @@ "version": "1.4.1", "resolved": "https://registry.npmjs.org/extsprintf/-/extsprintf-1.4.1.tgz", "integrity": "sha512-Wrk35e8ydCKDj/ArClo1VrPVmN8zph5V4AtHwIuHhvMXsKf73UT3BOD+azBIW+3wOJ4FhEH7zyaJCFvChjYvMA==", - "dev": true, "engines": [ "node >=0.6.0" ], @@ -5529,7 +5524,7 @@ "version": "3.1.3", "resolved": "https://registry.npmjs.org/fast-deep-equal/-/fast-deep-equal-3.1.3.tgz", "integrity": "sha512-f3qQ9oQy9j2AhBe/H9VC91wLmKBCCU/gDOnKNAYG5hswO7BLKj09Hc5HYNz9cGI++xlpDCIgDaitVs03ATR84Q==", - "dev": true + "devOptional": true }, "node_modules/fast-glob": { "version": "3.3.2", @@ -5550,7 +5545,7 @@ "version": "2.1.0", "resolved": "https://registry.npmjs.org/fast-json-stable-stringify/-/fast-json-stable-stringify-2.1.0.tgz", "integrity": "sha512-lhd/wF+Lk98HZoTCtlVraHtfh5XYijIjalXck7saUtuanSDyLMxnHhSXEDJqHxD7msR8D0uCmqlkwjCV8xvwHw==", - "dev": true + "devOptional": true }, "node_modules/fast-levenshtein": { "version": "2.0.6", @@ -6498,7 +6493,6 @@ "version": "1.1.7", "resolved": "https://registry.npmjs.org/iconv-corefoundation/-/iconv-corefoundation-1.1.7.tgz", "integrity": "sha512-T10qvkw0zz4wnm560lOEg0PovVqUXuOFhhHAkixw8/sycy7TJt7v/RrkEKEQnAw2viPSJu6iAkErxnzR0g8PpQ==", - "dev": true, "optional": true, "os": [ "darwin" @@ -6735,7 +6729,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8" } @@ -7040,7 +7034,7 @@ "version": "0.4.1", "resolved": "https://registry.npmjs.org/json-schema-traverse/-/json-schema-traverse-0.4.1.tgz", "integrity": "sha512-xbbCH5dCYU5T8LcEhhuh7HJ88HXuW3qsI3Y0zOZFKfZEHcpWiHU/Jxzk629Brsab/mMiHQti9wMP+845RPe3Vg==", - "dev": true + "devOptional": true }, "node_modules/json-stable-stringify-without-jsonify": { "version": "1.0.1", @@ -7774,7 +7768,6 @@ "version": "1.7.2", "resolved": "https://registry.npmjs.org/node-addon-api/-/node-addon-api-1.7.2.tgz", "integrity": "sha512-ibPK3iA+vaY1eEjESkQkM0BbCqFOaZMiXRTtdB0u7b4djtY6JnsjvPdUHVMg6xQt3B8fpTTWHI9A+ADjM9frzg==", - "dev": true, "optional": true }, "node_modules/node-domexception": { @@ -8444,7 +8437,7 @@ "version": "3.1.0", "resolved": "https://registry.npmjs.org/plist/-/plist-3.1.0.tgz", "integrity": "sha512-uysumyrvkUX0rX/dEVqt8gC3sTBzd4zoWfLeS29nb53imdaXVvLINYXTI2GNqzaMuvacNx4uJQ8+b3zXR0pkgQ==", - "dev": true, + "devOptional": true, "dependencies": { "@xmldom/xmldom": "^0.8.8", "base64-js": "^1.5.1", @@ -8584,7 +8577,7 @@ "version": "2.3.1", "resolved": "https://registry.npmjs.org/punycode/-/punycode-2.3.1.tgz", "integrity": "sha512-vYt7UD1U9Wg6138shLtLOvdAu+8DsC/ilFtEVHcH+wydcSpNE20AfSOduf6MkRFahL5FY7X1oU7nKVZFtfq8Fg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=6" } @@ -9480,7 +9473,6 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/slice-ansi/-/slice-ansi-3.0.0.tgz", "integrity": "sha512-pSyv7bSTC7ig9Dcgbw9AuRNUb5k5V6oDudjZoMBSr13qpLBG7tB+zgCkARjq7xIUgdz5P1Qe8u+rSGdouOOIyQ==", - "dev": true, "optional": true, "dependencies": { "ansi-styles": "^4.0.0", @@ -9495,7 +9487,7 @@ "version": "4.2.0", "resolved": "https://registry.npmjs.org/smart-buffer/-/smart-buffer-4.2.0.tgz", "integrity": "sha512-94hK0Hh8rPqQl2xXc3HsaBoOXKV20MToPkcXvwbISWLEs+64sBq5kFgn2kJDHb1Pry9yrP0dxrCI9RRci7RXKg==", - "dev": true, + "devOptional": true, "engines": { "node": ">= 6.0.0", "npm": ">= 3.0.0" @@ -9672,7 +9664,7 @@ "version": "4.2.3", "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", - "dev": true, + "devOptional": true, "dependencies": { "emoji-regex": "^8.0.0", "is-fullwidth-code-point": "^3.0.0", @@ -9713,7 +9705,7 @@ "version": "6.0.1", "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", - "dev": true, + "devOptional": true, "dependencies": { "ansi-regex": "^5.0.1" }, @@ -10253,7 +10245,7 @@ "version": "4.4.1", "resolved": "https://registry.npmjs.org/uri-js/-/uri-js-4.4.1.tgz", "integrity": "sha512-7rKUyy33Q1yc98pQ1DAmLtwX109F7TIfWlW1Ydo8Wl1ii1SeHieeh0HHfPeL2fMXK6z0s8ecKs9frCuLJvndBg==", - "dev": true, + "devOptional": true, "dependencies": { "punycode": "^2.1.0" } @@ -10351,7 +10343,6 @@ "version": "1.10.1", "resolved": "https://registry.npmjs.org/verror/-/verror-1.10.1.tgz", "integrity": "sha512-veufcmxri4e3XSrT0xwfUR7kguIkaxBeosDg00yDWhk49wdwkSUrvvsm7nc75e1PUyvIeZj6nS8VQRYz2/S4Xg==", - "dev": true, "optional": true, "dependencies": { "assert-plus": "^1.0.0", @@ -10366,7 +10357,6 @@ "version": "1.0.2", "resolved": "https://registry.npmjs.org/core-util-is/-/core-util-is-1.0.2.tgz", "integrity": "sha512-3lqz5YjWTYnW6dlDa5TLaTCcShfar1e40rmcJVwCBJC6mWlFuj0eCHIElmG1g5kyuJ/GD+8Wn4FFCcz4gJPfaQ==", - "dev": true, "optional": true }, "node_modules/w3c-xmlserializer": { @@ -10618,7 +10608,7 @@ "version": "15.1.1", "resolved": "https://registry.npmjs.org/xmlbuilder/-/xmlbuilder-15.1.1.tgz", "integrity": "sha512-yMqGBqtXyeN1e3TGYvgNgDVZ3j84W4cwkOXQswghol6APgZWaff9lnbvN7MHYJOiXsvGPXtjTYJEiC9J2wv9Eg==", - "dev": true, + "devOptional": true, "engines": { "node": ">=8.0" } diff --git a/package.json b/package.json index ff0bfe1f5e8..cf51e8aa1eb 100644 --- a/package.json +++ b/package.json @@ -60,6 +60,9 @@ "undici": "5.27.2", "winreg": "1.2.4" }, + "optionalDependencies": { + "dmg-license": "^1.0.11" + }, "devDependencies": { "@electron/notarize": "2.2.0", "@octokit/auth-token": "2.5.0", From 333531735a79a9b1f7f97003a7729bb8109ac016 Mon Sep 17 00:00:00 2001 From: tutao Date: Thu, 23 Nov 2023 13:48:02 +0100 Subject: [PATCH 11/14] update keytar & downgrade electron this is necessary to be able to re-use our keytar build from 3.118.13 #6050 --- buildSrc/nativeLibraryProvider.js | 48 ++++++++++++++++++++-------- package-lock.json | 53 ++++++++++++++++--------------- package.json | 4 +-- 3 files changed, 64 insertions(+), 41 deletions(-) diff --git a/buildSrc/nativeLibraryProvider.js b/buildSrc/nativeLibraryProvider.js index 30339bcb73f..7fa03361846 100644 --- a/buildSrc/nativeLibraryProvider.js +++ b/buildSrc/nativeLibraryProvider.js @@ -149,19 +149,41 @@ export async function buildNativeModule({ nodeModule, copyTarget, environment, r }) if (architecture === "universal") { - const artifactPath = path.join(moduleDir, "build/Release", `${copyTarget}.node`) - const intelArtifactPath = path.join(moduleDir, `${copyTarget}-x64.node`) - const armArtifactPath = path.join(moduleDir, `${copyTarget}-arm64.node`) - await doBuild("x64") - await fs.promises.copyFile(artifactPath, intelArtifactPath) - await doBuild("arm64") - await fs.promises.copyFile(artifactPath, armArtifactPath) - await callProgram({ - command: "lipo", - args: ["-create", "-output", artifactPath, intelArtifactPath, armArtifactPath], - cwd: path.join(rootDir, "native-cache"), - log, - }) + if (copyTarget === "keytar") { + // this is a hack to get us out of a pickle with incompatible macos SDKs + // we reuse the keytar of tutanota-desktop 3.118.13 for the + // mac build because any newer build crashes the process when loaded. + // we will replace keytar very soon. + const artifactPath = path.join(moduleDir, "build/Release", `${copyTarget}.node`) + const armArtifactPath = path.join(moduleDir, `${copyTarget}-arm64.node`) + const intelArtifactPath = path.join(moduleDir, `${copyTarget}-3.118.13.node`) + await doBuild("arm64") + await fs.promises.copyFile(artifactPath, armArtifactPath) + await callProgram({ + command: "lipo", + args: ["-create", "-output", artifactPath, intelArtifactPath, armArtifactPath], + cwd: path.join(rootDir, "native-cache"), + log, + }) + } else { + const artifactPath = path.join(moduleDir, "build/Release", `${copyTarget}.node`) + const armArtifactPath = path.join(moduleDir, `${copyTarget}-arm64.node`) + const intelArtifactPath = path.join(moduleDir, `${copyTarget}-x64.node`) + // this is a hack to get us out of a pickle with incompatible macos SDKs + // we reuse the keytar of tutanota-desktop 3.118.13 for the + // mac build because any newer build crashes the process when loaded. + // we will replace keytar very soon. + await doBuild("x64") + await fs.promises.copyFile(artifactPath, intelArtifactPath) + await doBuild("arm64") + await fs.promises.copyFile(artifactPath, armArtifactPath) + await callProgram({ + command: "lipo", + args: ["-create", "-output", artifactPath, intelArtifactPath, armArtifactPath], + cwd: path.join(rootDir, "native-cache"), + log, + }) + } } else { await doBuild(architecture) } diff --git a/package-lock.json b/package-lock.json index a637ce60154..6d6d783ea88 100644 --- a/package-lock.json +++ b/package-lock.json @@ -27,11 +27,12 @@ "@types/winreg": "1.2.31", "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", + "dmg-license": "^1.0.11", "dompurify": "3.0.4", - "electron": "27.0.4", + "electron": "26.5.0", "electron-updater": "6.1.1", "jszip": "3.10.1", - "keytar": "git+https://github.com/tutao/node-keytar#12593c5809c9ed6bfc063ed3e862dd85a1506aca", + "keytar": "git+https://github.com/tutao/node-keytar#d264f8d3ce1b10a367fddde9f367c065c42afe5c", "linkifyjs": "3.0.5", "luxon": "3.2.1", "mithril": "2.2.2", @@ -2082,9 +2083,9 @@ "link": true }, "node_modules/@types/aws-lambda": { - "version": "8.10.126", - "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.126.tgz", - "integrity": "sha512-5eh4ffLdGYgGYI1Xr6W5L4IVse4RR7L2ns5OVUXA52nW5GFapIcGMcCzHAIMMOdpcQs3aGVxbvFlJNZH6IpgEQ==", + "version": "8.10.129", + "resolved": "https://registry.npmjs.org/@types/aws-lambda/-/aws-lambda-8.10.129.tgz", + "integrity": "sha512-0Rl7CpTPVws5cp0Ui1gZh4Q+TXC65bXVwTOGoI2RKW45dxWzyZGbjIX0uFjFYdIJ8vnD45y584rIIqvD2vBBfQ==", "dev": true }, "node_modules/@types/better-sqlite3": { @@ -2262,9 +2263,9 @@ "dev": true }, "node_modules/@types/node": { - "version": "20.9.3", - "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.3.tgz", - "integrity": "sha512-nk5wXLAXGBKfrhLB0cyHGbSqopS+nz0BUgZkUQqSHSSgdee0kssp1IAqlQOu333bW+gMNs2QREx7iynm19Abxw==", + "version": "20.9.4", + "resolved": "https://registry.npmjs.org/@types/node/-/node-20.9.4.tgz", + "integrity": "sha512-wmyg8HUhcn6ACjsn8oKYjkN/zUzQeNtMy44weTJSM6p4MMzEOuKbA3OjJ267uPCOW7Xex9dyrNTful8XTQYoDA==", "dependencies": { "undici-types": "~5.26.4" } @@ -2347,9 +2348,9 @@ } }, "node_modules/@types/scheduler": { - "version": "0.16.7", - "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.7.tgz", - "integrity": "sha512-8g25Nl3AuB1KulTlSUsUhUo/oBgBU6XIXQ+XURpeioEbEJvkO7qI4vDfREv3vJYHHzqXjcAHvoJy4pTtSQNZtA==" + "version": "0.16.8", + "resolved": "https://registry.npmjs.org/@types/scheduler/-/scheduler-0.16.8.tgz", + "integrity": "sha512-WZLiwShhwLRmeV6zH+GkbOFT6Z6VklCItrDioxUnv+u4Ll+8vKeFySoFyK/0ctcRpOmwAicELfmys1sDc/Rw+A==" }, "node_modules/@types/semver": { "version": "7.5.6", @@ -3347,9 +3348,9 @@ "optional": true }, "node_modules/aws-sdk": { - "version": "2.1500.0", - "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1500.0.tgz", - "integrity": "sha512-e6ISdnxgHbq+QWYYILdSMfTuTJgLSR9PLKEz4RCxaybKIe05z75jYgc2WSPt9++3rQPSdqSc4wYSlwuE0m7jjA==", + "version": "2.1502.0", + "resolved": "https://registry.npmjs.org/aws-sdk/-/aws-sdk-2.1502.0.tgz", + "integrity": "sha512-mUXUaWmbIyqE6zyIcbUUQIUgw1evK7gV1vQP7ZZEE0qi6hO2Mw99Nc25Bh+187yvRxamMTsFXvvmBViR0Q75SA==", "dev": true, "optional": true, "dependencies": { @@ -4647,9 +4648,9 @@ } }, "node_modules/electron": { - "version": "27.0.4", - "resolved": "https://registry.npmjs.org/electron/-/electron-27.0.4.tgz", - "integrity": "sha512-ob29rN1mtiyAXzF8HsHd5jh8bYKd9OQDakfdOExi0F7epU97gXPHaj6JPjbBJ/vpki5d32SyKVePW4vxeNZk1A==", + "version": "26.5.0", + "resolved": "https://registry.npmjs.org/electron/-/electron-26.5.0.tgz", + "integrity": "sha512-j65/SMEqf+sKBUmAwYU0E5d/OKPmhRVyMntVulHKTNEazxF2TuRr/+GoEVxBq4l9jfLEXhheVOuOW0J5Tme1kA==", "hasInstallScript": true, "dependencies": { "@electron/get": "^2.0.0", @@ -4851,9 +4852,9 @@ } }, "node_modules/electron/node_modules/@types/node": { - "version": "18.18.11", - "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.11.tgz", - "integrity": "sha512-c1vku6qnTeujJneYH94/4aq73XrVcsJe35UPyAsSok1ijiKrkRzK+AxQPSpNMUnC03roWBBwJx/9I8V7lQoxmA==", + "version": "18.18.12", + "resolved": "https://registry.npmjs.org/@types/node/-/node-18.18.12.tgz", + "integrity": "sha512-G7slVfkwOm7g8VqcEF1/5SXiMjP3Tbt+pXDU3r/qhlM2KkGm786DUD4xyMA2QzEElFrv/KZV9gjygv4LnkpbMQ==", "dependencies": { "undici-types": "~5.26.4" } @@ -7134,9 +7135,9 @@ } }, "node_modules/keytar": { - "version": "7.7.0", - "resolved": "git+ssh://git@github.com/tutao/node-keytar.git#12593c5809c9ed6bfc063ed3e862dd85a1506aca", - "integrity": "sha512-BxoKGjgqMEWugsCsyse5+akaIo02sudoy/NdbDGoAPNe2UNm/Dd3bJkRtt1y+wJtO6jpt58Rt2zylrUWEBii/Q==", + "version": "7.9.0", + "resolved": "git+ssh://git@github.com/tutao/node-keytar.git#d264f8d3ce1b10a367fddde9f367c065c42afe5c", + "integrity": "sha512-mFPixRMzeWwtTxCXLWbQHScqgscG/6NIExjn6GqjVwG+eAX8T4a/nFGLG54WNWjzoQzgRijk2BszQ1yunEol0A==", "hasInstallScript": true, "license": "MIT", "dependencies": { @@ -8305,9 +8306,9 @@ } }, "node_modules/path-scurry/node_modules/lru-cache": { - "version": "10.0.3", - "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.3.tgz", - "integrity": "sha512-B7gr+F6MkqB3uzINHXNctGieGsRTMwIBgxkp0yq/5BwcuDzD4A8wQpHQW6vDAm1uKSLQghmRdD9sKqf2vJ1cEg==", + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.1.0.tgz", + "integrity": "sha512-/1clY/ui8CzjKFyjdvwPWJUYKiFVXG2I2cY0ssG7h4+hwk+XOIX7ZSG9Q7TW8TW3Kp3BUSqgFWBLgL4PJ+Blag==", "dev": true, "engines": { "node": "14 || >=16.14" diff --git a/package.json b/package.json index cf51e8aa1eb..1e6ace9df49 100644 --- a/package.json +++ b/package.json @@ -47,10 +47,10 @@ "better-sqlite3": "git+https://github.com/tutao/better-sqlite3-sqlcipher#a3e79ddcb3ac198be0c1e93cc660a56e319219ba", "cborg": "1.5.4", "dompurify": "3.0.4", - "electron": "27.0.4", + "electron": "26.5.0", "electron-updater": "6.1.1", "jszip": "3.10.1", - "keytar": "git+https://github.com/tutao/node-keytar#12593c5809c9ed6bfc063ed3e862dd85a1506aca", + "keytar": "git+https://github.com/tutao/node-keytar#d264f8d3ce1b10a367fddde9f367c065c42afe5c", "linkifyjs": "3.0.5", "luxon": "3.2.1", "mithril": "2.2.2", From 6dfab05eb4aa733f70b070ab67b28cab84400669 Mon Sep 17 00:00:00 2001 From: nig Date: Wed, 22 Nov 2023 16:32:16 +0100 Subject: [PATCH 12/14] Add code to migrate from keytar to safeStorage Translated to TypeScript from PR #3742 --- src/desktop/DesktopMain.ts | 8 +- src/desktop/sse/SecretStorage.ts | 118 +++++++++++++++++++- test/tests/Suite.ts | 1 + test/tests/desktop/sse/SecretStorageTest.ts | 62 ++++++++++ 4 files changed, 180 insertions(+), 9 deletions(-) create mode 100644 test/tests/desktop/sse/SecretStorageTest.ts diff --git a/src/desktop/DesktopMain.ts b/src/desktop/DesktopMain.ts index e65650aecb9..aaa1d558c78 100644 --- a/src/desktop/DesktopMain.ts +++ b/src/desktop/DesktopMain.ts @@ -18,7 +18,7 @@ import { DesktopTray } from "./tray/DesktopTray" import { log } from "./DesktopLog" import { UpdaterWrapper } from "./UpdaterWrapper" import { ElectronNotificationFactory } from "./NotificatonFactory" -import { KeytarSecretStorage } from "./sse/SecretStorage" +import { KeytarSecretStorage, SafeStorageSecretStorage } from "./sse/SecretStorage" import fs from "node:fs" import { DesktopIntegrator, getDesktopIntegratorForPlatform } from "./integration/DesktopIntegrator" import net from "node:net" @@ -130,8 +130,10 @@ if (opts.registerAsMailHandler && opts.unregisterAsMailHandler) { async function createComponents(): Promise { const en = (await import("../translations/en.js")).default lang.init(en) - const secretStorage = new KeytarSecretStorage() - const keyStoreFacade = new KeyStoreFacadeImpl(secretStorage, desktopCrypto) + const { default: keytar } = await import("keytar") + const secretStorage = new KeytarSecretStorage(keytar) + const safeStorageSecretStorage = new SafeStorageSecretStorage(electron, fs, path, secretStorage) + const keyStoreFacade = new KeyStoreFacadeImpl(safeStorageSecretStorage, desktopCrypto) const configMigrator = new DesktopConfigMigrator(desktopCrypto, keyStoreFacade, electron) const conf = new DesktopConfig(configMigrator, keyStoreFacade, desktopCrypto) // Fire config loading, dont wait for it diff --git a/src/desktop/sse/SecretStorage.ts b/src/desktop/sse/SecretStorage.ts index b7814147106..eb7c96700f3 100644 --- a/src/desktop/sse/SecretStorage.ts +++ b/src/desktop/sse/SecretStorage.ts @@ -1,8 +1,9 @@ -import { default as keytar } from "keytar" import { CancelledError } from "../../api/common/error/CancelledError" import { noOp } from "@tutao/tutanota-utils" - -const { CANCELLED, getPassword, setPassword } = keytar +import * as PathModule from "node:path" +import * as FsModule from "node:fs" +import { DeviceStorageUnavailableError } from "../../api/common/error/DeviceStorageUnavailableError.js" +import type { default as Keytar } from "keytar" export interface SecretStorage { getPassword(service: string, account: string): Promise @@ -11,17 +12,28 @@ export interface SecretStorage { } export class KeytarSecretStorage implements SecretStorage { + private readonly CANCELLED: string + private readonly _getPassword: (service: string, account: string) => Promise + private readonly _setPassword: (service: string, account: string, password: string) => Promise + /** * keytar can't handle concurrent accesses to the keychain, so we need to sequence * calls to getPassword and setPassword. * this promise chain stores pending operations. */ + + constructor(keytar: typeof Keytar) { + this.CANCELLED = keytar.CANCELLED + this._getPassword = keytar.getPassword + this._setPassword = keytar.setPassword + } + private lastOp: Promise = Promise.resolve() getPassword(service: string, account: string): Promise { const newOp = this.lastOp.catch(noOp).then(() => - getPassword(service, account).catch((e) => { - if (e.message === CANCELLED) { + this._getPassword(service, account).catch((e) => { + if (e.message === this.CANCELLED) { throw new CancelledError("user cancelled keychain unlock") } throw e @@ -33,8 +45,102 @@ export class KeytarSecretStorage implements SecretStorage { } setPassword(service: string, account: string, password: string): Promise { - const newOp = this.lastOp.catch(noOp).then(() => setPassword(service, account, password)) + const newOp = this.lastOp.catch(noOp).then(() => this._setPassword(service, account, password)) this.lastOp = newOp return newOp } } + +/** + * Secret Storage impl using the electron 15+ SafeStorage API + * + * Note: the main thread will be blocked while the keychain is being unlocked, + * potentially for as long as the user takes to enter a password. + * We're asking for access before any windows are created, which should prevent + * any weirdness arising from that. + */ +export class SafeStorageSecretStorage implements SecretStorage { + private initialized = false + + constructor( + private readonly electron: typeof Electron.CrossProcessExports, + private readonly fs: typeof FsModule, + private readonly path: typeof PathModule, + private readonly keytarSecretStorage: KeytarSecretStorage, + ) {} + + async getPassword(service: string, account: string): Promise { + await this.assertAvailable() + const keyPath = this.getKeyPath(service, account) + try { + const encPwBuffer = await this.fs.promises.readFile(keyPath) + return this.electron.safeStorage.decryptString(encPwBuffer) + } catch (e) { + if (e.code === "ENOENT") { + // we might not have the key in safeStorage yet, but we might have it in the keytar storage. + return await this.migrateKeytarPassword(service, account) + } + throw e + } + } + + async setPassword(service: string, account: string, password: string): Promise { + await this.assertAvailable() + const keyPath = this.getKeyPath(service, account) + const cypherBuffer = this.electron.safeStorage.encryptString(password) + return this.fs.promises.writeFile(keyPath, cypherBuffer) + } + + private getKeyPath(service: string, account: string): string { + const fname = service.concat("-", account) + const safeStoragePath = this.getSafeStoragePath() + return this.path.join(safeStoragePath, fname) + } + + /** + * this should always be a path inside the user's home directory (or equivalent) + * @private + */ + private getSafeStoragePath(): string { + return this.path.join(this.electron.app.getPath("userData"), "safe_storage") + } + + /** + * ensures that the safe_storage directory exists and that we can use the + * safeStorage API + * @private + */ + private async assertAvailable(): Promise { + await this.electron.app.whenReady() + await this.fs.promises.mkdir(this.getSafeStoragePath(), { recursive: true }) + if (this.electron.safeStorage.isEncryptionAvailable()) { + if (!this.initialized && process.platform === "linux") { + // only linux has variable backends + this.initialized = true + console.log("using safeStorage with backend", this.electron.safeStorage.getSelectedStorageBackend()) + } + return + } + throw new DeviceStorageUnavailableError("safeStorage API is not available", null) + } + + /** + * most devices will have stored a deviceKey with keytar, which we can move + * to the safeStorage impl. + * + * @private + */ + private async migrateKeytarPassword(service: string, account: string): Promise { + let keytarPw: string | null = null + try { + keytarPw = await this.keytarSecretStorage.getPassword(service, account) + } catch (e) { + console.log("keytar failed, assuming there's no pw stored") + } + if (keytarPw != null) { + await this.setPassword(service, account, keytarPw) + } + + return keytarPw + } +} diff --git a/test/tests/Suite.ts b/test/tests/Suite.ts index 65ef6cde87b..df7a6ae3ba4 100644 --- a/test/tests/Suite.ts +++ b/test/tests/Suite.ts @@ -150,6 +150,7 @@ async function setupSuite({ integration }: { integration?: boolean }) { await import("./desktop/DesktopNotifierTest.js") await import("./desktop/ApplicationWindowTest.js") await import("./desktop/sse/DesktopSseClientTest.js") + await import("./desktop/sse/SecretStorageTest.js") await import("./desktop/sse/DesktopAlarmStorageTest.js") await import("./desktop/sse/DesktopAlarmSchedulerTest.js") await import("./desktop/files/DesktopFileFacadeTest.js") diff --git a/test/tests/desktop/sse/SecretStorageTest.ts b/test/tests/desktop/sse/SecretStorageTest.ts new file mode 100644 index 00000000000..cd9c1dc2c4b --- /dev/null +++ b/test/tests/desktop/sse/SecretStorageTest.ts @@ -0,0 +1,62 @@ +import o from "@tutao/otest" +import { KeytarSecretStorage, SafeStorageSecretStorage } from "../../../../src/desktop/sse/SecretStorage.js" +import type { ElectronExports, FsExports } from "../../../../src/desktop/ElectronExportTypes.js" +import path from "node:path" +import { matchers, object, verify, when } from "testdouble" +import { assertThrows } from "@tutao/tutanota-test-utils" +import { DeviceStorageUnavailableError } from "../../../../src/api/common/error/DeviceStorageUnavailableError.js" + +o.spec("SecretStorage", function () { + o.spec("SafeStorageSecretStorage", function () { + let electron: ElectronExports + let fs: FsExports + let keytarSecretStorage: KeytarSecretStorage + let subject: SafeStorageSecretStorage + o.beforeEach(() => { + electron = object() + fs = object() + keytarSecretStorage = object() + subject = new SafeStorageSecretStorage(electron, fs, path, keytarSecretStorage) + }) + + o("will not ask keytar if there is a password file", async function () { + when(fs.promises.readFile(matchers.anything())).thenResolve(Buffer.from([1, 2, 3, 4, 5])) + when(electron.safeStorage.isEncryptionAvailable()).thenReturn(true) + when(electron.app.getPath(matchers.anything())).thenReturn("/any/path") + when(fs.promises.mkdir(matchers.anything(), matchers.anything())).thenResolve("some/path") + await subject.getPassword("service", "account") + verify(keytarSecretStorage.getPassword(matchers.anything(), matchers.anything()), { times: 0 }) + verify(fs.promises.writeFile(matchers.anything(), matchers.anything()), { times: 0 }) + }) + + o("will ask keytar if there is no password file", async function () { + when(fs.promises.readFile(matchers.anything())).thenReject({ code: "ENOENT" }) + + when(electron.safeStorage.isEncryptionAvailable()).thenReturn(true) + when(electron.app.getPath(matchers.anything())).thenReturn("/any/path") + when(fs.promises.mkdir(matchers.anything(), matchers.anything())).thenResolve("some/path") + when(keytarSecretStorage.getPassword(matchers.anything(), matchers.anything())).thenResolve(null) + const pw = await subject.getPassword("service", "account") + o(pw).equals(null) + verify(fs.promises.writeFile(matchers.anything(), matchers.anything()), { times: 0 }) + }) + + o("will write the keytar password if found", async function () { + when(fs.promises.readFile(matchers.anything())).thenReject({ code: "ENOENT" }) + + when(electron.safeStorage.isEncryptionAvailable()).thenReturn(true) + when(electron.app.getPath(matchers.anything())).thenReturn("/any/path") + when(fs.promises.mkdir(matchers.anything(), matchers.anything())).thenResolve("some/path") + when(keytarSecretStorage.getPassword(matchers.anything(), matchers.anything())).thenResolve("hellopassword") + await subject.getPassword("service", "account") + verify(fs.promises.writeFile(matchers.anything(), matchers.anything()), { times: 1 }) + }) + + o("will throw an error if there is no safeStorage available", async function () { + when(electron.safeStorage.isEncryptionAvailable()).thenReturn(false) + when(electron.app.getPath(matchers.anything())).thenReturn("/any/path") + await assertThrows(DeviceStorageUnavailableError, () => subject.getPassword("service", "account")) + await assertThrows(DeviceStorageUnavailableError, () => subject.setPassword("service", "account", "password")) + }) + }) +}) From e0fb7ccd7bb38d81c380877f9b54104f3b546b7d Mon Sep 17 00:00:00 2001 From: tutao Date: Fri, 24 Nov 2023 16:23:09 +0100 Subject: [PATCH 13/14] warn users of outdated macos on arm64 --- src/desktop/DesktopMain.ts | 8 ++-- src/desktop/sse/SecretStorage.ts | 71 +++++++++++++++++++++++++++++++- 2 files changed, 73 insertions(+), 6 deletions(-) diff --git a/src/desktop/DesktopMain.ts b/src/desktop/DesktopMain.ts index aaa1d558c78..d712d65929a 100644 --- a/src/desktop/DesktopMain.ts +++ b/src/desktop/DesktopMain.ts @@ -18,7 +18,7 @@ import { DesktopTray } from "./tray/DesktopTray" import { log } from "./DesktopLog" import { UpdaterWrapper } from "./UpdaterWrapper" import { ElectronNotificationFactory } from "./NotificatonFactory" -import { KeytarSecretStorage, SafeStorageSecretStorage } from "./sse/SecretStorage" +import { buildSecretStorage } from "./sse/SecretStorage" import fs from "node:fs" import { DesktopIntegrator, getDesktopIntegratorForPlatform } from "./integration/DesktopIntegrator" import net from "node:net" @@ -130,10 +130,8 @@ if (opts.registerAsMailHandler && opts.unregisterAsMailHandler) { async function createComponents(): Promise { const en = (await import("../translations/en.js")).default lang.init(en) - const { default: keytar } = await import("keytar") - const secretStorage = new KeytarSecretStorage(keytar) - const safeStorageSecretStorage = new SafeStorageSecretStorage(electron, fs, path, secretStorage) - const keyStoreFacade = new KeyStoreFacadeImpl(safeStorageSecretStorage, desktopCrypto) + const secretStorage = await buildSecretStorage(electron, fs, path) + const keyStoreFacade = new KeyStoreFacadeImpl(secretStorage, desktopCrypto) const configMigrator = new DesktopConfigMigrator(desktopCrypto, keyStoreFacade, electron) const conf = new DesktopConfig(configMigrator, keyStoreFacade, desktopCrypto) // Fire config loading, dont wait for it diff --git a/src/desktop/sse/SecretStorage.ts b/src/desktop/sse/SecretStorage.ts index eb7c96700f3..f47e5e39a12 100644 --- a/src/desktop/sse/SecretStorage.ts +++ b/src/desktop/sse/SecretStorage.ts @@ -4,6 +4,55 @@ import * as PathModule from "node:path" import * as FsModule from "node:fs" import { DeviceStorageUnavailableError } from "../../api/common/error/DeviceStorageUnavailableError.js" import type { default as Keytar } from "keytar" +import os from "node:os" + +export async function buildSecretStorage(electron: typeof Electron.CrossProcessExports, fs: typeof FsModule, path: typeof PathModule): Promise { + const mode = determineMode(electron) + switch (mode) { + case "dummy": + return new SafeStorageSecretStorage(electron, fs, path, new DummySecretStorage()) + case "quit": + electron.app.quit() + return new SafeStorageSecretStorage(electron, fs, path, new DummySecretStorage()) + case "keytar": { + const { default: keytar } = await import("keytar") + const secretStorage = new KeytarSecretStorage(keytar) + return new SafeStorageSecretStorage(electron, fs, path, secretStorage) + } + } +} + +function determineMode(electron: typeof Electron.CrossProcessExports): "dummy" | "keytar" | "quit" { + const release = Number(os.release().split(".")[0]) + // on macos, the last working keytar build was for 3.118.13, which + // only supported x64. we cannot get a working keytar for old macos + // on arm64 devices, but all of them can upgrade and use the new arm64 binary. + const isBroken = + process.platform === "darwin" && + // only arm64 must use a keytar.node post-breakage + process.arch === "arm64" && + // basically big sur (do M1s even come with catalina?) + release < 21 + + if (!isBroken) return "keytar" + + switch ( + electron.dialog.showMessageBoxSync({ + buttons: ["Don't decrypt", "Decrypt anyway", "Quit Tuta"], + cancelId: 2, + defaultId: 0, + message: "Your MacOS version is outdated and decrypting stored credentials may crash Tuta.", + title: "SecretStorage", + }) + ) { + case 0: + return "dummy" + case 1: + return "keytar" + default: + return "quit" + } +} export interface SecretStorage { getPassword(service: string, account: string): Promise @@ -66,7 +115,7 @@ export class SafeStorageSecretStorage implements SecretStorage { private readonly electron: typeof Electron.CrossProcessExports, private readonly fs: typeof FsModule, private readonly path: typeof PathModule, - private readonly keytarSecretStorage: KeytarSecretStorage, + private readonly keytarSecretStorage: SecretStorage, ) {} async getPassword(service: string, account: string): Promise { @@ -144,3 +193,23 @@ export class SafeStorageSecretStorage implements SecretStorage { return keytarPw } } + +/** + * used as an ephemeral storage that prevets outdated arm64 macs + * from crashing when they attempt to load keytar. + * */ +class DummySecretStorage implements SecretStorage { + private readonly map: Map = new Map() + + async getPassword(service: string, account: string): Promise { + return this.map.get(DummySecretStorage.getName(service, account)) ?? null + } + + async setPassword(service: string, account: string, password: string): Promise { + this.map.set(DummySecretStorage.getName(service, account), password) + } + + private static getName(service: string, account: string): string { + return service.concat("-", account) + } +} From 2220ddd0fc50106fa0074fad4ca8607073661e39 Mon Sep 17 00:00:00 2001 From: nig Date: Mon, 27 Nov 2023 10:17:38 +0100 Subject: [PATCH 14/14] [keytar] always use the dummy if loading keytar would crash the app #3676 #6050 --- src/desktop/sse/SecretStorage.ts | 51 ++++++++++---------------------- 1 file changed, 16 insertions(+), 35 deletions(-) diff --git a/src/desktop/sse/SecretStorage.ts b/src/desktop/sse/SecretStorage.ts index f47e5e39a12..24c7c3bb4bc 100644 --- a/src/desktop/sse/SecretStorage.ts +++ b/src/desktop/sse/SecretStorage.ts @@ -5,15 +5,13 @@ import * as FsModule from "node:fs" import { DeviceStorageUnavailableError } from "../../api/common/error/DeviceStorageUnavailableError.js" import type { default as Keytar } from "keytar" import os from "node:os" +import { ProgrammingError } from "../../api/common/error/ProgrammingError.js" export async function buildSecretStorage(electron: typeof Electron.CrossProcessExports, fs: typeof FsModule, path: typeof PathModule): Promise { - const mode = determineMode(electron) + const mode = determineNativeBackendMode() switch (mode) { case "dummy": return new SafeStorageSecretStorage(electron, fs, path, new DummySecretStorage()) - case "quit": - electron.app.quit() - return new SafeStorageSecretStorage(electron, fs, path, new DummySecretStorage()) case "keytar": { const { default: keytar } = await import("keytar") const secretStorage = new KeytarSecretStorage(keytar) @@ -22,36 +20,22 @@ export async function buildSecretStorage(electron: typeof Electron.CrossProcessE } } -function determineMode(electron: typeof Electron.CrossProcessExports): "dummy" | "keytar" | "quit" { +/** + * on macos big sur, the last working keytar build was for 3.118.13, which + * only supported x64. we cannot get a working keytar for old macos + * on arm64 devices, but all of them can upgrade and use the new arm64 binary. + * + * should be removed once keytar is no more + * */ +function determineNativeBackendMode(): "dummy" | "keytar" { const release = Number(os.release().split(".")[0]) - // on macos, the last working keytar build was for 3.118.13, which - // only supported x64. we cannot get a working keytar for old macos - // on arm64 devices, but all of them can upgrade and use the new arm64 binary. const isBroken = process.platform === "darwin" && // only arm64 must use a keytar.node post-breakage process.arch === "arm64" && // basically big sur (do M1s even come with catalina?) release < 21 - - if (!isBroken) return "keytar" - - switch ( - electron.dialog.showMessageBoxSync({ - buttons: ["Don't decrypt", "Decrypt anyway", "Quit Tuta"], - cancelId: 2, - defaultId: 0, - message: "Your MacOS version is outdated and decrypting stored credentials may crash Tuta.", - title: "SecretStorage", - }) - ) { - case 0: - return "dummy" - case 1: - return "keytar" - default: - return "quit" - } + return isBroken ? "dummy" : "keytar" } export interface SecretStorage { @@ -197,19 +181,16 @@ export class SafeStorageSecretStorage implements SecretStorage { /** * used as an ephemeral storage that prevets outdated arm64 macs * from crashing when they attempt to load keytar. + * + * It's used in a read-only mode because new and migrated passwords + * are written to safeStorage. * */ class DummySecretStorage implements SecretStorage { - private readonly map: Map = new Map() - async getPassword(service: string, account: string): Promise { - return this.map.get(DummySecretStorage.getName(service, account)) ?? null + return null } async setPassword(service: string, account: string, password: string): Promise { - this.map.set(DummySecretStorage.getName(service, account), password) - } - - private static getName(service: string, account: string): string { - return service.concat("-", account) + throw new ProgrammingError("code that uses this should not be writing through to keytar anymore") } }