From 9a0b5ac672a97e75100f0fac1af209ebef2115ad Mon Sep 17 00:00:00 2001
From: Nils Schneider
Date: Thu, 30 Jul 2015 19:20:16 +0200
Subject: [PATCH 1/4] update to nodes.json version 2
---
lib/main.js | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/lib/main.js b/lib/main.js
index c517768..4f2aab4 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -5,14 +5,12 @@ function (moment, Router, L, GUI, numeral) {
var dataNodes = data[0]
var dataGraph = data[1]
- if (dataNodes.version !== 1 || dataGraph.version !== 1) {
+ if (dataNodes.version !== 2 || dataGraph.version !== 1) {
var err = "Unsupported nodes or graph version: " + dataNodes.version + " " + dataGraph.version
throw err
}
- var nodes = Object.keys(dataNodes.nodes).map(function (key) { return dataNodes.nodes[key] })
-
- nodes = nodes.filter( function (d) {
+ var nodes = dataNodes.nodes.filter( function (d) {
return "firstseen" in d && "lastseen" in d
})
@@ -27,7 +25,12 @@ function (moment, Router, L, GUI, numeral) {
var newnodes = limit("firstseen", age, sortByKey("firstseen", nodes).filter(online))
var lostnodes = limit("lastseen", age, sortByKey("lastseen", nodes).filter(offline))
- var graphnodes = dataNodes.nodes
+ var graphnodes = {}
+
+ dataNodes.nodes.forEach( function (d) {
+ graphnodes[d.nodeinfo.node_id] = d
+ })
+
var graph = dataGraph.batadv
graph.nodes.forEach( function (d) {
@@ -75,7 +78,7 @@ function (moment, Router, L, GUI, numeral) {
})
return { now: now,
- timestamp: moment.utc(data[0].timestamp).local(),
+ timestamp: moment.utc(dataNodes.timestamp).local(),
nodes: {
all: nodes,
new: newnodes,
From 5a278f5b8665f1b0612ba74c9f471c8d466b7d1f Mon Sep 17 00:00:00 2001
From: Nils Schneider
Date: Fri, 4 Sep 2015 14:59:26 +0200
Subject: [PATCH 2/4] about: update source code URL to github/ffnord
---
lib/about.js | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/lib/about.js b/lib/about.js
index b88ecfa..d6161ce 100644
--- a/lib/about.js
+++ b/lib/about.js
@@ -28,8 +28,8 @@ define(function () {
s += "https://www.gnu.org/licenses/.
"
s += "You may find the source code at "
- s += ""
- s += "http://draic.info/meshviewer."
+ s += ""
+ s += "https://github.com/ffnord/meshviewer."
el.innerHTML = s
}
From aeae86699847528fc610c81cddd02cad8bea2c4f Mon Sep 17 00:00:00 2001
From: Nils Schneider
Date: Wed, 8 Jul 2015 10:06:43 +0200
Subject: [PATCH 3/4] proportions: sort firmware based on version
---
lib/proportions.js | 6 ++---
lib/vercomp.js | 60 ++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 63 insertions(+), 3 deletions(-)
create mode 100644 lib/vercomp.js
diff --git a/lib/proportions.js b/lib/proportions.js
index 29267af..b615ac1 100644
--- a/lib/proportions.js
+++ b/lib/proportions.js
@@ -1,5 +1,5 @@
-define(["chroma-js", "virtual-dom", "numeral-intl"],
- function (Chroma, V, numeral) {
+define(["chroma-js", "virtual-dom", "numeral-intl", "vercomp" ],
+ function (Chroma, V, numeral, vercomp) {
return function (config) {
var self = this
@@ -128,7 +128,7 @@ define(["chroma-js", "virtual-dom", "numeral-intl"],
})
fillTable(statusTable, statusDict.sort(function (a, b) { return b[1] - a[1] }))
- fillTable(fwTable, fwDict.sort(function (a, b) { return b[1] - a[1] }))
+ fillTable(fwTable, fwDict.sort(function (a, b) { return vercomp(b[0], a[0]) }))
fillTable(hwTable, hwDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable(geoTable, geoDict.sort(function (a, b) { return b[1] - a[1] }))
fillTable(autoTable, autoDict.sort(function (a, b) { return b[1] - a[1] }))
diff --git a/lib/vercomp.js b/lib/vercomp.js
new file mode 100644
index 0000000..428f258
--- /dev/null
+++ b/lib/vercomp.js
@@ -0,0 +1,60 @@
+define([], function () {
+ function order(c) {
+ if (/^\d$/.test(c))
+ return 0
+ else if (/^[a-z]$/i.test(c))
+ return c.charCodeAt(0)
+ else if (c === "~")
+ return -1
+ else if (c)
+ return c.charCodeAt(0) + 256
+ else
+ return 0
+ }
+
+ // Based on dpkg code
+ function vercomp(a, b) {
+ var apos = 0, bpos = 0
+ while (apos < a.length || bpos < b.length) {
+ var firstDiff = 0
+
+ while ((apos < a.length && !/^\d$/.test(a[apos])) || (bpos < b.length && !/^\d$/.test(b[bpos]))) {
+ var ac = order(a[apos])
+ var bc = order(b[bpos])
+
+ if (ac !== bc)
+ return ac - bc
+
+ apos++
+ bpos++
+ }
+
+ while (a[apos] === "0")
+ apos++
+
+ while (b[bpos] === "0")
+ bpos++
+
+ while (/^\d$/.test(a[apos]) && /^\d$/.test(b[bpos])) {
+ if (firstDiff === 0)
+ firstDiff = a.charCodeAt(apos) - b.charCodeAt(bpos)
+
+ apos++
+ bpos++
+ }
+
+ if (/^\d$/.test(a[apos]))
+ return 1
+
+ if (/^\d$/.test(b[bpos]))
+ return -1
+
+ if (firstDiff !== 0)
+ return firstDiff
+ }
+
+ return 0
+ }
+
+ return vercomp
+})
From 1d1eb0b3387e6d248464071f0b17b357cdbe315f Mon Sep 17 00:00:00 2001
From: Kyra Zimmer
Date: Wed, 30 Sep 2015 17:38:02 +0200
Subject: [PATCH 4/4] Update README.md
---
README.md | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/README.md b/README.md
index 1f81a78..f82e006 100644
--- a/README.md
+++ b/README.md
@@ -74,7 +74,7 @@ Setting this to `false` will hide contact information for nodes.
## maxAge (integer)
Nodes being online for less than maxAge days are considered "new". Likewise,
-nodes being offline for less than than maxAge days are considered "lost".
+nodes being offline for more than than maxAge days are considered "lost".
## mapLayers (List)