mirror of
https://github.com/yggdrasil-network/yggdrasil-go.git
synced 2025-08-25 16:35:07 +03:00
Update rxtx and coord RIVM-42
This commit is contained in:
parent
66e90fa1f3
commit
cb170178ba
4 changed files with 59 additions and 31 deletions
|
@ -299,8 +299,6 @@ ui.getConnectedPeers = function () {
|
|||
|
||||
ui.updateConnectedPeersHandler = function (peers) {
|
||||
ui.updateStatus(peers);
|
||||
ui.updateSpeed(peers);
|
||||
ui.updateCoordsInfo();
|
||||
$("peers").innerText = "";
|
||||
if (peers) {
|
||||
var regexStrip = /%[^\]]*/gm;
|
||||
|
@ -381,7 +379,7 @@ ui.updateSelfInfo = function () {
|
|||
return ui.getSelfInfo().then(function (info) {
|
||||
$("ipv6").innerText = info.address;
|
||||
$("subnet").innerText = info.subnet;
|
||||
$("coordinates").innerText = ''.concat('[',info.coords.join(' '),']');
|
||||
$("coordinates").innerText = ''.concat('[', info.coords.join(' '), ']');
|
||||
$("pub_key").innerText = info.key;
|
||||
$("priv_key").innerText = info.private_key;
|
||||
$("ipv6").innerText = info.address;
|
||||
|
@ -391,16 +389,6 @@ ui.updateSelfInfo = function () {
|
|||
});
|
||||
};
|
||||
|
||||
ui.updateCoordsInfo = function () {
|
||||
return ui.getSelfInfo().then(function (info) {
|
||||
$("coordinates").innerText = ''.concat('[',info.coords.join(' '),']');
|
||||
}).catch(function (error) {
|
||||
$("ipv6").innerText = error.message;
|
||||
});
|
||||
};
|
||||
|
||||
ui.sse = new EventSource('/api/sse');
|
||||
|
||||
function main() {
|
||||
|
||||
window.addEventListener("load", function () {
|
||||
|
@ -412,6 +400,8 @@ function main() {
|
|||
|
||||
ui.updateSelfInfo();
|
||||
|
||||
ui.sse = new EventSource('/api/sse');
|
||||
|
||||
ui.sse.addEventListener("ping", function (e) {
|
||||
var data = JSON.parse(e.data);
|
||||
setPingValue(data.peer, data.value);
|
||||
|
@ -420,7 +410,16 @@ function main() {
|
|||
ui.sse.addEventListener("peers", function (e) {
|
||||
ui.updateConnectedPeersHandler(JSON.parse(e.data));
|
||||
});
|
||||
|
||||
ui.sse.addEventListener("rxtx", function (e) {
|
||||
ui.updateSpeed(JSON.parse(e.data));
|
||||
});
|
||||
|
||||
ui.sse.addEventListener("coord", function (e) {
|
||||
var coords = JSON.parse(e.data);
|
||||
$("coordinates").innerText = ''.concat('[', coords.join(' '), ']');
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
main();
|
||||
main();
|
|
@ -96,6 +96,7 @@ footer {
|
|||
|
||||
#version {
|
||||
padding-left: 20px;
|
||||
padding-right: 20px;
|
||||
}
|
||||
|
||||
#status {
|
||||
|
|
|
@ -286,8 +286,6 @@ ui.getConnectedPeers = () =>
|
|||
|
||||
ui.updateConnectedPeersHandler = (peers) => {
|
||||
ui.updateStatus(peers);
|
||||
ui.updateSpeed(peers);
|
||||
ui.updateCoordsInfo();
|
||||
$("peers").innerText = "";
|
||||
if(peers) {
|
||||
const regexStrip = /%[^\]]*/gm;
|
||||
|
@ -368,16 +366,6 @@ ui.updateSelfInfo = () =>
|
|||
$("ipv6").innerText = error.message;
|
||||
});
|
||||
|
||||
ui.updateCoordsInfo = function () {
|
||||
return ui.getSelfInfo().then(function (info) {
|
||||
$("coordinates").innerText = ''.concat('[',info.coords.join(' '),']');
|
||||
}).catch(function (error) {
|
||||
$("ipv6").innerText = error.message;
|
||||
});
|
||||
};
|
||||
|
||||
ui.sse = new EventSource('/api/sse');
|
||||
|
||||
function main() {
|
||||
|
||||
window.addEventListener("load", () => {
|
||||
|
@ -386,7 +374,8 @@ function main() {
|
|||
ui.getAllPeers().then(() => ui.updateConnectedPeers());
|
||||
|
||||
ui.updateSelfInfo();
|
||||
//setInterval(ui.updateSelfInfo, 5000);
|
||||
|
||||
ui.sse = new EventSource('/api/sse');
|
||||
|
||||
ui.sse.addEventListener("ping", (e) => {
|
||||
let data = JSON.parse(e.data);
|
||||
|
@ -397,6 +386,15 @@ function main() {
|
|||
ui.updateConnectedPeersHandler(JSON.parse(e.data));
|
||||
})
|
||||
|
||||
ui.sse.addEventListener("rxtx", (e) => {
|
||||
ui.updateSpeed(JSON.parse(e.data));
|
||||
})
|
||||
|
||||
ui.sse.addEventListener("coord", (e) => {
|
||||
let coords = JSON.parse(e.data);
|
||||
$("coordinates").innerText = ''.concat('[',coords.join(' '),']');
|
||||
})
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue