require("ffluci.sys")
function action_index()
- local data = fetch_txtinfo()
+ local data = fetch_txtinfo("links")
if not data or not data.Links then
ffluci.template.render("public_olsr/error_olsr")
end
function action_routes()
- local data = fetch_txtinfo()
+ local data = fetch_txtinfo("routes")
- if not data or not data.Links then
+ if not data or not data.Routes then
ffluci.template.render("public_olsr/error_olsr")
return nil
end
end
function action_topology()
- local data = fetch_txtinfo()
+ local data = fetch_txtinfo("topology")
- if not data or not data.Links then
+ if not data or not data.Topology then
ffluci.template.render("public_olsr/error_olsr")
return nil
end
end
function action_hna()
- local data = fetch_txtinfo()
+ local data = fetch_txtinfo("hna")
- if not data or not data.Links then
+ if not data or not data.HNA then
ffluci.template.render("public_olsr/error_olsr")
return nil
end
end
function action_mid()
- local data = fetch_txtinfo()
+ local data = fetch_txtinfo("mid")
- if not data or not data.Links then
+ if not data or not data.MID then
ffluci.template.render("public_olsr/error_olsr")
return nil
end
-- Internal
-function fetch_txtinfo()
- local rawdata = ffluci.sys.httpget("http://127.0.0.1:2006")
+function fetch_txtinfo(table)
+ table = table or ""
+ local rawdata = ffluci.sys.httpget("http://127.0.0.1:2006/"..table)
if #rawdata == 0 then
return nil