give it a port flag to determine a default port for the webUI

This commit is contained in:
idk
2020-09-09 11:56:58 -04:00
parent 2ba3977385
commit cb1101e03d
4 changed files with 12 additions and 5 deletions

View File

@ -24,8 +24,8 @@ var (
connDone = make(chan uint64)
)
func Listen() net.Listener {
ln, err := net.Listen("tcp", "127.0.0.1:0")
func Listen(port string) net.Listener {
ln, err := net.Listen("tcp", "127.0.0.1:"+port)
if err != nil {
log.Fatal(err)
}

View File

@ -7,8 +7,8 @@ import (
"github.com/webview/webview"
)
func Launch() {
ln := Listen()
func Launch(port string) {
ln := Listen(port)
defer ln.Close()
debug := true
w := webview.New(debug)

View File

@ -3,9 +3,16 @@
package main
import (
"flag"
"github.com/eyedeekay/toopie.html/lib"
)
var (
port := flag.String("port", "0", "Port to run the web interface on, default is randomly assigned.")
)
func main() {
toopie.Launch()
flag.Parse()
toopie.Launch(*port)
}

Binary file not shown.