File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -64,12 +64,16 @@ func (s *Systray) start() {
6464 s .updateMenuItem (mRmCrashes , config .LogsIsEmpty ())
6565
6666 mGenCerts := systray .AddMenuItem ("Generate and Install HTTPS certificates" , "HTTPS Certs" )
67+ mRemoveCerts := systray .AddMenuItem ("Remove HTTPS certificates" , "" )
6768 // On linux/windows chrome/firefox/edge(chromium) the agent works without problems on plain HTTP,
6869 // so we disable the menuItem to generate/install the certificates
6970 if runtime .GOOS != "darwin" {
7071 s .updateMenuItem (mGenCerts , true )
72+ s .updateMenuItem (mRemoveCerts , true )
7173 } else {
7274 s .updateMenuItem (mGenCerts , config .CertsExist ())
75+ // TODO: should we add a different check to disable the uninstall function?
76+ s .updateMenuItem (mRemoveCerts , ! config .CertsExist ())
7377 }
7478
7579 // Add pause/quit
@@ -103,6 +107,15 @@ func (s *Systray) start() {
103107 cert .DeleteCertificates (certDir )
104108 }
105109 s .Restart ()
110+ case <- mRemoveCerts .ClickedCh :
111+ err := cert .UninstallCertificates ()
112+ if err != nil {
113+ log .Errorf ("cannot uninstall certificates something went wrong: %s" , err )
114+ } else {
115+ certDir := config .GetCertificatesDir ()
116+ cert .DeleteCertificates (certDir )
117+ }
118+ s .Restart ()
106119 case <- mPause .ClickedCh :
107120 s .Pause ()
108121 case <- mQuit .ClickedCh :
You can’t perform that action at this time.
0 commit comments