freifunk-bot

Modular parser for the hackerspace door status with handlers for multiple services
git clone git://archive.git.mtrnord.blog/MTRNord/freifunk-bot.git
Log | Files | Refs | README | LICENSE

commit b3ade04484365d92510c3502f82316984d54614b
parent 77b7f497d4affeb43846303bf9a77e4219bce232
Author: MTRNord <mtrnord1@gmail.com>
Date:   Sun, 11 Sep 2016 21:51:35 +0200

remove because api limits location

Diffstat:
Mhandlers/parseNodes.js | 31++++++++-----------------------
1 file changed, 8 insertions(+), 23 deletions(-)

diff --git a/handlers/parseNodes.js b/handlers/parseNodes.js @@ -157,29 +157,14 @@ module.exports = { clients = key["statistics"]["clients"] status = key["flags"]["online"] since = key["firstseen"] - lat = key["nodeinfo"]["location"]["latitude"] - lon = key["nodeinfo"]["location"]["longitude"] - request.get('http://nominatim.openstreetmap.org/reverse?format=json&lat='+ lat + '&lon=' + lon + '&zoom=18&addressdetails=1'), function (error, response, body) { - if (!error && response.statusCode === 200) { - addressJson = JSON.parse(body) - _.find(addressJson.address, function (key) { - house_number = key["house_number"] - road = key["road"] - town = key["town"] - postcode = key["postcode"] - country = key["country"] - adress = road + " " + house_number + ", " + postcode + " " + town + ", " + country - if(handler == "telegram"){ - output = "<b>Name: </b>" + name + "\n<b>Router Location: </b>" + adress + "\n<b>Router Model: </b>" + router + "\n<b>Firmware Version: </b>" + version + "\n<b>Autoupdater Status: </b>" + autoupdate + "\n<b>Autoupdater Branch: </b>" + autoupdateBranch + "\n<b>Clients Connected: </b>" + clients + "\n<b>Online Status: </b>" + status + "\n<b>First Seen: </b>" + since - } - if(handler == "irc"){ - output = "Name: " + name + "\nRouter Location: " + adress + "\nRouter Model: " + router + "\nFirmware Version: " + version + "\nAutoupdater Status: " + autoupdate + "\nAutoupdater Branch: " + autoupdateBranch + "\nClients Connected: " + clients + "\nOnline Status: " + status + "\nFirst Seen: " + since - } - if(handler == "slack"){ - output = "<b>Name: </b>" + name + "\n<b>Router Location: </b>" + adress + "\n<b>Router Model: </b>" + router + "\n<b>Firmware Version: </b>" + version + "\n<b>Autoupdater Status: </b>" + autoupdate + "\n<b>Autoupdater Branch: </b>" + autoupdateBranch + "\n<b>Clients Connected: </b>" + clients + "\n<b>Online Status: </b>" + status + "\n<b>First Seen: </b>" + since - } - }); - } + if(handler == "telegram"){ + output = "<b>Name: </b>" + name + "\n<b>Router Model: </b>" + router + "\n<b>Firmware Version: </b>" + version + "\n<b>Autoupdater Status: </b>" + autoupdate + "\n<b>Autoupdater Branch: </b>" + autoupdateBranch + "\n<b>Clients Connected: </b>" + clients + "\n<b>Online Status: </b>" + status + "\n<b>First Seen: </b>" + since + } + if(handler == "irc"){ + output = "Name: " + name + "\nRouter Model: " + router + "\nFirmware Version: " + version + "\nAutoupdater Status: " + autoupdate + "\nAutoupdater Branch: " + autoupdateBranch + "\nClients Connected: " + clients + "\nOnline Status: " + status + "\nFirst Seen: " + since + } + if(handler == "slack"){ + output = "<b>Name: </b>" + name + "\n<b>Router Model: </b>" + router + "\n<b>Firmware Version: </b>" + version + "\n<b>Autoupdater Status: </b>" + autoupdate + "\n<b>Autoupdater Branch: </b>" + autoupdateBranch + "\n<b>Clients Connected: </b>" + clients + "\n<b>Online Status: </b>" + status + "\n<b>First Seen: </b>" + since } } });