Tidy up, add discord link
This commit is contained in:
parent
d8b16674dd
commit
243c349366
28
dau.go
28
dau.go
@ -11,8 +11,6 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
_ "embed"
|
|
||||||
|
|
||||||
_ "image/gif"
|
_ "image/gif"
|
||||||
_ "image/jpeg"
|
_ "image/jpeg"
|
||||||
_ "image/png"
|
_ "image/png"
|
||||||
@ -35,33 +33,26 @@ type watch struct {
|
|||||||
uploader *upload.Uploader
|
uploader *upload.Uploader
|
||||||
}
|
}
|
||||||
|
|
||||||
//go:embed dau.ico
|
|
||||||
var appIcon []byte
|
|
||||||
|
|
||||||
//go:generate goversioninfo -icon=dau.ico
|
|
||||||
|
|
||||||
// -manifest=testdata/resource/goversioninfo.exe.manifest
|
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
|
|
||||||
parseOptions()
|
parseOptions()
|
||||||
|
|
||||||
// grab the config, register to notice changes
|
// grab the conf, register to notice changes
|
||||||
config := config.DefaultConfigService()
|
conf := config.DefaultConfigService()
|
||||||
configChanged := make(chan bool)
|
configChanged := make(chan bool)
|
||||||
config.Changed = configChanged
|
conf.Changed = configChanged
|
||||||
config.LoadOrInit()
|
conf.LoadOrInit()
|
||||||
|
|
||||||
// create the uploader
|
// create the uploader
|
||||||
up := upload.NewUploader()
|
up := upload.NewUploader()
|
||||||
|
|
||||||
// log.Print("Opening web browser")
|
// log.Print("Opening web browser")
|
||||||
// open.Start("http://localhost:9090")
|
// open.Start("http://localhost:9090")
|
||||||
web := web.WebService{Config: config, Uploader: up}
|
web := web.WebService{Config: conf, Uploader: up}
|
||||||
web.StartWebServer()
|
web.StartWebServer()
|
||||||
|
|
||||||
if config.Config.OpenBrowserOnStart {
|
if conf.Config.OpenBrowserOnStart {
|
||||||
openWebBrowser(config.Config.Port)
|
openWebBrowser(conf.Config.Port)
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@ -79,10 +70,9 @@ func main() {
|
|||||||
// create the watchers, restart them if config changes
|
// create the watchers, restart them if config changes
|
||||||
// blocks forever
|
// blocks forever
|
||||||
go func() {
|
go func() {
|
||||||
startWatchers(config, up, configChanged)
|
startWatchers(conf, up, configChanged)
|
||||||
}()
|
}()
|
||||||
|
mainloop(conf)
|
||||||
mainloop(config)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
_ "embed"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/getlantern/systray"
|
"github.com/getlantern/systray"
|
||||||
"github.com/skratchdot/open-golang/open"
|
"github.com/skratchdot/open-golang/open"
|
||||||
@ -9,6 +10,13 @@ import (
|
|||||||
"github.com/tardisx/discord-auto-upload/version"
|
"github.com/tardisx/discord-auto-upload/version"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
//go:embed dau.ico
|
||||||
|
var appIcon []byte
|
||||||
|
|
||||||
|
//go:generate goversioninfo -icon=dau.ico
|
||||||
|
|
||||||
|
// -manifest=testdata/resource/goversioninfo.exe.manifest
|
||||||
|
|
||||||
func mainloop(c *config.ConfigService) {
|
func mainloop(c *config.ConfigService) {
|
||||||
systray.Run(func() { onReady(c) }, onExit)
|
systray.Run(func() { onReady(c) }, onExit)
|
||||||
}
|
}
|
||||||
@ -20,6 +28,7 @@ func onReady(c *config.ConfigService) {
|
|||||||
systray.SetTooltip(fmt.Sprintf("discord-auto-upload %s", version.CurrentVersion))
|
systray.SetTooltip(fmt.Sprintf("discord-auto-upload %s", version.CurrentVersion))
|
||||||
openApp := systray.AddMenuItem("Open", "Open in web browser")
|
openApp := systray.AddMenuItem("Open", "Open in web browser")
|
||||||
gh := systray.AddMenuItem("Github", "Open project page")
|
gh := systray.AddMenuItem("Github", "Open project page")
|
||||||
|
discord := systray.AddMenuItem("Discord", "Join us on discord")
|
||||||
ghr := systray.AddMenuItem("Release Notes", "Open project release notes")
|
ghr := systray.AddMenuItem("Release Notes", "Open project release notes")
|
||||||
quit := systray.AddMenuItem("Quit", "Quit")
|
quit := systray.AddMenuItem("Quit", "Quit")
|
||||||
|
|
||||||
@ -37,6 +46,8 @@ func onReady(c *config.ConfigService) {
|
|||||||
open.Start("https://github.com/tardisx/discord-auto-upload")
|
open.Start("https://github.com/tardisx/discord-auto-upload")
|
||||||
case <-ghr.ClickedCh:
|
case <-ghr.ClickedCh:
|
||||||
open.Start(fmt.Sprintf("https://github.com/tardisx/discord-auto-upload/releases/tag/%s", version.CurrentVersion))
|
open.Start(fmt.Sprintf("https://github.com/tardisx/discord-auto-upload/releases/tag/%s", version.CurrentVersion))
|
||||||
|
case <-discord.ClickedCh:
|
||||||
|
open.Start("https://discord.gg/eErG9sntbZ")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}()
|
}()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user