Skip to content

Commit 96dfd11

Browse files
authored
Merge pull request #80 from datenreisender/enable_electron_apps_on_macos_again
Fix: Make Electron apps available on macOS again
2 parents ce3bdf7 + 7effd80 commit 96dfd11

File tree

2 files changed

+18
-10
lines changed

2 files changed

+18
-10
lines changed

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

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,12 @@ function getReadablePath(path: string) {
120120
}
121121
}
122122

123+
declare global {
124+
interface Window {
125+
desktopApi?: { selectApplication: () => Promise<string | undefined> };
126+
}
127+
}
128+
123129
@inject('uiStore')
124130
@observer
125131
class ElectronConfig extends React.Component<{
@@ -141,7 +147,13 @@ class ElectronConfig extends React.Component<{
141147
}
142148

143149
selectApplication = async () => {
144-
const pathToApplication = await uploadFile('path');
150+
const useNativePicker = window.desktopApi?.selectApplication;
151+
152+
const pathToApplication = await(
153+
useNativePicker
154+
? window.desktopApi?.selectApplication()
155+
: uploadFile('path')
156+
);
145157

146158
if (!pathToApplication) {
147159
this.props.closeSelf();
@@ -182,9 +194,9 @@ class ElectronConfig extends React.Component<{
182194
</p>
183195
{
184196
platform === 'mac' && previousElectronAppPaths.length < 2 && <p>
185-
For .app bundles, enter either the bundle name (with or without .app)
186-
or the full path to the executable itself, typically stored in
187-
Contents/MacOS inside the bundle.
197+
For .app bundles, you can intercept either the bundle
198+
(the .app directory) or the executable itself,
199+
typically stored in Contents/MacOS inside the bundle.
188200
</p>
189201
}
190202
<p>
@@ -220,4 +232,4 @@ export const ElectronCustomUi = {
220232
columnWidth: 1,
221233
rowHeight: 2,
222234
configComponent: ElectronConfig
223-
};
235+
};

src/model/interception/interceptors.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -283,10 +283,6 @@ const INTERCEPT_OPTIONS: _.Dictionary<InterceptorConfig> = {
283283
description: ["Launch an Electron application with all its traffic intercepted"],
284284
iconProps: SourceIcons.Electron,
285285
uiConfig: ElectronCustomUi,
286-
checkRequirements: ({ interceptorVersion }) => {
287-
return !navigator.platform.startsWith('Mac') &&
288-
versionSatisfies(interceptorVersion, "^1.0.1")
289-
},
290286
tags: ['electron', 'desktop', 'postman']
291287
},
292288
[MANUAL_INTERCEPT_ID]: {
@@ -358,4 +354,4 @@ export function getInterceptOptions(
358354
});
359355
}
360356
});
361-
}
357+
}

0 commit comments

Comments
 (0)