File tree Expand file tree Collapse file tree 2 files changed +14
-0
lines changed
Expand file tree Collapse file tree 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 {
2929 return GetDataDir ()
3030}
3131
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+
3238// GetDataDir returns the full path to the default Arduino Create Agent data directory.
3339func GetDataDir () * paths.Path {
3440 userDir , err := os .UserHomeDir ()
Original file line number Diff line number Diff line change @@ -24,7 +24,9 @@ import (
2424
2525 log "github.com/sirupsen/logrus"
2626
27+ cert "github.com/arduino/arduino-create-agent/certificates"
2728 "github.com/arduino/arduino-create-agent/config"
29+
2830 "github.com/arduino/arduino-create-agent/icon"
2931 "github.com/getlantern/systray"
3032 "github.com/go-ini/ini"
@@ -62,6 +64,9 @@ func (s *Systray) start() {
6264 mRmCrashes := systray .AddMenuItem ("Remove crash reports" , "" )
6365 s .updateMenuItem (mRmCrashes , config .LogsIsEmpty ())
6466
67+ mGenCerts := systray .AddMenuItem ("Generate HTTPS certificates" , "HTTPS Certs" )
68+ s .updateMenuItem (mGenCerts , config .CertsExist ())
69+
6570 // Add pause/quit
6671 mPause := systray .AddMenuItem ("Pause Agent" , "" )
6772 systray .AddSeparator ()
@@ -83,6 +88,9 @@ func (s *Systray) start() {
8388 case <- mRmCrashes .ClickedCh :
8489 s .RemoveCrashes ()
8590 s .updateMenuItem (mRmCrashes , config .LogsIsEmpty ())
91+ case <- mGenCerts .ClickedCh :
92+ cert .GenerateCertificates (config .GetCertificatesDir ())
93+ s .Restart ()
8694 case <- mPause .ClickedCh :
8795 s .Pause ()
8896 case <- mQuit .ClickedCh :
You can’t perform that action at this time.
0 commit comments