Skip to content
Merged
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
Obtain certificates info using the systray icon
  • Loading branch information
MatteoPologruto committed May 8, 2024
commit 431dc589ecfcdf4a9d574e3a7eae183581e3e106
16 changes: 16 additions & 0 deletions systray/systray_real.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ package systray

import (
"os"
"os/exec"
"runtime"

"fyne.io/systray"
Expand Down Expand Up @@ -65,11 +66,13 @@ func (s *Systray) start() {

mGenCerts := systray.AddMenuItem("Generate and Install HTTPS certificates", "HTTPS Certs")
mRemoveCerts := systray.AddMenuItem("Remove HTTPS certificates", "")
mCertsInfo := systray.AddMenuItem("Show HTTPS certificates info", "")
// On linux/windows chrome/firefox/edge(chromium) the agent works without problems on plain HTTP,
// so we disable the menuItem to generate/install the certificates
if runtime.GOOS != "darwin" {
s.updateMenuItem(mGenCerts, true)
s.updateMenuItem(mRemoveCerts, true)
s.updateMenuItem(mCertsInfo, true)
} else {
s.updateMenuItem(mGenCerts, config.CertsExist())
s.updateMenuItem(mRemoveCerts, !config.CertsExist())
Expand Down Expand Up @@ -115,6 +118,19 @@ func (s *Systray) start() {
cert.DeleteCertificates(certDir)
}
s.Restart()
case <-mCertsInfo.ClickedCh:
infoMsg := "The Arduino Agent needs a local HTTPS certificate to work correctly with Safari.\n\nYour HTTPS certificate status:\n"
if config.CertsExist() {
expDate, err := cert.GetExpirationDate()
if err != nil {
log.Errorf("cannot get certificates expiration date, something went wrong: %s", err)
}
infoMsg = infoMsg + "- Certificate installed: Yes\n- Certificate trusted: Yes\n- Certificate expiration date: " + expDate
} else {
infoMsg = infoMsg + "- Certificate installed: No\n- Certificate trusted: N/A\n- Certificate expiration date: N/A"
}
oscmd := exec.Command("osascript", "-e", "display dialog \""+infoMsg+"\" buttons \"OK\" with title \"Arduino Agent: certificates info\"")
_ = oscmd.Run()
case <-mPause.ClickedCh:
s.Pause()
case <-mQuit.ClickedCh:
Expand Down