Skip to content

Commit

Permalink
chore: Update electron and related dependencies (#7675)
Browse files Browse the repository at this point in the history
* update electorn dependencies

* bring back electron updated patch

* lock

* simplify notorization

* attempt to fix lock file

---------

Co-authored-by: Begoña Álvarez de la Cruz <balvarez@boxfish.studio>
  • Loading branch information
marc2332 and begonaalvarezd authored Feb 1, 2024
1 parent 44cd6bd commit 0dcbb20
Show file tree
Hide file tree
Showing 6 changed files with 149 additions and 613 deletions.
12 changes: 2 additions & 10 deletions packages/desktop/electron-builder-config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
const notarize = require('./scripts/notarize.macos.js')
const getNotarizeOptions = require('./scripts/notarize.macos.js')
const merge = require('lodash.merge')
const { STAGE, getAppName, APP_ID, APP_PROTOCOL, CHANNEL_NAME, APP_ARTIFACT } = require('./product.js')

Expand All @@ -9,15 +9,6 @@ const prodConfig = () => ({
directories: { buildResources: './public', output: './out' },
files: ['public/', 'package.json', '!node_modules/@iota/sdk/target/*'],
appId: APP_ID,
afterSign: async () => {
// eslint-disable-next-line no-useless-catch
try {
await notarize(getAppName())
} catch (err) {
// This catch is necessary or the promise rejection is swallowed
throw err
}
},
asar: true,
protocols: [{ name: `${getAppName()} URL Scheme`, schemes: [APP_PROTOCOL] }],
dmg: {
Expand Down Expand Up @@ -63,6 +54,7 @@ const prodConfig = () => ({
hardenedRuntime: true,
gatekeeperAssess: false,
asarUnpack: ['**/*.node'],
notarize: getNotarizeOptions(),
},
publish: {
provider: 'generic',
Expand Down
19 changes: 10 additions & 9 deletions packages/desktop/electron/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,19 @@ app.on('window-all-closed', () => {
}
})

powerMonitor.on('suspend', () => {
// MacOS, Windows and Linux
windows.main?.webContents?.send('power-monitor-suspend')
})
app.once('ready', () => {
powerMonitor.on('suspend', () => {
// MacOS, Windows and Linux
windows.main?.webContents?.send('power-monitor-suspend')
})

powerMonitor.on('lock-screen', () => {
// MacOS and Windows
windows.main?.webContents?.send('power-monitor-lock-screen')
})
powerMonitor.on('lock-screen', () => {
// MacOS and Windows
windows.main?.webContents?.send('power-monitor-lock-screen')
})

app.once('ready', () => {
ipcMain.handle('error-data', () => lastError)

app.on('activate', () => {
// On macOS it's common to re-create a window in the app when the
// dock icon is clicked and there are no other windows open.
Expand Down
11 changes: 5 additions & 6 deletions packages/desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,9 @@
"@sentry/electron": "^4.10.0",
"@types/webpack-dev-server": "^4.7.2",
"dotenv": "^16.0.3",
"electron-dl": "^3.5.0",
"electron-log": "^4.3.1",
"electron-updater": "5.3.0",
"electron-dl": "^3.5.1",
"electron-log": "^4.4.8",
"electron-updater": "6.1.4",
"https-browserify": "^1.0.0",
"keytar": "^7.9.0",
"node-machine-id": "^1.1.12",
Expand All @@ -43,14 +43,13 @@
},
"devDependencies": {
"@sentry/webpack-plugin": "^2.8.0",
"@electron/notarize": "^2.1.0",
"@tsconfig/svelte": "^4.0.1",
"@types/webpack": "^5.28.1",
"copy-webpack-plugin": "^11.0.0",
"cross-env": "^7.0.2",
"css-loader": "^6.7.3",
"electron": "22.3.27",
"electron-builder": "^24.0.0",
"electron": "27.0.2",
"electron-builder": "^24.6.4",
"esbuild-loader": "^4.0.2",
"lodash.merge": "^4.6.2",
"mini-css-extract-plugin": "^2.7.6",
Expand Down
7 changes: 3 additions & 4 deletions packages/desktop/scripts/notarize.macos.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const { notarize } = require('@electron/notarize')
const path = require('path')

/**
Expand All @@ -8,7 +7,7 @@ const path = require('path')
*/
module.exports = async (appName) => {
if (process.platform !== 'darwin' || process.env.MACOS_SKIP_NOTARIZATION) {
return true
return undefined
}

const APPLE_ID = process.env.FIREFLY_APPLE_ID
Expand All @@ -22,10 +21,10 @@ module.exports = async (appName) => {
throw Error('Notarization failed: Environment variable "FIREFLY_APPLE_ID_PASSWORD" is not defined')
}

await notarize({
return {
appPath: path.resolve(__dirname, `../out/mac/${appName}.app`),
appleId: APPLE_ID,
appleIdPassword: APPLE_ID_PASSWORD,
teamId: 'UG77RJKZHH',
})
}
}
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
diff --git a/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js b/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
index 9d35ee9..ea445aa 100644
index a12ba9f..cd2f090 100644
--- a/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
+++ b/node_modules/electron-updater/out/windowsExecutableCodeSignatureVerifier.js
@@ -43,8 +43,7 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
@@ -37,8 +37,7 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
try {
if (error != null || stderr) {
handleError(logger, error, stderr);
handleError(logger, error, stderr, reject);
- resolve(null);
- return;
+ throw error;
}
const data = parseOut(Buffer.from(stdout, "base64").toString("utf-8"));
const data = parseOut(stdout);
if (data.Status === 0) {
@@ -75,8 +74,8 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
@@ -69,8 +68,8 @@ function verifySignature(publisherNames, unescapedTempUpdateFile, logger) {
}
catch (e) {
handleError(logger, e, null);
handleError(logger, e, null, reject);
- resolve(null);
- return;
+ logger.warn(`Cannot execute Get-AuthenticodeSignature: ${e}. Aborting update.`);
Expand Down
Loading

0 comments on commit 0dcbb20

Please sign in to comment.