From 428308f07c77b6a374b7f0f9cef8a163c5e52dd2 Mon Sep 17 00:00:00 2001 From: Egor Tensin Date: Mon, 28 Nov 2022 08:53:45 +0100 Subject: support peer aliases --- html/index.html | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) (limited to 'html/index.html') diff --git a/html/index.html b/html/index.html index d1cf373..92a865f 100644 --- a/html/index.html +++ b/html/index.html @@ -65,7 +65,7 @@ td, th[scope="row"] { - + @@ -191,6 +191,8 @@ PublicKey.prototype = Object.create(Field.prototype); PublicKey.prototype.constructor = PublicKey; PublicKey.prototype.cell_contents = function(value) { + if (value in aliases) + value = aliases[value]; return [in_code(value)]; } @@ -349,6 +351,20 @@ function peers_show() { }); } +var aliases = {}; + +function aliases_parse(data) { + aliases = {}; + data.split(/\r?\n/).forEach(function(line) { + let delim = line.match(/\s+/); + if (!delim) + return; + let key = line.slice(0, delim.index); + let alias = line.slice(delim.index + delim[0].length); + aliases[key] = alias; + }); +} + function device_update() { send_request('GetDeviceInfo', device_show); } @@ -357,9 +373,16 @@ function peers_update() { send_request('ListPeers', peers_show); } +function aliases_update() { + send_request('aliases', function() { + aliases_parse(this.responseText); + peers_update(); + }); +} + function update() { device_update(); - peers_update(); + aliases_update(); } var update_interval_seconds = 30; -- cgit v1.2.3
Public keyPeer Last handshake Endpoint Rx