Add the snowflake to the menu

This commit is contained in:
idk
2022-03-03 23:37:47 -05:00
parent 5e6b49c714
commit 01da2b0605
2 changed files with 10 additions and 8 deletions

View File

@ -62,7 +62,6 @@ func Snowflake() {
} else { } else {
log.SetOutput(&safelog.LogScrubber{Output: logOutput}) log.SetOutput(&safelog.LogScrubber{Output: logOutput})
} }
go systray.Run(onSnowflakeReady, onSnowflakeExit)
go func() { go func() {
http.Handle("/", http.FileServer(http.Dir(*snowflakeDirectory))) http.Handle("/", http.FileServer(http.Dir(*snowflakeDirectory)))
@ -78,20 +77,20 @@ func Snowflake() {
} }
func onSnowflakeReady() { func onSnowflakeReady() {
systray.SetIcon(icon.Data) if !*snowflake {
systray.SetTitle("Snowflake Donor") return
systray.SetTooltip("You are available to donate a Snowflake snowflakeProxy") }
mQuit := systray.AddMenuItem("Stop Snowflake", "Close the application and stop your snowflake.") mSnowflakeQuit := systray.AddMenuItem("Stop Snowflake", "Close the application and stop your snowflake.")
// Sets the icon of a menu item. Only available on Mac and Windows. // Sets the icon of a menu item. Only available on Mac and Windows.
mQuit.SetIcon(icon.Data) mSnowflakeQuit.SetIcon(icon.Data)
runloop := true runloop := true
for runloop { for runloop {
select { select {
case <-mQuit.ClickedCh: case <-mSnowflakeQuit.ClickedCh:
snowflakeProxy.Stop() snowflakeProxy.Stop()
runloop = false runloop = false
log.Println("Snowflake stopped")
} }
} }
} }

View File

@ -36,6 +36,8 @@ func onReady() {
subMenuBottom2 := subMenuTop.AddSubMenuItem("Launch the Tor Browser", "Launch the standard Tor Browser bundle") subMenuBottom2 := subMenuTop.AddSubMenuItem("Launch the Tor Browser", "Launch the standard Tor Browser bundle")
subMenuBottom3 := subMenuTop.AddSubMenuItem("Launch Hardened Firefox in Clearnet Mode", "Launch the Tor Browser bundle, but without Tor") subMenuBottom3 := subMenuTop.AddSubMenuItem("Launch Hardened Firefox in Clearnet Mode", "Launch the Tor Browser bundle, but without Tor")
systray.AddSeparator() systray.AddSeparator()
go onSnowflakeReady()
systray.AddSeparator()
mQuit := systray.AddMenuItem("Quit", "Quit the whole app") mQuit := systray.AddMenuItem("Quit", "Quit the whole app")
@ -75,6 +77,7 @@ func onReady() {
} }
func onExit() { func onExit() {
onSnowflakeExit()
if shutdown { if shutdown {
i2pcontrol.Initialize("127.0.0.1", "7657", "") i2pcontrol.Initialize("127.0.0.1", "7657", "")
_, err := i2pcontrol.Authenticate("itoopie") _, err := i2pcontrol.Authenticate("itoopie")