Skip to content

Commit a6556a0

Browse files
Fix: Make Electron apps available on macOS again
Requires httptoolkit/httptoolkit-desktop#60, done for httptoolkit/httptoolkit#329
1 parent 2ffe44f commit a6556a0

File tree

2 files changed

+14
-7
lines changed

2 files changed

+14
-7
lines changed

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

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@ function getReadablePath(path: string) {
121121
}
122122
}
123123

124+
declare global {
125+
interface Window {
126+
nativeFile: { open: () => Promise<string | undefined> };
127+
}
128+
}
129+
124130
@inject('uiStore')
125131
@observer
126132
class ElectronConfig extends React.Component<{
@@ -142,7 +148,12 @@ class ElectronConfig extends React.Component<{
142148
}
143149

144150
selectApplication = async () => {
145-
const pathToApplication = await uploadFile('path');
151+
const useNativePicker =
152+
platform == 'win' && window.nativeFile.open;
153+
154+
const pathToApplication = await (useNativePicker
155+
? window.nativeFile.open()
156+
: uploadFile('path'));
146157

147158
if (!pathToApplication) {
148159
this.props.closeSelf();
@@ -220,4 +231,4 @@ export const ElectronCustomUi = {
220231
columnWidth: 1,
221232
rowHeight: 2,
222233
configComponent: ElectronConfig
223-
};
234+
};

src/model/interception/interceptors.ts

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

0 commit comments

Comments
 (0)