Skip to content

Commit 1ec7171

Browse files
Do not modify the config if the default browser is not Safari
1 parent 1ba5ed1 commit 1ec7171

File tree

2 files changed

+2
-5
lines changed

2 files changed

+2
-5
lines changed

Diff for: certificates/certificates.go

-3
Original file line numberDiff line numberDiff line change
@@ -283,9 +283,6 @@ func isExpired() (bool, error) {
283283

284284
// PromptInstallCertsSafari prompts the user to install the HTTPS certificates if they are using Safari
285285
func PromptInstallCertsSafari() bool {
286-
if GetDefaultBrowserName() != "Safari" {
287-
return false
288-
}
289286
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\"")
290287
return strings.Contains(string(buttonPressed), "button returned:Install the certificate for Safari")
291288
}

Diff for: main.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ func loop() {
223223

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

372372
// check if the HTTPS certificates are expired and prompt the user to update them on macOS
373-
if runtime.GOOS == "darwin" {
373+
if runtime.GOOS == "darwin" && cert.GetDefaultBrowserName() == "Safari" {
374374
if *installCerts {
375375
if config.CertsExist() {
376376
cert.PromptExpiredCerts(config.GetCertificatesDir())

0 commit comments

Comments
 (0)