From 5fb45014f25dcb84ba1c82460080baf7557ebd47 Mon Sep 17 00:00:00 2001 From: Mihail Slobodyanuk Date: Fri, 23 Dec 2022 12:53:18 +0200 Subject: [PATCH] mesh-ui splash --- contrib/ui/mesh-ui/webview.go | 188 +++++++++++++++++++++++++++++++++- src/restapi/rest_server.go | 2 + 2 files changed, 189 insertions(+), 1 deletion(-) diff --git a/contrib/ui/mesh-ui/webview.go b/contrib/ui/mesh-ui/webview.go index eff6d442..0cc0b873 100644 --- a/contrib/ui/mesh-ui/webview.go +++ b/contrib/ui/mesh-ui/webview.go @@ -3,6 +3,7 @@ package main import ( "log" "os" + "strings" "github.com/RiV-chain/RiV-mesh/src/defaults" @@ -46,6 +47,191 @@ func main() { } log.Printf("Opening: %v", confui.IndexHtml) - w.Navigate(confui.IndexHtml) + w.SetHtml(strings.Replace(splash, "http://localhost:19019", confui.IndexHtml, 1)) w.Run() } + +var splash = ` + + +Riv mesh + + + + +
+
+
+
+
+ +
+
+ + + +` diff --git a/src/restapi/rest_server.go b/src/restapi/rest_server.go index 968147ce..3db62a1f 100644 --- a/src/restapi/rest_server.go +++ b/src/restapi/rest_server.go @@ -125,6 +125,8 @@ func addNoCacheHeaders(w http.ResponseWriter) { } func (a *RestServer) apiHandler(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Access-Control-Allow-Origin", "*") + w.Header().Set("Access-Control-Allow-Headers", "*") fmt.Fprintf(w, "Following methods are allowed: GET /api/self, getpeers. litening") }