Skip to content

Commit 3487304

Browse files
committed
Fix a startup check and button content bug
1 parent 5678cbb commit 3487304

File tree

2 files changed

+14
-16
lines changed

2 files changed

+14
-16
lines changed

Diff for: main.go

+12-14
Original file line numberDiff line numberDiff line change
@@ -369,20 +369,18 @@ func loop() {
369369
}
370370
}
371371

372-
// check if the HTTPS certificates are expired and prompt the user to update them on macOS
373-
if runtime.GOOS == "darwin" && cert.GetDefaultBrowserName() == "Safari" {
374-
if *installCerts {
375-
if config.CertsExist() {
376-
cert.PromptExpiredCerts(config.GetCertificatesDir())
377-
} else if cert.PromptInstallCertsSafari() {
378-
// installing the certificates from scratch at this point should only happen if
379-
// something went wrong during previous installation attempts
380-
cert.GenerateAndInstallCertificates(config.GetCertificatesDir())
381-
} else {
382-
err = config.SetInstallCertsIni(configPath.String(), "false")
383-
if err != nil {
384-
log.Panicf("config.ini cannot be parsed: %s", err)
385-
}
372+
// Check if the HTTPS certificate is expired or exipring and prompt the user to update them on macOS.
373+
if runtime.GOOS == "darwin" && *installCerts {
374+
if config.CertsExist() {
375+
cert.PromptExpiredCerts(config.GetCertificatesDir())
376+
} else if cert.PromptInstallCertsSafari() {
377+
// installing the certificates from scratch at this point should only happen if
378+
// something went wrong during previous installation attempts
379+
cert.GenerateAndInstallCertificates(config.GetCertificatesDir())
380+
} else {
381+
err = config.SetInstallCertsIni(configPath.String(), "false")
382+
if err != nil {
383+
log.Panicf("config.ini cannot be parsed: %s", err)
386384
}
387385
}
388386
}

Diff for: systray/systray_real.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -108,14 +108,14 @@ func (s *Systray) start() {
108108
infoMsg = infoMsg + "- Certificate installed: No\n- Certificate trusted: N/A\n- Certificate expiration date: N/A"
109109
}
110110
pressedButton := utilities.UserPrompt("display dialog \"" + infoMsg + "\" buttons " + buttons + " with title \"Arduino Agent: Manage HTTPS certificate\"")
111-
if strings.Contains(pressedButton, "Install certificate for Safari") {
111+
if strings.Contains(pressedButton, "Install the certificate for Safari") {
112112
cert.GenerateAndInstallCertificates(certDir)
113113
err := config.SetInstallCertsIni(s.currentConfigFilePath.String(), "true")
114114
if err != nil {
115115
log.Errorf("cannot set installCerts value in config.ini: %s", err)
116116
}
117117
s.Restart()
118-
} else if strings.Contains(pressedButton, "Uninstall certificate for Safari") {
118+
} else if strings.Contains(pressedButton, "Uninstall the certificate for Safari") {
119119
err := cert.UninstallCertificates()
120120
if err != nil {
121121
log.Errorf("cannot uninstall certificates something went wrong: %s", err)

0 commit comments

Comments
 (0)