diff --git a/contrib/ui/webview/ui.go b/contrib/ui/webview/ui.go index 6faec7de..868abe88 100755 --- a/contrib/ui/webview/ui.go +++ b/contrib/ui/webview/ui.go @@ -18,7 +18,7 @@ func main() { w := webview.New(debug) defer w.Destroy() w.SetTitle("RiV-mesh") - w.SetSize(450, 410, webview.HintNone) + w.SetSize(465, 410, webview.HintNone) path, err := filepath.Abs(filepath.Dir(os.Args[0])) if err != nil { log.Fatal(err) @@ -40,25 +40,30 @@ func run(w webview.WebView){ if exists { fmt.Println("Program path: %s", path) riv_ctrl_path := fmt.Sprintf("%s\\RiV-mesh\\meshctl.exe", path) - run_command(w, riv_ctrl_path, "getSelf") + get_self(w, riv_ctrl_path, "getSelf") } else { fmt.Println("could not find Program Files path") } } else { riv_ctrl_path := fmt.Sprintf("meshctl") - run_command(w, riv_ctrl_path, "getSelf") + get_self(w, riv_ctrl_path, "getSelf") } } -func run_command(w webview.WebView, riv_ctrl_path string, command string){ - +func run_command(riv_ctrl_path string, command string) []string{ cmd := exec.Command(riv_ctrl_path, command) out, err := cmd.CombinedOutput() if err != nil { log.Fatalf("cmd.Run() failed with %s\n", err) - return + return nil } lines := strings.Split(string(out), "\n") + return lines +} + +func get_self(w webview.WebView, riv_ctrl_path string, command string){ + + lines := run_command(riv_ctrl_path, command) m := make(map[string]string) for i, s := range lines { p := strings.SplitN(s, ":", 2) diff --git a/go.mod b/go.mod index f5367e0d..f8a8e0bc 100644 --- a/go.mod +++ b/go.mod @@ -17,6 +17,7 @@ require ( github.com/mitchellh/mapstructure v1.4.1 github.com/vishvananda/netlink v1.1.0 github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f // indirect + github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e // indirect golang.org/x/crypto v0.0.0-20210513164829-c07d793c2f9a // indirect golang.org/x/net v0.0.0-20210610132358-84b48f89b13b golang.org/x/sys v0.0.0-20210611083646-a4fc73990273 diff --git a/go.sum b/go.sum index 5d11fad6..e0ab299d 100644 --- a/go.sum +++ b/go.sum @@ -38,6 +38,8 @@ github.com/vishvananda/netlink v1.1.0/go.mod h1:cTgwzPIzzgDAYoQrMm0EdrjRUBkTqKYp github.com/vishvananda/netns v0.0.0-20191106174202-0a2b9b5464df/go.mod h1:JP3t17pCcGlemwknint6hfoeCVQrEMVwxRLRjXpq+BU= github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f h1:p4VB7kIXpOQvVn1ZaTIVp+3vuYAXFe3OJEvjbUYJLaA= github.com/vishvananda/netns v0.0.0-20210104183010-2eb08e3e575f/go.mod h1:DD4vA1DwXk04H54A1oHXtwZmA0grkVMdPxx/VGLCah0= +github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e h1:z780M7mCrdt6KiICeW9SGirvQjxDlrVU+n99FO93nbI= +github.com/webview/webview v0.0.0-20210330151455-f540d88dde4e/go.mod h1:rpXAuuHgyEJb6kXcXldlkOjU6y4x+YcASKKXJNUhh0Y= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210220033148-5ea612d1eb83/go.mod h1:jdWPYTVW3xRLrWPugEBEK3UY2ZEsg3UU495nc5E+M+I= golang.org/x/crypto v0.0.0-20210421170649-83a5a9bb288b/go.mod h1:T9bdIzuCu7OtxOm1hfPfRQxPLYneinmdGuTeoZ9dtd4= diff --git a/index.html b/index.html new file mode 100755 index 00000000..ed3d558d --- /dev/null +++ b/index.html @@ -0,0 +1,229 @@ + + + +
+ + + +