projects
/
project
/
luci.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
f6b77ef
)
applications/luci-vnstat: minor tweaks
author
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 25 Oct 2010 23:19:00 +0000
(23:19 +0000)
committer
Jo-Philipp Wich
<jow@openwrt.org>
Mon, 25 Oct 2010 23:19:00 +0000
(23:19 +0000)
applications/luci-vnstat/luasrc/view/vnstat.htm
patch
|
blob
|
history
diff --git
a/applications/luci-vnstat/luasrc/view/vnstat.htm
b/applications/luci-vnstat/luasrc/view/vnstat.htm
index 440252caa7441c99d555b4f0f787044aadf2644a..91fd3322375911d3ae6058799565a54733fe0aa4 100644
(file)
--- a/
applications/luci-vnstat/luasrc/view/vnstat.htm
+++ b/
applications/luci-vnstat/luasrc/view/vnstat.htm
@@
-28,9
+28,12
@@
style = (style and #style > 0) and style or "s"
-- render image
--
if iface then
-- render image
--
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"))
png:close()
luci.http.write(png:read("*a"))
png:close()
@@
-79,10
+82,18
@@
dbdir = dbdir or "/var/lib/vnstat"
<br /><hr /><br />
<div style="text-align:center">
<br /><hr /><br />
<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="" />
<br /><br />
<% end end %>
<img src="<%=REQUEST_URI%>?iface=<%=iface%>&style=<%=param('style')%>" alt="" />
<br /><br />
<% 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>
<%+footer%>
</div>
<%+footer%>