Skip to content

Show message to the user after a successful certificate installation #951

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 2 commits into from
May 15, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
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
Next Next commit
Show message to the user after a successful certificate installation
  • Loading branch information
MatteoPologruto committed May 14, 2024
commit 4cf2b6fe0be11bf6f78e373921902a429544e1de
7 changes: 7 additions & 0 deletions certificates/certificates.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"os"
"time"

"github.com/arduino/arduino-create-agent/utilities"
"github.com/arduino/go-paths-helper"
log "github.com/sirupsen/logrus"
)
Expand Down Expand Up @@ -286,4 +287,10 @@ func GenerateAndInstallCertificates(certDir *paths.Path) {
log.Errorf("cannot install certificates something went wrong: %s", err)
DeleteCertificates(certDir)
}
expDate, err := GetExpirationDate()
if err != nil {
log.Errorf("cannot get certificates expiration date, something went wrong: %s", err)
}
infoMsg := "The Arduino Agent needs a local HTTPS certificate to work correctly with Safari.\n\nYour HTTPS certificate status:\n- Certificate installed:\t\tYes\n- Certificate trusted:\t\tYes\n- Certificate expiration:\t" + expDate.Format(time.DateTime)
utilities.UserPrompt(infoMsg, "{\"OK\"}", "OK", "OK", "Arduino Agent: Manage HTTPS certificate")
}
2 changes: 2 additions & 0 deletions systray/systray_real.go
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,8 @@ func (s *Systray) start() {
if err != nil {
log.Errorf("cannot set installCerts value in config.ini: %s", err)
}
infoMsg = "The Arduino Agent needs a local HTTPS certificate to work correctly with Safari.\n\nYour HTTPS certificate status:\n- Certificate installed:\t\tNo\n- Certificate trusted:\t\tN/A\n- Certificate expiration:\tN/A"
utilities.UserPrompt(infoMsg, "{\"OK\"}", "OK", "OK", "Arduino Agent: Manage HTTPS certificate")
}
s.Restart()
}
Expand Down
Loading