2024-09-16 08:49:22 +03:00
|
|
|
// build +gui
|
2024-09-15 18:49:42 +03:00
|
|
|
/*
|
|
|
|
|
StreamGoose UI — Go reference implementation
|
|
|
|
|
|
|
|
|
|
Created by Luxferre in 2024, released into public domain
|
|
|
|
|
*/
|
|
|
|
|
package main
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"centrifuge.hectabit.org/HectaBit/webview_go" /* for UI launch */
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
/* override GUI entry point */
|
|
|
|
|
func init() {
|
|
|
|
|
goose_start_gui = func(config map[string]interface{}) {
|
|
|
|
|
/* target server listening address */
|
|
|
|
|
target_addr := fmt.Sprintf("%s:%d", config["server_listen_ip"].(string), int(config["server_port"].(float64)))
|
|
|
|
|
|
|
|
|
|
/* start the GUI */
|
|
|
|
|
debug := false
|
|
|
|
|
if _, ok := config["debug"]; ok && config["debug"].(bool) == true {
|
|
|
|
|
debug = true
|
|
|
|
|
}
|
|
|
|
|
bro := webview.New(debug) /* create a browser instance */
|
|
|
|
|
bro.SetSize(320, 720, webview.HintNone)
|
|
|
|
|
defer bro.Destroy()
|
|
|
|
|
bro.SetTitle("StreamGoose v0.0.1")
|
|
|
|
|
bro.Navigate("http://" + target_addr)
|
|
|
|
|
bro.Run()
|
|
|
|
|
}
|
|
|
|
|
}
|