put join instead of replace

This commit is contained in:
vadym 2022-12-22 13:41:02 +02:00
parent 9e5ed66dbb
commit 369e878f57
2 changed files with 2 additions and 10 deletions

View file

@ -381,15 +381,11 @@ ui.getSelfInfo = function () {
}); });
}; };
function replaceAll(string, search, replace) {
return string.split(search).join(replace);
}
ui.updateSelfInfo = function () { 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 = replaceAll(JSON.stringify(info.coords), ',', ' '); $("coordinates").innerText = ''.concat('[',info.coords.join(' '),']');
$("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;

View file

@ -357,16 +357,12 @@ ui.getSelfInfo = () =>
fetch('api/self') fetch('api/self')
.then((response) => response.json()) .then((response) => response.json())
function replaceAll(string, search, replace) {
return string.split(search).join(replace);
}
ui.updateSelfInfo = () => ui.updateSelfInfo = () =>
ui.getSelfInfo() ui.getSelfInfo()
.then((info) => { .then((info) => {
$("ipv6").innerText = info.address; $("ipv6").innerText = info.address;
$("subnet").innerText = info.subnet; $("subnet").innerText = info.subnet;
$("coordinates").innerText = "".concat('[',replaceAll(info.coords, ',', ' '),']'); $("coordinates").innerText = ''.concat('[',info.coords.join(' '),']');
$("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;