X-Git-Url: http://git.archive.openwrt.org/?a=blobdiff_plain;f=modules%2Ffreifunk%2Fluasrc%2Fcontroller%2Ffreifunk%2Ffreifunk.lua;h=666f0864b3f5844062bb418c5eaa0ea91bb03212;hb=a521cddcf89bb47c1dd20581c428bc4566d478e4;hp=89cd0ff50cf531fb58064091e91e86704ff0de79;hpb=bb5986cf13b5cdfffc00ce721fe0829e3a5aca2d;p=project%2Fluci.git diff --git a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua index 89cd0ff50..666f0864b 100644 --- a/modules/freifunk/luasrc/controller/freifunk/freifunk.lua +++ b/modules/freifunk/luasrc/controller/freifunk/freifunk.lua @@ -51,12 +51,16 @@ function index() page.order = 20 page.i18n = "base" page.setuser = false - page.setgroup = false + page.setgroup = false entry({"freifunk", "status.json"}, call("jsonstatus")) entry({"freifunk", "status", "zeroes"}, call("zeroes"), "Testdownload") entry({"freifunk", "status", "public_status_json"}, call("public_status_json")).leaf = true + if nixio.fs.access("/usr/sbin/luci-splash") then + assign({"freifunk", "status", "splash"}, {"splash", "publicstatus"}, _("Splash"), 40) + end + assign({"freifunk", "olsr"}, {"admin", "status", "olsr"}, _("OLSR"), 30) if nixio.fs.access("/etc/config/luci_statistics") then @@ -215,7 +219,6 @@ function jsonstatus() root.network = {} root.wireless = {devices = {}, interfaces = {}, status = {}} local wifs = root.wireless.interfaces - local wifidata = luci.sys.wifi.getiwconfig() or {} local netdata = luci.sys.net.deviceinfo() or {} for _, vif in ipairs(ffwifs) do @@ -225,7 +228,18 @@ function jsonstatus() if s.device == vif and s.network == vif then wifs[#wifs+1] = s if s.ifname then - root.wireless.status[s.ifname] = wifidata[s.ifname] + local iwinfo = luci.sys.wifi.getiwinfo(s.ifname) + if iwinfo then + root.wireless.status[s.ifname] = { } + + local _, f + for _, f in ipairs({ + "channel", "txpower", "bitrate", "signal", "noise", + "quality", "quality_max", "mode", "ssid", "bssid", "encryption", "ifname" + }) do + root.wireless.status[s.ifname][f] = iwinfo[f] + end + end end end end) @@ -292,7 +306,18 @@ function public_status_json() dest = dr4.dest:string(), dev = dr4.device, metr = dr4.metric } - end + else + local dr = sys.exec("ip r s t olsr-default") + if dr then + local dest, gateway, dev, metr = dr:match("^(%w+) via (%d+.%d+.%d+.%d+) dev (%w+) +metric (%d+)") + def4 = { + dest = dest, + gateway = gateway, + dev = dev, + metr = metr + } + end + end rv[#rv+1] = { time = os.date("%a, %d %b %Y, %H:%M:%S"),