From 3903fb6113573ee872fc52a1f0d76d98708965f1 Mon Sep 17 00:00:00 2001 From: Mihail Slobodyanuk Date: Tue, 20 Dec 2022 19:03:09 +0200 Subject: [PATCH 1/3] IE11 loading fix --- contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js | 1 + 1 file changed, 1 insertion(+) diff --git a/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js b/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js index f931f0d7..53cc59ad 100644 --- a/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js +++ b/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js @@ -1,4 +1,5 @@ "use strict"; +console.log("IE load fix"); var $ = function $(id) { return document.getElementById(id); From 4042cf3118e9330e9617e5345bcf954572dd0c7a Mon Sep 17 00:00:00 2001 From: Mihail Slobodyanuk Date: Tue, 20 Dec 2022 19:04:22 +0200 Subject: [PATCH 2/3] RIVM-16 --- contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js | 9 +++++---- contrib/ui/mesh-ui/ui/assets/mesh-ui.js | 9 +++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js b/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js index 53cc59ad..3a1c20d0 100644 --- a/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js +++ b/contrib/ui/mesh-ui/ui/assets/mesh-ui-es5.js @@ -232,8 +232,9 @@ function togglePrivKeyVisibility() { } function humanReadableSpeed(speed) { - var i = speed == 0 ? 0 : Math.floor(Math.log(speed) / Math.log(1024)); - return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['Bps', 'kBps', 'MBps', 'GBps', 'TBps'][i]; + if (speed < 0) return "? B/s"; + var i = speed < 1 ? 0 : Math.floor(Math.log(speed) / Math.log(1024)); + return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['bps', 'kbps', 'Mbps', 'Gbps', 'Tbps'][i]; } var ui = ui || { @@ -348,8 +349,8 @@ ui.updateSpeed = function (peers) { ui._rsbytes = rsbytes; } else { delete ui._rsbytes; - $("dn_speed").innerText = "? Bs"; - $("up_speed").innerText = "? Bs"; + $("dn_speed").innerText = humanReadableSpeed(-1); + $("up_speed").innerText = humanReadableSpeed(-1); } }; diff --git a/contrib/ui/mesh-ui/ui/assets/mesh-ui.js b/contrib/ui/mesh-ui/ui/assets/mesh-ui.js index 294b4f3d..37f17914 100644 --- a/contrib/ui/mesh-ui/ui/assets/mesh-ui.js +++ b/contrib/ui/mesh-ui/ui/assets/mesh-ui.js @@ -225,8 +225,9 @@ function togglePrivKeyVisibility() { } function humanReadableSpeed(speed) { - var i = speed == 0 ? 0 : Math.floor(Math.log(speed) / Math.log(1024)); - return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['Bps', 'kBps', 'MBps', 'GBps', 'TBps'][i]; + if (speed < 0) return "? B/s"; + var i = speed < 1 ? 0 : Math.floor(Math.log(speed) / Math.log(1024)); + return (speed / Math.pow(1024, i)).toFixed(2) * 1 + ' ' + ['bps', 'kbps', 'Mbps', 'Gbps', 'Tbps'][i]; } var ui = ui || { @@ -327,8 +328,8 @@ ui.updateSpeed = peers => { ui._rsbytes = rsbytes; } else { delete ui._rsbytes; - $("dn_speed").innerText = "? Bs"; - $("up_speed").innerText = "? Bs"; + $("dn_speed").innerText = humanReadableSpeed(-1); + $("up_speed").innerText = humanReadableSpeed(-1); } } From 5469f3506b818a5e0f0c1df883c3afc95453ce03 Mon Sep 17 00:00:00 2001 From: Mihail Slobodyanuk Date: Tue, 20 Dec 2022 21:17:16 +0200 Subject: [PATCH 3/3] call StartHttpServer() early as soon as possible --- cmd/mesh/main.go | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cmd/mesh/main.go b/cmd/mesh/main.go index 28779930..cc230075 100644 --- a/cmd/mesh/main.go +++ b/cmd/mesh/main.go @@ -275,6 +275,9 @@ func run(args yggArgs, ctx context.Context) { } } + // Start HTTP server + n.admin.StartHttpServer(args.useconffile, cfg) + // Setup the multicast module. { options := []multicast.SetupOption{} @@ -317,8 +320,6 @@ func run(args yggArgs, ctx context.Context) { logger.Infof("Your public key is %s", hex.EncodeToString(public[:])) logger.Infof("Your IPv6 address is %s", address.String()) logger.Infof("Your IPv6 subnet is %s", subnet.String()) - // Start HTTP server - n.admin.StartHttpServer(args.useconffile, cfg) // Block until we are told to shut down. <-ctx.Done()