From 47b0ee61355b515cb5046b10c2a2cf9c70fd4589 Mon Sep 17 00:00:00 2001 From: Fedor Indutny <79877362+indutny-signal@users.noreply.github.com> Date: Thu, 15 Dec 2022 13:31:43 -0800 Subject: [PATCH] Update electron to 22.0.0 --- .github/workflows/benchmark.yml | 2 +- .github/workflows/ci.yml | 10 ++-- .github/workflows/danger.yml | 2 +- .nvmrc | 2 +- app/main.ts | 18 ++++--- package.json | 4 +- yarn.lock | 86 +++++++++++++-------------------- 7 files changed, 54 insertions(+), 70 deletions(-) diff --git a/.github/workflows/benchmark.yml b/.github/workflows/benchmark.yml index b9833e16f..95be05f0e 100644 --- a/.github/workflows/benchmark.yml +++ b/.github/workflows/benchmark.yml @@ -28,7 +28,7 @@ jobs: - name: Setup node.js uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '16.17.1' - name: Install global dependencies run: npm install -g yarn@1.22.10 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 07c1ec22c..205e0a60c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,7 +21,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '16.17.1' - run: npm install -g yarn@1.22.10 - name: Cache Desktop node_modules @@ -53,7 +53,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '16.17.1' - run: npm install -g yarn@1.22.10 - name: Cache Desktop node_modules @@ -93,7 +93,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '16.17.1' - run: sudo apt-get install xvfb - run: npm install -g yarn@1.22.10 @@ -136,7 +136,7 @@ jobs: - uses: actions/checkout@v3 - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '16.17.1' - run: npm install -g yarn@1.22.10 - name: Cache Desktop node_modules @@ -184,7 +184,7 @@ jobs: - name: Setup node.js uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '16.17.1' - name: Install global dependencies run: npm install -g yarn@1.22.10 diff --git a/.github/workflows/danger.yml b/.github/workflows/danger.yml index 354954bcb..e9c9ae22a 100644 --- a/.github/workflows/danger.yml +++ b/.github/workflows/danger.yml @@ -15,7 +15,7 @@ jobs: fetch-depth: 0 # fetch all history - uses: actions/setup-node@v3 with: - node-version: '16.16.0' + node-version: '16.17.1' - run: npm install -g yarn@1.22.10 - name: Cache danger node_modules id: cache-desktop-modules diff --git a/.nvmrc b/.nvmrc index 431076a94..c85fa1bbe 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.16.0 +16.17.1 diff --git a/app/main.ts b/app/main.ts index 9dc87748f..2e7738a64 100644 --- a/app/main.ts +++ b/app/main.ts @@ -447,8 +447,7 @@ async function prepareUrl( return setUrlSearchParams(url, { config: JSON.stringify(parsed.data) }).href; } -async function handleUrl(event: Electron.Event, rawTarget: string) { - event.preventDefault(); +async function handleUrl(rawTarget: string) { const parsedUrl = maybeParseUrl(rawTarget); if (!parsedUrl) { return; @@ -481,8 +480,15 @@ function handleCommonWindowEvents( window: BrowserWindow, titleBarOverlay: TitleBarOverlayOptions | false = false ) { - window.webContents.on('will-navigate', handleUrl); - window.webContents.on('new-window', handleUrl); + window.webContents.on('will-navigate', (event, rawTarget) => { + event.preventDefault(); + + handleUrl(rawTarget); + }); + window.webContents.setWindowOpenHandler(({ url }) => { + handleUrl(url); + return { action: 'deny' }; + }); window.webContents.on( 'preload-error', (_event: Electron.Event, preloadPath: string, error: Error) => { @@ -2001,9 +2007,7 @@ app.on( contents.on('will-attach-webview', attachEvent => { attachEvent.preventDefault(); }); - contents.on('new-window', newEvent => { - newEvent.preventDefault(); - }); + contents.setWindowOpenHandler(() => ({ action: 'deny' })); } ); diff --git a/package.json b/package.json index 0b8a6848c..f8e163b66 100644 --- a/package.json +++ b/package.json @@ -268,7 +268,7 @@ "css-loader": "3.2.0", "danger": "11.1.2", "debug": "4.3.3", - "electron": "21.3.3", + "electron": "22.0.0", "electron-builder": "23.0.8", "electron-mocha": "11.0.2", "electron-notarize": "1.2.1", @@ -316,7 +316,7 @@ "read-last-lines/mz/thenify-all/thenify": "3.3.1" }, "engines": { - "node": "16.16.0" + "node": "16.17.1" }, "build": { "appId": "org.whispersystems.signal-desktop", diff --git a/yarn.lock b/yarn.lock index 9214a9a9f..711788f23 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1334,21 +1334,20 @@ fs-extra "^9.0.1" minimist "^1.2.5" -"@electron/get@^1.14.1": - version "1.14.1" - resolved "https://registry.yarnpkg.com/@electron/get/-/get-1.14.1.tgz#16ba75f02dffb74c23965e72d617adc721d27f40" - integrity sha512-BrZYyL/6m0ZXz/lDxy/nlVhQz+WF+iPS6qXolEU8atw7h6v1aYkjwJZ63m+bJMBTxDE66X+r2tPS4a/8C82sZw== +"@electron/get@^2.0.0": + version "2.0.2" + resolved "https://registry.yarnpkg.com/@electron/get/-/get-2.0.2.tgz#ae2a967b22075e9c25aaf00d5941cd79c21efd7e" + integrity sha512-eFZVFoRXb3GFGd7Ak7W4+6jBl9wBtiZ4AaYOse97ej6mKj5tkyO0dUnUChs1IhJZtx1BENo4/p4WUTXpi6vT+g== dependencies: debug "^4.1.1" env-paths "^2.2.0" fs-extra "^8.1.0" - got "^9.6.0" + got "^11.8.5" progress "^2.0.3" semver "^6.2.0" sumchecker "^3.0.1" optionalDependencies: global-agent "^3.0.0" - global-tunnel-ng "^2.7.1" "@electron/universal@1.2.1": version "1.2.1" @@ -6418,14 +6417,6 @@ concat-stream@^1.5.0: readable-stream "^2.2.2" typedarray "^0.0.6" -config-chain@^1.1.11: - version "1.1.12" - resolved "https://registry.yarnpkg.com/config-chain/-/config-chain-1.1.12.tgz#0fde8d091200eb5e808caf25fe618c02f48e4efa" - integrity sha512-a1eOIcu8+7lUInge4Rpf/n4Krkf3Dd9lqhljRzII1/Zno/kRtUWnznPO3jOKBmTEktkt3fkxisUcivoj0ebzoA== - dependencies: - ini "^1.3.4" - proto-list "~1.2.1" - config@1.28.1: version "1.28.1" resolved "https://registry.yarnpkg.com/config/-/config-1.28.1.tgz#7625d2a1e4c90f131d8a73347982d93c3873282d" @@ -7529,12 +7520,12 @@ electron-window@^0.8.0: dependencies: is-electron-renderer "^2.0.0" -electron@21.3.3: - version "21.3.3" - resolved "https://registry.yarnpkg.com/electron/-/electron-21.3.3.tgz#66ddb22c337d8182eeece8b3c256a751f8e5bf76" - integrity sha512-2a9l8mUQlzXH/9WZrGYDJTyJOliLKbmEuCrQ8bfX1McAQOmI6PDQxfHV4qFUtyCDUp5SHrq5nuvg0c1pIkDBhg== +electron@22.0.0: + version "22.0.0" + resolved "https://registry.yarnpkg.com/electron/-/electron-22.0.0.tgz#ef84ab9cf23aa3f8c2f42a1e8e000ad7fd941058" + integrity sha512-cgRc4wjyM+81A0E8UGv1HNJjL1HBI5cWNh/DUIjzYvoUuiEM0SS0hAH/zaFQ18xOz2ced6Yih8SybpOiOYJhdg== dependencies: - "@electron/get" "^1.14.1" + "@electron/get" "^2.0.0" "@types/node" "^16.11.26" extract-zip "^2.0.1" @@ -7593,7 +7584,7 @@ emojis-list@^3.0.0: resolved "https://registry.yarnpkg.com/emojis-list/-/emojis-list-3.0.0.tgz#5570662046ad29e2e916e71aae260abdff4f6a78" integrity sha512-/kyM18EfinwXZbno9FyUGeFh87KC8HRQBQGildHZbEuRyWFOmv1U10o9BBp8XVZDVNNuQKyIGIu5ZYAAXJ0V2Q== -encodeurl@^1.0.2, encodeurl@~1.0.2: +encodeurl@~1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/encodeurl/-/encodeurl-1.0.2.tgz#ad3ff4c86ec2d029322f5a02c3a9a606c95b3f59" integrity sha512-TPJXq8JqFaVYm2CWmPvnP2Iyo4ZSM7/QKcSmuMLDObfpH5fi7RUGmd/rTDf+rut/saiDiQEeVTNgAmJEdAOx0w== @@ -9495,16 +9486,6 @@ global-dirs@^3.0.0: dependencies: ini "2.0.0" -global-tunnel-ng@^2.7.1: - version "2.7.1" - resolved "https://registry.yarnpkg.com/global-tunnel-ng/-/global-tunnel-ng-2.7.1.tgz#d03b5102dfde3a69914f5ee7d86761ca35d57d8f" - integrity sha512-4s+DyciWBV0eK148wqXxcmVAbFVPqtc3sEtUE/GTQfuU80rySLcMhUmHKSHI7/LDj8q0gDYI1lIhRRB7ieRAqg== - dependencies: - encodeurl "^1.0.2" - lodash "^4.17.10" - npm-conf "^1.1.3" - tunnel "^0.0.6" - global@^4.3.0, global@^4.4.0: version "4.4.0" resolved "https://registry.yarnpkg.com/global/-/global-4.4.0.tgz#3e7b105179006a323ed71aafca3e9c57a5cc6406" @@ -9584,6 +9565,23 @@ got@11.8.5: p-cancelable "^2.0.0" responselike "^2.0.0" +got@^11.8.5: + version "11.8.6" + resolved "https://registry.yarnpkg.com/got/-/got-11.8.6.tgz#276e827ead8772eddbcfc97170590b841823233a" + integrity sha512-6tfZ91bOr7bOXnK7PRDCGBLa1H4U080YHNaAQ2KsMGlLEzRbk44nsZF2E1IeRc3vtJHPVbKCYgdFbaGO2ljd8g== + dependencies: + "@sindresorhus/is" "^4.0.0" + "@szmarczak/http-timer" "^4.0.5" + "@types/cacheable-request" "^6.0.1" + "@types/responselike" "^1.0.0" + cacheable-lookup "^5.0.3" + cacheable-request "^7.0.2" + decompress-response "^6.0.0" + http2-wrapper "^1.0.0-beta.5.2" + lowercase-keys "^2.0.0" + p-cancelable "^2.0.0" + responselike "^2.0.0" + got@^9.6.0: version "9.6.0" resolved "https://registry.yarnpkg.com/got/-/got-9.6.0.tgz#edf45e7d67f99545705de1f7bbeeeb121765ed85" @@ -10353,16 +10351,16 @@ ini@2.0.0: resolved "https://registry.yarnpkg.com/ini/-/ini-2.0.0.tgz#e5fd556ecdd5726be978fa1001862eacb0a94bc5" integrity sha512-7PnF4oN3CvZF23ADhA5wRaYEQpJ8qygSkbtTXWBeXWXmEVRXK+1ITciHWwHhsjv1TmW0MgacIv6hEi5pX5NQdA== -ini@^1.3.4, ini@~1.3.0: - version "1.3.7" - resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" - integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== - ini@^1.3.5: version "1.3.8" resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.8.tgz#a29da425b48806f34767a4efce397269af28432c" integrity sha512-JV/yugV2uzW5iMRSiZAyDtQd+nxtUnjeLt0acNdw98kKLrvuRVyB80tsREOE7yvGVgalhZ6RNXCmEHkUKBKxew== +ini@~1.3.0: + version "1.3.7" + resolved "https://registry.yarnpkg.com/ini/-/ini-1.3.7.tgz#a09363e1911972ea16d7a8851005d84cf09a9a84" + integrity sha512-iKpRpXP+CrP2jyrxvg1kMUpXDyRUFDWurxbnVT1vQPx+Wz9uCYsMIqYuSBLV+PAaZG/d7kRLKRFc9oDMsH+mFQ== + inline-style-parser@0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/inline-style-parser/-/inline-style-parser-0.1.1.tgz#ec8a3b429274e9c0a1f1c4ffa9453a7fef72cea1" @@ -12868,14 +12866,6 @@ npm-bundled@^1.0.1: version "1.0.3" resolved "https://registry.yarnpkg.com/npm-bundled/-/npm-bundled-1.0.3.tgz#7e71703d973af3370a9591bafe3a63aca0be2308" -npm-conf@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/npm-conf/-/npm-conf-1.1.3.tgz#256cc47bd0e218c259c4e9550bf413bc2192aff9" - integrity sha512-Yic4bZHJOt9RCFbRP3GgpqhScOY4HH3V2P8yBj6CeYq118Qr+BLXqT2JvpJ00mryLESpgOxf5XlFv4ZjXxLScw== - dependencies: - config-chain "^1.1.11" - pify "^3.0.0" - npm-packlist@^1.1.6: version "1.1.11" resolved "https://registry.yarnpkg.com/npm-packlist/-/npm-packlist-1.1.11.tgz#84e8c683cbe7867d34b1d357d893ce29e28a02de" @@ -14206,11 +14196,6 @@ property-information@^5.0.0, property-information@^5.3.0: dependencies: xtend "^4.0.0" -proto-list@~1.2.1: - version "1.2.4" - resolved "https://registry.yarnpkg.com/proto-list/-/proto-list-1.2.4.tgz#212d5bfe1318306a420f6402b8e26ff39647a849" - integrity sha1-IS1b/hMYMGpCD2QCuOJv85ZHqEk= - protobufjs@6.11.3, protobufjs@^6.10.2: version "6.11.3" resolved "https://registry.yarnpkg.com/protobufjs/-/protobufjs-6.11.3.tgz#637a527205a35caa4f3e2a9a4a13ddffe0e7af74" @@ -17023,11 +17008,6 @@ tunnel-agent@^0.6.0: dependencies: safe-buffer "^5.0.1" -tunnel@^0.0.6: - version "0.0.6" - resolved "https://registry.yarnpkg.com/tunnel/-/tunnel-0.0.6.tgz#72f1314b34a5b192db012324df2cc587ca47f92c" - integrity sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg== - type-check@^0.4.0, type-check@~0.4.0: version "0.4.0" resolved "https://registry.yarnpkg.com/type-check/-/type-check-0.4.0.tgz#07b8203bfa7056c0657050e3ccd2c37730bab8f1"