From: Manuel Munz Date: Sat, 16 Mar 2013 18:37:24 +0000 (+0000) Subject: modules/freifunk: Remove olsrd infos from status.json X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6cd01c013a352d0235160a542ab1e15e0f58e0a7;p=oweals%2Fluci.git modules/freifunk: Remove olsrd infos from status.json --- diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua index 2ea006727..ed4d6847d 100644 --- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua @@ -105,55 +105,6 @@ function index() entry({"admin", "freifunk", "profile_error"}, template("freifunk/profile_error")) end -local function fetch_olsrd() - local sys = require "luci.sys" - local util = require "luci.util" - local table = require "table" - local rawdata = sys.httpget("http://127.0.0.1:2006/") - - if #rawdata == 0 then - if nixio.fs.access("/proc/net/ipv6_route", "r") then - rawdata = sys.httpget("http://[::1]:2006/") - if #rawdata == 0 then - return nil - end - else - return nil - end - end - - local data = {} - - local tables = util.split(util.trim(rawdata), "\r?\n\r?\n", nil, true) - - - for i, tbl in ipairs(tables) do - local lines = util.split(tbl, "\r?\n", nil, true) - local name = table.remove(lines, 1):sub(8) - local keys = util.split(table.remove(lines, 1), "\t") - local split = #keys - 1 - - data[name] = {} - - for j, line in ipairs(lines) do - local fields = util.split(line, "\t", split) - data[name][j] = {} - for k, key in pairs(keys) do - data[name][j][key] = fields[k] - end - - if data[name][j].Linkcost then - data[name][j].LinkQuality, - data[name][j].NLQ, - data[name][j].ETX = - data[name][j].Linkcost:match("([%w.]+)/([%w.]+)[%s]+([%w.]+)") - end - end - end - - return data -end - function zeroes() local string = require "string" local http = require "luci.http" @@ -244,8 +195,6 @@ function jsonstatus() end) end - root.olsrd = fetch_olsrd() - http.prepare_content("application/json") ltn12.pump.all(json.Encoder(root):source(), http.write) end