Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,6 @@
"devDependencies": {
"@trezor/eslint": "workspace:*",
"electron": "39.0.0",
"electron-builder": "26.0.3"
"electron-builder": "26.4.0"
}
}
2 changes: 1 addition & 1 deletion packages/suite-desktop-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"chalk": "^5.6.2",
"electron-localshortcut": "^3.2.1",
"electron-store": "11.0.2",
"electron-updater": "6.6.4",
"electron-updater": "6.7.3",
"node-loader": "^2.1.0",
"openpgp": "^6.2.2",
"ws": "^8.18.0"
Expand Down
9 changes: 2 additions & 7 deletions packages/suite-desktop-core/scripts/setElectronFuses.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,8 @@ const binaryExtensionByPlaformNameMap = {
const afterPackHookSetElectronFuses = async context => {
const { electronPlatformName, appOutDir } = context;

/*
As of Electron 34.1.0, ASAR integrity:
- is not supported on Linux at all
- is supported on macOS, but does not work. TODO investigate & reenable
So we only set the appropriate fuses for Windows
*/
if (electronPlatformName !== 'win32') {
// As of Electron 39, ASAR integrity is not supported on Linux, so we set the appropriate fuses for Windows and macOS
if (electronPlatformName !== 'win32' && electronPlatformName !== 'darwin') {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed that it is working on 🍎 :

$ npx @electron/fuses read --app "/Applications/Trezor Suite.app"
Analyzing app: Trezor Suite.app
Fuse Version: v1
  RunAsNode is Enabled
  EnableCookieEncryption is Disabled
  EnableNodeOptionsEnvironmentVariable is Enabled
  EnableNodeCliInspectArguments is Enabled
  EnableEmbeddedAsarIntegrityValidation is Enabled
  OnlyLoadAppFromAsar is Enabled
  LoadBrowserProcessSpecificV8Snapshot is Disabled
  GrantFileProtocolExtraPrivileges is Enabled

// eslint-disable-next-line no-console
console.log('Skipping electron fuses ');

Expand Down
25 changes: 11 additions & 14 deletions packages/suite-desktop/electron-builder-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@ const isCodesignBuild = process.env.IS_CODESIGN_BUILD === 'true';

// to be able to use patterns like ${author} and ${arch}
module.exports = {
// distingush between dev and prod builds
// distinguish between dev and prod builds
appId: `io.trezor.TrezorSuite${isCodesignBuild ? '' : '.dev'}`,
extraMetadata: {
version: suiteVersion,
// distingush between dev and prod builds so different userDataDir is used
// distinguish between dev and prod builds so different userDataDir is used
name: `@trezor/suite-desktop${isCodesignBuild ? '' : '-dev'}`,
},
productName: 'Trezor Suite',
Expand All @@ -22,17 +22,14 @@ module.exports = {
npmRebuild: false,
files: [
// defaults are https://www.electron.build/configuration#files
'build/**/*',
'dist/**/*.{js,wasm}',
'!**/{tsconfig}*',
'!**/*.{md,js.map}',
'build/release-notes.md',
'!**/node_modules/**/*.{js.flow,ts}',
'!build/static/**/{favicon,icons,bin,browsers}',
'!node_modules/@sentry/**/esm',
'!node_modules/ajv/lib',
'!node_modules/blake-hash/**/{build,src}',
'!node_modules/usb/**/{libusb,libusb_config,src}',
'build/**/*', // Electron renderer process
'dist/**/*.{js,wasm}', // Electron main+preload process
'!**/*.{md,js.map}', // exclude files unnecessary for runtime
'build/release-notes.md', // this one is dynamically loaded in runtime
'!build/static/**/{favicon,icons,bin,browsers}', // copied as extraResources instead, some are platform-specific
'!node_modules/blake-hash/**/{build,src}', // exclude files unnecessary for runtime
'!node_modules/usb/**/{libusb,libusb_config,src}', // exclude files unnecessary for runtime
'!node_modules/@trezor/**', // exclude @trezor/suite-desktop, which would recurse. Other @trezor packages are bundled by bundler.
],
extraResources: [
{
Expand Down Expand Up @@ -98,7 +95,7 @@ module.exports = {
],
icon: 'build/static/images/desktop/512x512.icns',
artifactName: 'Trezor-Suite-${version}-mac-${arch}.${ext}',
hardenedRuntime: true,
hardenedRuntime: isCodesignBuild,
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lest the installed app crashes with

$  "/Applications/Trezor Suite.app/Contents/MacOS/Trezor Suite"
Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/Electron Framework.framework/Electron Framework
Referenced from: <4C4C44E4-5555-3144-A158-EDA204878E47> /Applications/Trezor Suite.app/Contents/MacOS/Trezor Suite
Reason: tried: '/Applications/Trezor Suite.app/Contents/Frameworks/Electron Framework.framework/Electron Framework' (code signature in <4C4C44A0-5555-3144-A1EB-8E38D66573A7> '/Applications/Trezor Suite.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs), '/Applications/Trezor Suite.app/Contents/Frameworks/Electron Framework.framework/Electron Framework' (code signature in <4C4C44A0-5555-3144-A1EB-8E38D66573A7> '/Applications/Trezor Suite.app/Contents/Frameworks/Electron Framework.framework/Versions/A/Electron Framework' not valid for use in process: mapping process and mapped file (non-platform) have different Team IDs)
(terminated at launch; ignore backtrace)

gatekeeperAssess: false,
darkModeSupport: true,
entitlements: 'entitlements.mac.inherit.plist',
Expand Down
2 changes: 1 addition & 1 deletion packages/suite-desktop/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,6 @@
},
"devDependencies": {
"electron": "39.0.0",
"electron-builder": "26.0.3"
"electron-builder": "26.4.0"
}
}
9 changes: 9 additions & 0 deletions patches/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,15 @@
# Patches

## app-builder-lib

Fixes problem with generating `Info.plist` when building for macOS.
Remove this patch after when this is fixed upstream in [electron-builder PR](https://github.com/electron-userland/electron-builder/pull/9481).

## expo-modules-core

Gets rid of `The global process.env.EXPO_OS is not defined. This should be inlined by babel-preset-expo during transformation.`
warning while running unit tests. Probably caused by an issue reported [here](https://github.com/expo/expo/issues/26513) or [here](https://github.com/expo/expo/issues/25452).

## blakejs

May be outdated, TODO investigate
14 changes: 14 additions & 0 deletions patches/app-builder-lib+26.4.0.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
diff --git a/node_modules/app-builder-lib/out/macPackager.js b/node_modules/app-builder-lib/out/macPackager.js
index a52a853..216a77d 100644
--- a/node_modules/app-builder-lib/out/macPackager.js
+++ b/node_modules/app-builder-lib/out/macPackager.js
@@ -474,6 +474,9 @@ class MacPackager extends platformPackager_1.PlatformPackager {
const extendInfo = this.platformSpecificBuildOptions.extendInfo;
if (extendInfo != null) {
Object.assign(appPlist, extendInfo);
+ for(const [k,v] of Object.entries(appPlist)) {
+ if(v === null || v === undefined) delete appPlist[k]
+ }
}
}
async signApp(packContext, isAsar) {
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I made an upstream PR in electron-userland/electron-builder#9481

Loading
Loading