mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-25 16:35:07 +03:00
Added coords info foeld and update it with timer
This commit is contained in:
parent
7000bc3a10
commit
e0ff9c9994
3 changed files with 27 additions and 3 deletions
|
@ -363,6 +363,7 @@ ui.updateConnectedPeers = function () {
|
||||||
$("peers").innerText = error.message;
|
$("peers").innerText = error.message;
|
||||||
ui.updateStatus();
|
ui.updateStatus();
|
||||||
ui.updateSpeed();
|
ui.updateSpeed();
|
||||||
|
ui.updateCoordsInfo();
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -384,6 +385,7 @@ ui.updateSelfInfo = function () {
|
||||||
return ui.getSelfInfo().then(function (info) {
|
return ui.getSelfInfo().then(function (info) {
|
||||||
$("ipv6").innerText = info.address;
|
$("ipv6").innerText = info.address;
|
||||||
$("subnet").innerText = info.subnet;
|
$("subnet").innerText = info.subnet;
|
||||||
|
$("coordinates").innerText = info.coords;
|
||||||
$("pub_key").innerText = info.key;
|
$("pub_key").innerText = info.key;
|
||||||
$("priv_key").innerText = info.private_key;
|
$("priv_key").innerText = info.private_key;
|
||||||
$("ipv6").innerText = info.address;
|
$("ipv6").innerText = info.address;
|
||||||
|
@ -393,6 +395,14 @@ ui.updateSelfInfo = function () {
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ui.updateCoordsInfo = function () {
|
||||||
|
return ui.getSelfInfo().then(function (info) {
|
||||||
|
$("coordinates").innerText = info.coords;
|
||||||
|
}).catch(function (error) {
|
||||||
|
$("ipv6").innerText = error.message;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
ui.sse = new EventSource('/api/sse');
|
ui.sse = new EventSource('/api/sse');
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
@ -406,7 +416,6 @@ function main() {
|
||||||
setInterval(ui.updateConnectedPeers, 5000);
|
setInterval(ui.updateConnectedPeers, 5000);
|
||||||
|
|
||||||
ui.updateSelfInfo();
|
ui.updateSelfInfo();
|
||||||
//setInterval(ui.updateSelfInfo, 5000);
|
|
||||||
|
|
||||||
ui.sse.addEventListener("ping", function (e) {
|
ui.sse.addEventListener("ping", function (e) {
|
||||||
var data = JSON.parse(e.data);
|
var data = JSON.parse(e.data);
|
||||||
|
|
|
@ -343,6 +343,7 @@ ui.updateConnectedPeers = () =>
|
||||||
$("peers").innerText = error.message;
|
$("peers").innerText = error.message;
|
||||||
ui.updateStatus();
|
ui.updateStatus();
|
||||||
ui.updateSpeed();
|
ui.updateSpeed();
|
||||||
|
ui.updateCoordsInfo();
|
||||||
});
|
});
|
||||||
|
|
||||||
ui.lookupCountryCodeByAddress = (address) => {
|
ui.lookupCountryCodeByAddress = (address) => {
|
||||||
|
@ -361,6 +362,7 @@ ui.updateSelfInfo = () =>
|
||||||
.then((info) => {
|
.then((info) => {
|
||||||
$("ipv6").innerText = info.address;
|
$("ipv6").innerText = info.address;
|
||||||
$("subnet").innerText = info.subnet;
|
$("subnet").innerText = info.subnet;
|
||||||
|
$("coordinates").innerText = info.coords;
|
||||||
$("pub_key").innerText = info.key;
|
$("pub_key").innerText = info.key;
|
||||||
$("priv_key").innerText = info.private_key;
|
$("priv_key").innerText = info.private_key;
|
||||||
$("ipv6").innerText = info.address;
|
$("ipv6").innerText = info.address;
|
||||||
|
@ -369,6 +371,14 @@ ui.updateSelfInfo = () =>
|
||||||
$("ipv6").innerText = error.message;
|
$("ipv6").innerText = error.message;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ui.updateCoordsInfo = function () {
|
||||||
|
return ui.getSelfInfo().then(function (info) {
|
||||||
|
$("coordinates").innerText = info.coords;
|
||||||
|
}).catch(function (error) {
|
||||||
|
$("ipv6").innerText = error.message;
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
ui.sse = new EventSource('/api/sse');
|
ui.sse = new EventSource('/api/sse');
|
||||||
|
|
||||||
function main() {
|
function main() {
|
||||||
|
|
|
@ -132,15 +132,20 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="container-ip">
|
<div class="container-ip">
|
||||||
|
<div class="item">Coordinates</div>
|
||||||
|
<div id="coordinates" class="item push-right">N/A</div>
|
||||||
|
<div class="item">
|
||||||
|
<a class="fas fa-copy" onclick="copy2clipboard(document.getElementById('coordinates').innerHTML);"></a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="container-ip">
|
||||||
<div class="item">Peers</div>
|
<div class="item">Peers</div>
|
||||||
<div id="peers" class="item over">
|
<div id="peers" class="item over">
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
<div class="item push-right">
|
<div class="item push-right">
|
||||||
<a id="showAllPeersBtn" class="fas fa-edit"></a>
|
<a id="showAllPeersBtn" class="fas fa-edit"></a>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue