File tree 2 files changed +14
-0
lines changed
2 files changed +14
-0
lines changed Original file line number Diff line number Diff line change @@ -29,6 +29,12 @@ func GetCertificatesDir() *paths.Path {
29
29
return GetDataDir ()
30
30
}
31
31
32
+ // CertsExist checks if the certs have already been generated
33
+ func CertsExist () bool {
34
+ certFile := GetCertificatesDir ().Join ("cert.pem" )
35
+ return certFile .Exist () //if the certFile is not present we assume there are no certs
36
+ }
37
+
32
38
// GetDataDir returns the full path to the default Arduino Create Agent data directory.
33
39
func GetDataDir () * paths.Path {
34
40
userDir , err := os .UserHomeDir ()
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ import (
24
24
25
25
log "github.com/sirupsen/logrus"
26
26
27
+ cert "github.com/arduino/arduino-create-agent/certificates"
27
28
"github.com/arduino/arduino-create-agent/config"
29
+
28
30
"github.com/arduino/arduino-create-agent/icon"
29
31
"github.com/getlantern/systray"
30
32
"github.com/go-ini/ini"
@@ -62,6 +64,9 @@ func (s *Systray) start() {
62
64
mRmCrashes := systray .AddMenuItem ("Remove crash reports" , "" )
63
65
s .updateMenuItem (mRmCrashes , config .LogsIsEmpty ())
64
66
67
+ mGenCerts := systray .AddMenuItem ("Generate HTTPS certificates" , "HTTPS Certs" )
68
+ s .updateMenuItem (mGenCerts , config .CertsExist ())
69
+
65
70
// Add pause/quit
66
71
mPause := systray .AddMenuItem ("Pause Agent" , "" )
67
72
systray .AddSeparator ()
@@ -83,6 +88,9 @@ func (s *Systray) start() {
83
88
case <- mRmCrashes .ClickedCh :
84
89
s .RemoveCrashes ()
85
90
s .updateMenuItem (mRmCrashes , config .LogsIsEmpty ())
91
+ case <- mGenCerts .ClickedCh :
92
+ cert .GenerateCertificates (config .GetCertificatesDir ())
93
+ s .Restart ()
86
94
case <- mPause .ClickedCh :
87
95
s .Pause ()
88
96
case <- mQuit .ClickedCh :
You can’t perform that action at this time.
0 commit comments