applications/luci-vnstat: minor tweaks
This commit is contained in:
parent
f6b77ef7f0
commit
6c7535292b
1 changed files with 13 additions and 2 deletions
|
@ -28,9 +28,12 @@ style = (style and #style > 0) and style or "s"
|
||||||
-- render image
|
-- render image
|
||||||
--
|
--
|
||||||
if iface then
|
if iface then
|
||||||
|
style = style:gsub("[^%w]", "")
|
||||||
|
iface = iface:gsub("[^%w%.%-]", "")
|
||||||
|
|
||||||
luci.http.prepare_content("image/png")
|
luci.http.prepare_content("image/png")
|
||||||
|
|
||||||
local png = io.popen("vnstati -i %q -%q -o -" % { iface, style })
|
local png = io.popen("vnstati -i '%s' '-%s' -o -" % { iface, style })
|
||||||
luci.http.write(png:read("*a"))
|
luci.http.write(png:read("*a"))
|
||||||
png:close()
|
png:close()
|
||||||
|
|
||||||
|
@ -79,10 +82,18 @@ dbdir = dbdir or "/var/lib/vnstat"
|
||||||
<br /><hr /><br />
|
<br /><hr /><br />
|
||||||
|
|
||||||
<div style="text-align:center">
|
<div style="text-align:center">
|
||||||
<% for iface in fs.dir(dbdir) do if iface:sub(1,1) ~= "." then %>
|
<% empty = true
|
||||||
|
for iface in fs.dir(dbdir) do if iface:sub(1,1) ~= "." then
|
||||||
|
empty = false
|
||||||
|
%>
|
||||||
<img src="<%=REQUEST_URI%>?iface=<%=iface%>&style=<%=param('style')%>" alt="" />
|
<img src="<%=REQUEST_URI%>?iface=<%=iface%>&style=<%=param('style')%>" alt="" />
|
||||||
<br /><br />
|
<br /><br />
|
||||||
<% end end %>
|
<% end end %>
|
||||||
|
|
||||||
|
<% if empty then %>
|
||||||
|
<p><em><%:No database has been set up yet. Go to the VnStat configuration and enable monitoring for one or more interfaces.%></em></p>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<%+footer%>
|
<%+footer%>
|
||||||
|
|
Loading…
Reference in a new issue