-
Notifications
You must be signed in to change notification settings - Fork 389
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add macOS split tunneling GUI #6277
Conversation
c5be184
to
d3d15dd
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r1, 1 of 1 files at r2, 7 of 9 files at r3, 6 of 8 files at r4, 4 of 6 files at r5, 2 of 2 files at r6, all commit messages.
Reviewable status: 21 of 22 files reviewed, 13 unresolved discussions (waiting on @MrChocolatine and @raksooo)
gui/src/main/index.ts
line 73 at r3 (raw file):
// Only import split tunneling library on correct OS. const linuxSplitTunneling = process.platform === 'linux' && require('./linux-split-tunneling'); const splitTunneling: ISplitTunnelingAppListRetriever | undefined = importSplitTunneling();
Add a comment clarifying that this is used for Windows and macOS, maybe?
gui/src/main/macos-split-tunneling.ts
line 38 at r7 (raw file):
// Update cache if requested or if cache is empty. if (updateCaches || this.applicationCache.isEmpty()) { fromCache = false;
Same as below.
gui/src/main/windows-split-tunneling.ts
line 71 at r3 (raw file):
private additionalShortcuts: ShortcutDetails[] = []; // Finds applications by searching through the startmenu for shortcuts with and exe-file as target. // If applicationPaths has a value, the returned applications are only the ones corresponding to
applicationPaths
is no longer present.
gui/src/main/windows-split-tunneling.ts
line 80 at r3 (raw file):
let fromCache = true; if (updateCaches || cacheIsEmpty) { fromCache = false;
let fromCache = !updateCaches && !cacheIsEmpty;
if (!fromCache) {
Code quote:
let fromCache = true;
if (updateCaches || cacheIsEmpty) {
fromCache = false;
gui/src/renderer/components/SplitTunnelingSettings.tsx
line 506 at r2 (raw file):
<StyledListContainer> <List items={props.applications.sort((a, b) => a.name.localeCompare(b.name))}
Sorting can probably be removed in linux-split-tunneling.ts
and windows-split-tunneling.ts
now.
gui/src/renderer/components/SplitTunnelingSettings.tsx
line 321 at r7 (raw file):
if (fromCache) { const { applications } = await getSplitTunnelingApplications(true);
Why call getSplitTunnelingApplications()
once and then again if fromCache
is true? This seems like a roundabout way of always calling getSplitTunnelingApplications(true)
.
gui/src/shared/application-types.ts
line 37 at r7 (raw file):
/** * Returns an ISplitTunnelingApplication object containing the metadata related to the provided
Nit: Does it not return an array of ISplitTunnelingApplication
objects?
gui/test/e2e/setup/main.ts
line 177 at r7 (raw file):
navigationHistory: undefined, scrollPositions: {}, isMacOs13OrNewer: true,
Should this be hardcoded to true
? We still test on macOS 12.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 1 of 1 files at r7.
Reviewable status: all files reviewed, 13 unresolved discussions (waiting on @MrChocolatine and @raksooo)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: all files reviewed, 15 unresolved discussions (waiting on @MrChocolatine and @raksooo)
gui/src/main/macos-split-tunneling.ts
line 37 at r7 (raw file):
// Update cache if requested or if cache is empty. if (updateCaches || this.applicationCache.isEmpty()) {
Does updateCaches
imply that this.applicationCache
should be cleared?
gui/src/main/macos-split-tunneling.ts
line 40 at r7 (raw file):
fromCache = false; const applicationBundlePaths = await this.findApplicationBundlePaths();
Not too important, but I suspect that this could be simplified. For example, "additional applications" don't need to be contained in the cache, and deletable
could be implied by "(only) present in additionalApplications
".
Would it be possible to remove getApplication
and just replace this with
this.applicationCache = await this.findExecutablePaths();
}
// return this.applicationCache + this.additionalApplications
?
ba4e27e
to
62c0398
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewable status: 18 of 23 files reviewed, 10 unresolved discussions (waiting on @dlon and @MrChocolatine)
gui/src/main/index.ts
line 73 at r3 (raw file):
Previously, dlon (David Lönnhager) wrote…
Add a comment clarifying that this is used for Windows and macOS, maybe?
Done.
gui/src/main/macos-split-tunneling.ts
line 37 at r7 (raw file):
Previously, dlon (David Lönnhager) wrote…
Does
updateCaches
imply thatthis.applicationCache
should be cleared?
No, I've added a comment in the interface that clears this up.
gui/src/main/macos-split-tunneling.ts
line 38 at r7 (raw file):
Previously, dlon (David Lönnhager) wrote…
Same as below.
Done.
gui/src/main/macos-split-tunneling.ts
line 40 at r7 (raw file):
Previously, dlon (David Lönnhager) wrote…
Not too important, but I suspect that this could be simplified. For example, "additional applications" don't need to be contained in the cache, and
deletable
could be implied by "(only) present inadditionalApplications
".Would it be possible to remove
getApplication
and just replace this withthis.applicationCache = await this.findExecutablePaths(); } // return this.applicationCache + this.additionalApplications?
We could do that, but then we'd also have to make the additional applications cache all meta-data as well. I'm not sure it's worth the effort 🤔 Although the additional applications class could have it's own instance of the cache 🤔
gui/src/main/windows-split-tunneling.ts
line 71 at r3 (raw file):
Previously, dlon (David Lönnhager) wrote…
applicationPaths
is no longer present.
Done.
gui/src/main/windows-split-tunneling.ts
line 80 at r3 (raw file):
Previously, dlon (David Lönnhager) wrote…
let fromCache = !updateCaches && !cacheIsEmpty; if (!fromCache) {
Done.
gui/src/renderer/components/SplitTunnelingSettings.tsx
line 506 at r2 (raw file):
Previously, dlon (David Lönnhager) wrote…
Sorting can probably be removed in
linux-split-tunneling.ts
andwindows-split-tunneling.ts
now.
Done. It was already removed in windows-split-tunneling.ts
but the one in linux-split-tunneling.ts
remained.
gui/src/renderer/components/SplitTunnelingSettings.tsx
line 321 at r7 (raw file):
Previously, dlon (David Lönnhager) wrote…
Why call
getSplitTunnelingApplications()
once and then again iffromCache
is true? This seems like a roundabout way of always callinggetSplitTunnelingApplications(true)
.
Because fetching the list can be quite slow and by doing this we first show a cached version if there is one and then updates the cache in the background and displays the updated list.
gui/src/shared/application-types.ts
line 37 at r7 (raw file):
Previously, dlon (David Lönnhager) wrote…
Nit: Does it not return an array of
ISplitTunnelingApplication
objects?
Done
gui/test/e2e/setup/main.ts
line 177 at r7 (raw file):
Previously, dlon (David Lönnhager) wrote…
Should this be hardcoded to
true
? We still test on macOS 12.
Yes, this file is only used for the UI tests where we mock the main process and there fore don't have a daemon connection either.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Reviewed 5 of 5 files at r8, all commit messages.
Reviewable status: all files reviewed, 6 unresolved discussions (waiting on @MrChocolatine)
gui/src/main/macos-split-tunneling.ts
line 40 at r7 (raw file):
Previously, raksooo (Oskar Nyberg) wrote…
We could do that, but then we'd also have to make the additional applications cache all meta-data as well. I'm not sure it's worth the effort 🤔 Although the additional applications class could have it's own instance of the cache 🤔
All right. Let's keep it like this.
gui/src/renderer/components/SplitTunnelingSettings.tsx
line 321 at r7 (raw file):
Previously, raksooo (Oskar Nyberg) wrote…
Because fetching the list can be quite slow and by doing this we first show a cached version if there is one and then updates the cache in the background and displays the updated list.
Ah, right. setApplications
immediately updates filteredNonSplitApplications
.
gui/test/e2e/setup/main.ts
line 177 at r7 (raw file):
Previously, raksooo (Oskar Nyberg) wrote…
Yes, this file is only used for the UI tests where we mock the main process and there fore don't have a daemon connection either.
I see.
62c0398
to
58556c0
Compare
This PR adds the macOS split tunneling GUI. It looks the same as Windows.
Added dependencies:
simple-plist
(https://socket.dev/npm/package/simple-plist)This change is