-
Notifications
You must be signed in to change notification settings - Fork 857
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 Brave VPN WireGuard setting to brave://settings/system #19531
Conversation
A Storybook has been deployed to preview UI for the latest push |
e6d3ad7
to
5274df7
Compare
A Storybook has been deployed to preview UI for the latest push |
18cd05a
to
c8b2bf9
Compare
A Storybook has been deployed to preview UI for the latest push |
c8b2bf9
to
2e432fa
Compare
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
6a5ec6c
to
fee845f
Compare
A Storybook has been deployed to preview UI for the latest push |
fee845f
to
82552ef
Compare
A Storybook has been deployed to preview UI for the latest push |
4a42fd2
to
1059062
Compare
A Storybook has been deployed to preview UI for the latest push |
1059062
to
9088b96
Compare
A Storybook has been deployed to preview UI for the latest push |
A Storybook has been deployed to preview UI for the latest push |
3b8c72b
to
25e12b5
Compare
A Storybook has been deployed to preview UI for the latest push |
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.
Lots of super small details here - checked them all out (both the code and trying the PR). Nicely done w/ the webui handler and moving the feature check code into utils methods. Everything LGTM and test plan works great 😄👍
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.
LGTM with a few minor nits 👍
EXPAND_FEATURE_ENTRIES({ \ | ||
kBraveVPNWireguardFeatureInternalName, \ | ||
"Enable experimental WireGuard Brave VPN service", \ | ||
"Experimental WireGuard VPN support. Not implemented yet", \ | ||
"Experimental WireGuard VPN support. Deprecated.", \ | ||
kOsWin, \ | ||
FEATURE_VALUE_TYPE(brave_vpn::features::kBraveVPNUseWireguardService), \ | ||
}) |
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.
nit: Could we remove this entirely? As the feature value would be migrated into pref, I think we can hide this flag from the brave://flags
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.
we have already tried, looks like no becuse we need to know the actual value to migrate
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.
That's intersting. I thought leaving features.cc as is and removing only this part would work. 🤔
if (service) { | ||
Observe(service); | ||
} |
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'm wondering if we should consider it as a failure when |service| doesn't exist. If we should, I think CHECK(service) could make more sense.
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.
done
@@ -36,7 +36,10 @@ bool HasValidSubscriberCredential(PrefService* local_prefs); | |||
std::string GetSubscriberCredential(PrefService* local_prefs); | |||
bool HasValidSkusCredential(PrefService* local_prefs); | |||
std::string GetSkusCredential(PrefService* local_prefs); | |||
|
|||
bool IsBraveVPNWireguardEnabled(PrefService* local_state); |
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.
Should we move IsBraveVPNWireguardEnabled
into the IS_WIN guard? It seems we're not using this when it's not.
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.
done
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.
We will be adding WireGuard support on other platforms - hopefully soon 🙂 (macOS and Linux)
<settings-toggle-button id="toggleWireguardButton" | ||
pref="{{prefs.brave.brave_vpn.wireguard_enabled}}" | ||
label="$i18n{useWireguardLabel}" | ||
sub-label="[[toggleWireguardSubLabel_]]" | ||
disabled="[[braveVpnConnected_]]" | ||
on-change="onChange_"> |
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.
Should we render this only when it's os win?
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.
done
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 (!status.has_value()) { | ||
return false; | ||
} | ||
return status.value() == SERVICE_RUNNING; |
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.
Out of curiosity, why is SERVICE_START_PENDING is not considered as 'running' state unlike IsBraveVPNWireguardTunnelServiceRunning()
does. Is it just because how each backend works is different?
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.
yep, IsBraveVPNWireguardTunnelServiceRunning
reflects the status of the tunnel service in runtime to show necessary icons, but in IsWindowsServiceRunning
mostly used to ensure we have vpn in working state which is not correct for SERVICE_START_PENDING
event.
Co-authored-by: Sangwoo Ko <sko@brave.com>
Co-authored-by: Sangwoo Ko <sko@brave.com>
A Storybook has been deployed to preview UI for the latest push |
Resolves brave/brave-browser#32002
Videos:
register.wg.service.mp4
disable.if.connected.mp4
2023-08-02_13h02_21.mp4
Submitter Checklist:
QA/Yes
orQA/No
;release-notes/include
orrelease-notes/exclude
;OS/...
) to the associated issuenpm run test -- brave_browser_tests
,npm run test -- brave_unit_tests
wikinpm run lint
,npm run presubmit
wiki,npm run gn_check
,npm run tslint
git rebase master
(if needed)Reviewer Checklist:
gn
After-merge Checklist:
changes has landed on
Test Plan:
Use WireGuard for Brave VPN
toggler.sc delete [service name]
from admin cmd). The browser should ask admin permissions to register the service if the option enabled.