luci-app-olsr: convert olsr.lua and overview.htm to new json plugin
authorpmelange <isprotejesvalkata@gmail.com>
Mon, 5 Nov 2018 16:20:16 +0000 (17:20 +0100)
committerpmelange <isprotejesvalkata@gmail.com>
Wed, 7 Nov 2018 17:41:58 +0000 (18:41 +0100)
Signed-off-by: pmelange <isprotejesvalkata@gmail.com>
applications/luci-app-olsr/luasrc/controller/olsr.lua
applications/luci-app-olsr/luasrc/view/status-olsr/overview.htm

index c5fb2b2a539f3b5537c0dd71e0c85b5d67c118b8..ff4a248dae8373c051ab21f3258cb44ec2a4d937 100644 (file)
@@ -87,8 +87,8 @@ function action_json()
        local v4_port = tonumber(uci:get("olsrd", "olsrd_jsoninfo", "port") or "") or 9090
        local v6_port = tonumber(uci:get("olsrd6", "olsrd_jsoninfo", "port") or "") or 9090
 
-       jsonreq4 = utl.exec("(echo /status | nc 127.0.0.1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v4_port)
-       jsonreq6 = utl.exec("(echo /status | nc ::1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v6_port)
+       jsonreq4 = utl.exec("(echo /all | nc 127.0.0.1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v4_port)
+       jsonreq6 = utl.exec("(echo /all | nc ::1 %d | sed -n '/^[}{ ]/p') 2>/dev/null" % v6_port)
        http.prepare_content("application/json")
        if not jsonreq4 or jsonreq4 == "" then
                jsonreq4 = "{}"
index f205edc16dbfed77ad54875b885c48635eace2e6..7bfd73df20a97ad2abca3d36eb1b24eb1e25822e 100644 (file)
@@ -61,12 +61,12 @@ XHR.poll(10, '<%=REQUEST_URI%>/json', { },
                if (e = document.getElementById('version'))
                        var version;
                        var date;
-                       if (info.v4.config.olsrdVersion != undefined) {
-                               version = info.v4.config.olsrdVersion
-                               date = info.v4.config.olsrdBuildDate
-                       } else if (info.v6.config.olsrdVersion != undefined) {
-                               version = info.v6.config.olsrdVersion
-                               date = info.v6.config.olsrdBuildDate
+                       if (info.v4.version.version != undefined) {
+                               version = info.v4.version.version
+                               date = info.v4.version.date
+                       } else if (info.v6.version.version != undefined) {
+                               version = info.v6.version.version
+                               date = info.v6.version.date
                        } else {
                                version = 'unknown'
                                date = 'unknown'