give it a port flag to determine a default port for the webUI
This commit is contained in:
@ -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)
|
||||
}
|
||||
|
@ -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)
|
||||
|
9
main.go
9
main.go
@ -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)
|
||||
}
|
||||
|
BIN
toopie.html
BIN
toopie.html
Binary file not shown.
Reference in New Issue
Block a user