Selaa lähdekoodia

config: introduce maxAge setting

Nils Schneider 9 vuotta sitten
vanhempi
commit
115444f1cb
3 muutettua tiedostoa jossa 8 lisäystä ja 2 poistoa
  1. 5 0
      README.md
  2. 2 1
      config.js.example
  3. 1 1
      lib/main.js

+ 5 - 0
README.md

@@ -62,6 +62,11 @@ area. Values like 1.0 and 0.5 might be good choices.
 
 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".
+
 # Building
 
 Just run the following command from the meshviewer directory:

+ 2 - 1
config.js.example

@@ -2,5 +2,6 @@ define({
   "dataPath": "https://map.luebeck.freifunk.net/data/",
   "siteName": "Freifunk Lübeck",
   "mapSigmaScale": 0.5,
-  "showContact": true
+  "showContact": true,
+  "maxAge": 14
 })

+ 1 - 1
lib/main.js

@@ -22,7 +22,7 @@ function (config, moment, Router, L, GUI, numeral) {
       })
 
       var now = moment()
-      var age = moment(now).subtract(14, "days")
+      var age = moment(now).subtract(config.maxAge, "days")
 
       var newnodes = limit("firstseen", age, sortByKey("firstseen", nodes).filter(online))
       var lostnodes = limit("lastseen", age, sortByKey("lastseen", nodes).filter(offline))