Skip to content

Manage the HTTPS certificate from the menu and ask Safari users to install it at startup #941

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

Merged
merged 19 commits into from
May 8, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
64bb346
Add function to retrieve certificates expiration date
MatteoPologruto Apr 23, 2024
0cb308a
Check the certificate expiration date
MatteoPologruto Apr 23, 2024
431dc58
Obtain certificates info using the systray icon
MatteoPologruto Apr 24, 2024
0463976
Manage errors that may occur retrieving certificates expiration date
MatteoPologruto Apr 24, 2024
6a0017f
Obtain default browser name on macOS
MatteoPologruto Apr 30, 2024
f80791d
Prompt Safari users to install HTTPS certificates and check if they a…
MatteoPologruto Apr 30, 2024
40f50f4
Skip some tests on macOS because the user is prompted to install cert…
MatteoPologruto May 2, 2024
f1f76a3
Set installCerts value in config.ini if certicates are manually insta…
MatteoPologruto May 2, 2024
88495ca
Always set installCerts if the certificates exist
MatteoPologruto May 2, 2024
a438fed
Add "Arduino Agent" to the title of dialogs
Xayton May 2, 2024
66ba136
Fix check for pressed buttons
Xayton May 2, 2024
52961e2
Move osascript execution function to Utilities to avoid code duplication
MatteoPologruto May 6, 2024
a759046
Modify certificate management from the systray menu
MatteoPologruto May 6, 2024
46ceb5d
Install certificates if they are missing and the flag inside the conf…
MatteoPologruto May 7, 2024
144515b
Avoid code duplication
MatteoPologruto May 7, 2024
e9c71b3
Fix button order and title
Xayton May 7, 2024
1ba5ed1
Do not restart the Agent if no action is performed on the certificate
MatteoPologruto May 7, 2024
1ec7171
Do not modify the config if the default browser is not Safari
MatteoPologruto May 7, 2024
27d8b76
Small messages/titles fixes
Xayton May 7, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Do not modify the config if the default browser is not Safari
  • Loading branch information
MatteoPologruto committed May 8, 2024
commit 1ec717132cd610049f11db3d7db052319ba37cd9
3 changes: 0 additions & 3 deletions certificates/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -283,9 +283,6 @@ func isExpired() (bool, error) {

// PromptInstallCertsSafari prompts the user to install the HTTPS certificates if they are using Safari
func PromptInstallCertsSafari() bool {
if GetDefaultBrowserName() != "Safari" {
return false
}
buttonPressed := utilities.UserPrompt("display dialog \"The Arduino Agent needs a local HTTPS certificate to work correctly with Safari.\nIf you use Safari, you need to install it.\" buttons {\"Do not install\", \"Install the certificate for Safari\"} default button 2 with title \"Arduino Agent: Install Certificates\"")
return strings.Contains(string(buttonPressed), "button returned:Install the certificate for Safari")
}
Expand Down
4 changes: 2 additions & 2 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ func loop() {

// if the default browser is Safari, prompt the user to install HTTPS certificates
// and eventually install them
if runtime.GOOS == "darwin" {
if runtime.GOOS == "darwin" && cert.GetDefaultBrowserName() == "Safari" {
if exist, err := installCertsKeyExists(configPath.String()); err != nil {
log.Panicf("config.ini cannot be parsed: %s", err)
} else if !exist {
Expand Down Expand Up @@ -370,7 +370,7 @@ func loop() {
}

// check if the HTTPS certificates are expired and prompt the user to update them on macOS
if runtime.GOOS == "darwin" {
if runtime.GOOS == "darwin" && cert.GetDefaultBrowserName() == "Safari" {
if *installCerts {
if config.CertsExist() {
cert.PromptExpiredCerts(config.GetCertificatesDir())
Expand Down