mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-29 14:45:07 +03:00
Merge pull request #22 from RiV-chain/offline_ui
load index.html from file resource
This commit is contained in:
commit
d834b2515f
7 changed files with 175 additions and 161 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
.history
|
4
contrib/ui/mesh-ui/assets/all.min.css
vendored
Normal file
4
contrib/ui/mesh-ui/assets/all.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
6
contrib/ui/mesh-ui/assets/bulmaswatch.min.css
vendored
Normal file
6
contrib/ui/mesh-ui/assets/bulmaswatch.min.css
vendored
Normal file
File diff suppressed because one or more lines are too long
1
contrib/ui/mesh-ui/assets/bulmaswatch.min.css.map
Normal file
1
contrib/ui/mesh-ui/assets/bulmaswatch.min.css.map
Normal file
File diff suppressed because one or more lines are too long
|
@ -6,8 +6,8 @@
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||||
|
|
||||||
<title>RiV-mesh</title>
|
<title>RiV-mesh</title>
|
||||||
<link rel="stylesheet" href="https://maxst.icons8.com/vue-static/landings/line-awesome/font-awesome-line-awesome/css/all.min.css" type="text/css">
|
<link rel="stylesheet" href="assets/all.min.css" type="text/css">
|
||||||
<link rel="stylesheet" href="https://unpkg.com/bulmaswatch/slate/bulmaswatch.min.css" type="text/css">
|
<link rel="stylesheet" href="assets/bulmaswatch.min.css" type="text/css">
|
||||||
<script>
|
<script>
|
||||||
|
|
||||||
function setFieldValue(id, value){
|
function setFieldValue(id, value){
|
||||||
|
|
BIN
contrib/ui/mesh-ui/webfonts/fa-solid-900.woff2
Normal file
BIN
contrib/ui/mesh-ui/webfonts/fa-solid-900.woff2
Normal file
Binary file not shown.
|
@ -1,21 +1,22 @@
|
||||||
package main
|
package main
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/webview/webview"
|
|
||||||
"github.com/hjson/hjson-go"
|
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"path/filepath"
|
|
||||||
"io/ioutil"
|
|
||||||
"os/exec"
|
|
||||||
"net/url"
|
|
||||||
"runtime"
|
|
||||||
"strings"
|
|
||||||
"strconv"
|
|
||||||
"time"
|
|
||||||
"net"
|
|
||||||
"log"
|
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"io/ioutil"
|
||||||
|
"log"
|
||||||
|
"net"
|
||||||
|
"net/url"
|
||||||
"os"
|
"os"
|
||||||
|
"os/exec"
|
||||||
|
"path/filepath"
|
||||||
|
"runtime"
|
||||||
|
"strconv"
|
||||||
|
"strings"
|
||||||
|
"time"
|
||||||
|
|
||||||
|
"github.com/hjson/hjson-go"
|
||||||
|
"github.com/webview/webview"
|
||||||
|
|
||||||
"github.com/RiV-chain/RiV-mesh/src/admin"
|
"github.com/RiV-chain/RiV-mesh/src/admin"
|
||||||
)
|
)
|
||||||
|
@ -105,9 +106,10 @@ func main() {
|
||||||
w.Bind("ping", func(peer_list string) {
|
w.Bind("ping", func(peer_list string) {
|
||||||
go ping(w, peer_list)
|
go ping(w, peer_list)
|
||||||
})
|
})
|
||||||
dat, err := ioutil.ReadFile(path+"/index.html")
|
//dat, err := ioutil.ReadFile(path+"/index.html")
|
||||||
w.Navigate("data:text/html,"+url.QueryEscape(string(dat)))
|
//w.Navigate("data:text/html,"+url.QueryEscape(string(dat)))
|
||||||
//w.Navigate("data:text/html,"+"<html>"+path+"</html>")
|
//w.Navigate("data:text/html,"+"<html>"+path+"</html>")
|
||||||
|
w.Navigate("file://" + path + "/index.html")
|
||||||
w.Run()
|
w.Run()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -117,9 +119,9 @@ func ping(w webview.WebView, peer_list string){
|
||||||
log.Printf("Unmarshaled: %v", peers)
|
log.Printf("Unmarshaled: %v", peers)
|
||||||
for _, u := range peers {
|
for _, u := range peers {
|
||||||
log.Printf("Unmarshaled: %v", u)
|
log.Printf("Unmarshaled: %v", u)
|
||||||
ping_time := check(u);
|
ping_time := check(u)
|
||||||
log.Printf("ping: %d", ping_time)
|
log.Printf("ping: %d", ping_time)
|
||||||
setPingValue(w, u, strconv.FormatInt(ping_time, 10));
|
setPingValue(w, u, strconv.FormatInt(ping_time, 10))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue