Skip to content

Commit 43a449a

Browse files
committed
Add a workaround for Mac Electron .app interception issues
1 parent e36e8d0 commit 43a449a

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

src/components/intercept/config/electron-config.tsx

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,14 @@ class ElectronConfig extends React.Component<{
142142
}
143143

144144
selectApplication = async () => {
145-
const pathToApplication = await uploadFile('path');
145+
const pathToApplication = platform == 'mac'
146+
? window.prompt(
147+
// Mac Electron doesn't allow file pickers inside .app bundles, and does very weird things
148+
// if you select the whole bundle, scanning everything within, so we require manual entry:
149+
"Please enter the path to the Electron application:"
150+
)
151+
: await uploadFile('path');
152+
146153
if (!pathToApplication) {
147154
this.props.closeSelf();
148155
return;
@@ -177,12 +184,13 @@ class ElectronConfig extends React.Component<{
177184
return <ConfigContainer>
178185
<p>
179186
Start an Electron {binary} with HTTP Toolkit's settings injected,
180-
to intercept all its HTTP & HTTPS traffic.
187+
to intercept all its HTTP &amp; HTTPS traffic.
181188
</p>
182189
{
183190
platform === 'mac' && previousElectronAppPaths.length < 2 && <p>
184-
To run a Mac .app bundle, select the executable within. It's typically
185-
in Contents/MacOS inside the bundle.
191+
For .app bundles, enter either the bundle name (with or without .app)
192+
or the full path to the executable itself, typically stored in
193+
Contents/MacOS inside the bundle.
186194
</p>
187195
}
188196
<p>

src/model/interception/interceptors.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -272,8 +272,10 @@ const INTERCEPT_OPTIONS: _.Dictionary<InterceptorConfig> = {
272272
description: ["Launch an Electron application with all its traffic intercepted"],
273273
iconProps: SourceIcons.Electron,
274274
uiConfig: ElectronCustomUi,
275-
checkRequirements: ({ interceptorVersion }) => {
276-
return versionSatisfies(interceptorVersion, "^1.0.1")
275+
checkRequirements: ({ serverVersion, interceptorVersion }) => {
276+
return navigator.platform.startsWith('Mac')
277+
? versionSatisfies(serverVersion, '^1.10.1')
278+
: versionSatisfies(interceptorVersion, "^1.0.1")
277279
},
278280
tags: ['electron', 'desktop', 'postman']
279281
},

0 commit comments

Comments
 (0)