From 5f8c9e6ee23bfd79cfab610330596a03c1182c12 Mon Sep 17 00:00:00 2001 From: Ylian Saint-Hilaire Date: Thu, 7 May 2020 18:58:02 -0700 Subject: [PATCH] Added online filter in web app --- translate/translate.json | 14 +++++++++++++- views/default.handlebars | 5 +++++ webserver.js | 1 + 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/translate/translate.json b/translate/translate.json index 51044a13..efca3653 100644 --- a/translate/translate.json +++ b/translate/translate.json @@ -19030,6 +19030,12 @@ "default.handlebars->25->119" ] }, + { + "en": "Online", + "xloc": [ + "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar->9->1" + ] + }, { "cs": "Připojených uživatelů", "de": "Benutzer online", @@ -19066,6 +19072,12 @@ "default.handlebars->25->746" ] }, + { + "en": "Only show devices that are online", + "xloc": [ + "default.handlebars->container->column_l->p1->devListToolbarSpan->1->0->devListToolbar->9" + ] + }, { "cs": "Otevřít soubor…", "de": "Datei öffnen...", @@ -30926,4 +30938,4 @@ ] } ] -} +} \ No newline at end of file diff --git a/views/default.handlebars b/views/default.handlebars index 5b56c66a..ea42505b 100644 --- a/views/default.handlebars +++ b/views/default.handlebars @@ -232,6 +232,7 @@     +     @@ -4089,6 +4090,10 @@ } } catch (ex) { for (var d in nodes) { nodes[d].v = true; } } } + + // Check power state + var onlineOnly = Q('OnlineCheckBox').checked; + if (onlineOnly) { for (var d in nodes) { if ((nodes[d].conn == null) || (nodes[d].conn == 0)) { nodes[d].v = false; } } } } var contextelement = null; diff --git a/webserver.js b/webserver.js index ec554867..e3a8303a 100644 --- a/webserver.js +++ b/webserver.js @@ -3524,6 +3524,7 @@ module.exports.CreateWebServer = function (parent, db, args, certificates) { } else if (req.query.meshaction != null) { if ((domain.loginkey != null) && (domain.loginkey.indexOf(req.query.key) == -1)) { res.sendStatus(404); return; } // Check 3FA URL key var user = obj.users[req.session.userid]; + if (user == null) { res.sendStatus(404); return; } if ((req.query.meshaction == 'route') && (req.query.nodeid != null)) { obj.db.Get(req.query.nodeid, function (err, nodes) { if (nodes.length != 1) { res.sendStatus(401); return; }