From 8c85be2125a25272a9a4a3eb08644378dca2db31 Mon Sep 17 00:00:00 2001 From: "aiyion.prime" Date: Mon, 25 Oct 2021 15:25:15 +0200 Subject: [PATCH] gluon-status-page: fix address_to_groups() In js `return` does behave like `continue` in a forEach() iteration. The fixed function was intended to return nothing on error and does so now, instead of a shorter (useless) array like before. --- .../files/lib/gluon/status-page/www/static/status-page.js | 2 +- package/gluon-status-page/javascript/status-page.js | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js b/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js index 9c082278..232553b6 100644 --- a/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js +++ b/package/gluon-status-page/files/lib/gluon/status-page/www/static/status-page.js @@ -1 +1 @@ -"use strict";!function(){var a=JSON.parse(document.body.getAttribute("data-translations"));function i(t,e){return t.toFixed(e).replace(/\./,a["."])}function o(t,e){e--;for(var n=t;10<=n&&0e[0]?-1:t[1]e[1]?1:0});var e=t[0][2];return e&&!/^fe80:/i.test(e)?e:void 0}}return t.wireless&&((c=i.insertCell()).textContent="-",c.setAttribute("data-label",r.children[Object.keys(g).length+1].textContent),(f=i.insertCell()).textContent="-",f.setAttribute("data-label",r.children[Object.keys(g).length+2].textContent),(u=i.insertCell()).textContent="-",u.setAttribute("data-label",r.children[Object.keys(g).length+3].textContent),s=E(e),t.signalgraph.addSignal(s)),i.onmouseenter=function(){i.classList.add("highlight"),s&&(s.highlight=!0)},i.onmouseleave=function(){i.classList.remove("highlight"),s&&(s.highlight=!1)},m(),{get_hostname:function(){return h.textContent},get_addr:function(){return d},update_nodeinfo:function(t){if(d=C(t.network.addresses)){if("span"===h.nodeName.toLowerCase()){var e=h;h=document.createElement("a"),e.parentNode.replaceChild(h,e)}h.href="http://["+d+"]/"}if(h.textContent=t.hostname,y&&t.location){var n=(r=y.latitude,i=y.longitude,a=t.location.latitude,o=t.location.longitude,c=Math.PI/180,u=(a*=c)-(r*=c),s=(o*=c)-(i*=c),l=Math.sin(u/2)*Math.sin(u/2)+Math.sin(s/2)*Math.sin(s/2)*Math.cos(r)*Math.cos(a),2*Math.asin(Math.sqrt(l))*6372.8);f.textContent=Math.round(1e3*n)+" m"}var r,i,a,o,c,u,s,l;m()},update_mesh:function(n){Object.keys(g).forEach(function(t){var e=g[t];e.td.textContent=n[t]+e.suffix}),m()},update_wifi:function(t){c.textContent=t.signal,u.textContent=Math.round(t.inactive/1e3)+" s",i.classList.toggle("inactive",200e[0]||t[1]e[1]?1:0});t=t[0][2];return t&&!/^fe80:/i.test(t)?t:void 0}}return t.wireless&&((g=a.insertCell()).textContent="-",g.setAttribute("data-label",i.children[Object.keys(u).length+1].textContent),(v=a.insertCell()).textContent="-",v.setAttribute("data-label",i.children[Object.keys(u).length+2].textContent),(p=a.insertCell()).textContent="-",p.setAttribute("data-label",i.children[Object.keys(u).length+3].textContent),m=A(e),t.signalgraph.addSignal(m)),a.onmouseenter=function(){a.classList.add("highlight"),m&&(m.highlight=!0)},a.onmouseleave=function(){a.classList.remove("highlight"),m&&(m.highlight=!1)},y(),{get_hostname:function(){return s.textContent},get_addr:function(){return o},update_nodeinfo:function(t){var e,n,r,i,a;(o=E(t.network.addresses))&&("span"===s.nodeName.toLowerCase()&&(a=s,s=document.createElement("a"),a.parentNode.replaceChild(s,a)),s.href="http://["+o+"]/"),s.textContent=t.hostname,x&&t.location&&(e=x.latitude,n=x.longitude,r=t.location.latitude,i=t.location.longitude,a=Math.PI/180,t=(r*=a)-(e*=a),n=(i*=a)-(n*=a),r=Math.sin(t/2)*Math.sin(t/2)+Math.sin(n/2)*Math.sin(n/2)*Math.cos(e)*Math.cos(r),r=6372.8*(2*Math.asin(Math.sqrt(r))),v.textContent=Math.round(1e3*r)+" m"),y()},update_mesh:function(n){Object.keys(u).forEach(function(t){var e=u[t];e.td.textContent=n[t]+e.suffix}),y()},update_wifi:function(t){g.textContent=t.signal,p.textContent=Math.round(t.inactive/1e3)+" s",a.classList.toggle("inactive",200