mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-04-28 14:15:06 +03:00
UI fixes RIVM-8
This commit is contained in:
parent
7cee94e5cb
commit
f84f0a5f19
5 changed files with 54 additions and 8 deletions
|
@ -170,6 +170,7 @@ func run() int {
|
|||
table.Append([]string{"IPv6 subnet:", resp.Subnet})
|
||||
table.Append([]string{"Coordinates:", fmt.Sprintf("%v", resp.Coords)})
|
||||
table.Append([]string{"Public key:", resp.PublicKey})
|
||||
table.Append([]string{"Private key:", resp.PrivateKey})
|
||||
table.Render()
|
||||
|
||||
case "getpeers":
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
<script>
|
||||
|
||||
function setFieldValue(id, value){
|
||||
//console.log(`setFieldValue(${id}, ${value})`);
|
||||
var field = document.getElementById(id);
|
||||
field.innerHTML = value;
|
||||
}
|
||||
|
@ -49,6 +50,7 @@
|
|||
tb.deleteRow(row.rowIndex);
|
||||
tb.insertBefore(row, tr[i]);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function openTab(element, tabName) {
|
||||
|
@ -70,7 +72,7 @@
|
|||
// Show the current tab, and add an "is-active" class to the button that opened the tab
|
||||
document.getElementById(tabName).className = "tab here";
|
||||
element.parentElement.className = "tab is-active";
|
||||
refreshRecordsList();
|
||||
//refreshRecordsList();
|
||||
}
|
||||
|
||||
function copy2clipboard(text){
|
||||
|
@ -174,11 +176,11 @@
|
|||
}
|
||||
|
||||
function add_table(peerList) {
|
||||
|
||||
var peers = [];
|
||||
//const countries = Object.keys(peerList);
|
||||
// get the reference for the body
|
||||
var body = document.createElement("div");
|
||||
|
||||
// creates a <table> element and a <tbody> element
|
||||
var tbl = document.createElement("table");
|
||||
tbl.setAttribute('id', "peer_list");
|
||||
|
@ -229,7 +231,18 @@
|
|||
return peers;
|
||||
}
|
||||
|
||||
|
||||
function togglePrivKeyVisibility() {
|
||||
if(this.classList.contains("fa-eye-slash")) {
|
||||
this.classList.remove("fa-eye-slash");
|
||||
this.classList.add("fa-eye");
|
||||
document.getElementById("priv_key_visible").innerHTML = document.getElementById("priv_key").innerHTML;
|
||||
} else {
|
||||
this.classList.remove("fa-eye");
|
||||
this.classList.add("fa-eye-slash");
|
||||
document.getElementById("priv_key_visible").innerHTML = "••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••";
|
||||
}
|
||||
}
|
||||
|
||||
</script>
|
||||
<style>
|
||||
|
||||
|
@ -248,7 +261,11 @@
|
|||
.item {
|
||||
padding: 10px;
|
||||
/*border: 1px solid #5d656d;*/
|
||||
|
||||
}
|
||||
|
||||
.overflow-ellipsis {
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
}
|
||||
|
||||
.column {
|
||||
|
@ -396,7 +413,29 @@
|
|||
</div>
|
||||
|
||||
<div class="tab here is-hidden" id="keys">
|
||||
|
||||
<div class="column">
|
||||
<div class="container-ip">
|
||||
<div class="item">Public Key</div>
|
||||
<div id="pub_key" class="item push-right overflow-ellipsis">Public Key</div>
|
||||
<div class="item">
|
||||
<a class="fas fa-copy" onclick="copy2clipboard(document.getElementById('pub_key').innerHTML);"/></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="container-ip">
|
||||
<div class="item">Private Key</div>
|
||||
|
||||
<div id="priv_key" class="is-hidden" ></div>
|
||||
<div id="priv_key_visible" class="item push-right overflow-ellipsis">••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••••</div>
|
||||
<div class="item">
|
||||
<a class="fas fa-light fa-eye-slash" onclick="(togglePrivKeyVisibility.bind(this))()"></a>
|
||||
</div>
|
||||
<div class="item">
|
||||
<a class="fas fa-copy" onclick="copy2clipboard(document.getElementById('priv_key').innerHTML);"/></a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
|
|
@ -192,6 +192,8 @@ func get_self(w webview.WebView) {
|
|||
//found ipv6
|
||||
fmt.Printf("IPv6: %s\n", res.IPAddress)
|
||||
go setFieldValue(w, "ipv6", res.IPAddress)
|
||||
go setFieldValue(w, "pub_key", res.PublicKey)
|
||||
go setFieldValue(w, "priv_key", res.PrivateKey)
|
||||
//found subnet
|
||||
fmt.Printf("Subnet: %s\n", res.Subnet)
|
||||
go setFieldValue(w, "subnet", res.Subnet)
|
||||
|
|
|
@ -12,6 +12,7 @@ type GetSelfResponse struct {
|
|||
BuildName string `json:"build_name"`
|
||||
BuildVersion string `json:"build_version"`
|
||||
PublicKey string `json:"key"`
|
||||
PrivateKey string `json:"private_key"`
|
||||
IPAddress string `json:"address"`
|
||||
Coords []uint64 `json:"coords"`
|
||||
Subnet string `json:"subnet"`
|
||||
|
@ -23,6 +24,7 @@ func (a *AdminSocket) getSelfHandler(req *GetSelfRequest, res *GetSelfResponse)
|
|||
res.BuildName = version.BuildName()
|
||||
res.BuildVersion = version.BuildVersion()
|
||||
res.PublicKey = hex.EncodeToString(self.Key[:])
|
||||
res.PrivateKey = hex.EncodeToString(self.PrivateKey[:])
|
||||
res.IPAddress = a.core.Address().String()
|
||||
res.Subnet = snet.String()
|
||||
res.Coords = self.Coords
|
||||
|
|
|
@ -21,9 +21,10 @@ import (
|
|||
)
|
||||
|
||||
type SelfInfo struct {
|
||||
Key ed25519.PublicKey
|
||||
Root ed25519.PublicKey
|
||||
Coords []uint64
|
||||
Key ed25519.PublicKey
|
||||
Root ed25519.PublicKey
|
||||
PrivateKey ed25519.PrivateKey
|
||||
Coords []uint64
|
||||
}
|
||||
|
||||
type PeerInfo struct {
|
||||
|
@ -60,6 +61,7 @@ func (c *Core) GetSelf() SelfInfo {
|
|||
var self SelfInfo
|
||||
s := c.PacketConn.PacketConn.Debug.GetSelf()
|
||||
self.Key = s.Key
|
||||
self.PrivateKey = c.secret
|
||||
self.Root = s.Root
|
||||
self.Coords = s.Coords
|
||||
return self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue