-
Notifications
You must be signed in to change notification settings - Fork 3
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
Enable activating and deactivating the 'Firefox VPN' #61
Conversation
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.
r+wc
} | ||
} | ||
|
||
updateProxyMap(newProxyMap, servers) { |
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.
Also this needs type info please 👉 👈
this.#mProxyMap.value = result;
Is the only member access. I wonder if this should be static and
the caller should do
this.#mProxyMap.value = getProxyMap(newProxyMap, servers)
This way you can easy create tests for that, which would be neat :)
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.
After reading a Tidbid more.
This property should be a computed Property, based on this.#mSiteContexts and vpnState.servers, no?
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.
I had forgotten about ye' old computed properties! Makes sense. Would need to be based on vpncontroller.state, vpncontroller.servers, and siteContexts though.
try { | ||
this.#mSiteContexts.value = siteContexts; | ||
this.updateProxyMap( |
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.
If this was a computed property, we would not need to update this manually :)
extController.state.subscribe((s) => { | ||
this.extState = s; | ||
this.handleExtensionStateChanges(s); | ||
}); | ||
|
||
propertySum( |
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.
This propsum is a bit suboptimal imho.
updateProxyInfoFromClient. Handles the following:
Sets ->
this.localProxyInfo = localProxy;
Sets ->
this.currentExitRelay = exitRelays;
But it does not do anything with them. So we should prefer to just grab the original value proxyHandler.currentExitRelays.value
- (or create a private getter as shortcut).
Then you also have this.
if (this.extState.useExitRelays) {
this.defaultProxyInfo = exitRelays;
} else {
this.defaultProxyInfo = ProxyUtils.getDirectProxyInfoObject();
}
However your,propertySum does not listen to changes to extState
. I think that is why it's also duped in handleExtensionStateChanges?
So i think you can simply that all by just using one propertysum to update defaultProxyInfo whenever one of the dependants change:
propertySum(
proxyHandler.currentExitRelays,
extController.state,
(exitRelay, extState)=>{
if (extState.useExitRelays) {
this.defaultProxyInfo = exitRelays;
} else {
this.defaultProxyInfo = ProxyUtils.getDirectProxyInfoObject();
}
}
And you can remove all the other dupe code to keep that up to date :)
c819ec9
to
9968a1e
Compare
18c9135
to
886a757
Compare
This PR...
StateVPNOnPartial
state to the controller for when the VPN client is also in StateOnPartialproxyMap
into ProxyHandler, since that is where other siteContexts things are happening.bypassTunnel
anduseExitRelays
to conditionally proxy all Firefox traffic, instead of only site specific traffic.If we're generally good with the structure of these changes I will start unbreaking and adding tests.