@@ -21,6 +21,7 @@ package systray
21
21
22
22
import (
23
23
"os"
24
+ "os/exec"
24
25
"runtime"
25
26
26
27
"fyne.io/systray"
@@ -65,11 +66,13 @@ func (s *Systray) start() {
65
66
66
67
mGenCerts := systray .AddMenuItem ("Generate and Install HTTPS certificates" , "HTTPS Certs" )
67
68
mRemoveCerts := systray .AddMenuItem ("Remove HTTPS certificates" , "" )
69
+ mCertsInfo := systray .AddMenuItem ("Show HTTPS certificates info" , "" )
68
70
// On linux/windows chrome/firefox/edge(chromium) the agent works without problems on plain HTTP,
69
71
// so we disable the menuItem to generate/install the certificates
70
72
if runtime .GOOS != "darwin" {
71
73
s .updateMenuItem (mGenCerts , true )
72
74
s .updateMenuItem (mRemoveCerts , true )
75
+ s .updateMenuItem (mCertsInfo , true )
73
76
} else {
74
77
s .updateMenuItem (mGenCerts , config .CertsExist ())
75
78
s .updateMenuItem (mRemoveCerts , ! config .CertsExist ())
@@ -115,6 +118,19 @@ func (s *Systray) start() {
115
118
cert .DeleteCertificates (certDir )
116
119
}
117
120
s .Restart ()
121
+ case <- mCertsInfo .ClickedCh :
122
+ infoMsg := "The Arduino Agent needs a local HTTPS certificate to work correctly with Safari.\n \n Your HTTPS certificate status:\n "
123
+ if config .CertsExist () {
124
+ expDate , err := cert .GetExpirationDate ()
125
+ if err != nil {
126
+ log .Errorf ("cannot get certificates expiration date, something went wrong: %s" , err )
127
+ }
128
+ infoMsg = infoMsg + "- Certificate installed: Yes\n - Certificate trusted: Yes\n - Certificate expiration date: " + expDate
129
+ } else {
130
+ infoMsg = infoMsg + "- Certificate installed: No\n - Certificate trusted: N/A\n - Certificate expiration date: N/A"
131
+ }
132
+ oscmd := exec .Command ("osascript" , "-e" , "display dialog \" " + infoMsg + "\" buttons \" OK\" with title \" Arduino Agent: certificates info\" " )
133
+ _ = oscmd .Run ()
118
134
case <- mPause .ClickedCh :
119
135
s .Pause ()
120
136
case <- mQuit .ClickedCh :
0 commit comments