From c5329d85d5a3f4ac14d0a07b298167876d979413 Mon Sep 17 00:00:00 2001 From: Manuel Munz Date: Wed, 30 Nov 2011 05:50:43 +0000 Subject: applications/splash: Fix blacklisting mechanism, expose status on public freifunk page, add json output and autoupdate. --- .../luasrc/view/admin_status/splash.htm | 131 +++++++++++++++++---- 1 file changed, 111 insertions(+), 20 deletions(-) (limited to 'applications/luci-splash/luasrc/view/admin_status') diff --git a/applications/luci-splash/luasrc/view/admin_status/splash.htm b/applications/luci-splash/luasrc/view/admin_status/splash.htm index 1b55e7b275..86cb9c83a1 100644 --- a/applications/luci-splash/luasrc/view/admin_status/splash.htm +++ b/applications/luci-splash/luasrc/view/admin_status/splash.htm @@ -124,10 +124,98 @@ local function showmac(mac) return mac end +if luci.http.formvalue("status") == "1" then + local rv = {} + for _, c in utl.spairs(clients, + function(a,b) if clients[a].policy == clients[b].policy then + return (clients[a].start > clients[b].start) + else + return (clients[a].policy > clients[b].policy) + end + end) + do + if c.ip then + rv[#rv+1] = { + hostname = c.hostname or "?", + ip = c.ip or "?", + mac = showmac(c.mac) or "?", + timeleft = (c.limit >= os.time()) and wat.date_format(c.limit-os.time()) or (c.policy ~= "normal") and "-" or "expired", + trafficin = wat.byte_format(c.bytes_in) or "?", + trafficout = wat.byte_format(c.bytes_out) or "?", + policy = c.policy or "?" + } + end + end + luci.http.prepare_content("application/json") + luci.http.write_json(rv) + return +end -%> + + <%+header%> + + + +

<%:Client-Splash%>

@@ -135,14 +223,16 @@ end
<% if is_admin then %>
<% end %> - - - - - - - - + + + + + + + + + + <%- local count = 0 @@ -158,7 +248,8 @@ end if c.ip then count = count + 1 -%> - + + @@ -182,19 +273,19 @@ end <%=c.policy%> <% end %> - - <%- + + <%- + end end - end - - if count == 0 then - -%> - - - + if count == 0 then + -%> + + + <%- end -%> +
<%:Hostname%><%:IP Address%><%:MAC Address%><%:Time remaining%><%:Traffic in/out%><%:Policy%>
<%:Hostname%><%:IP Address%><%:MAC Address%><%:Time remaining%><%:Traffic in/out%><%:Policy%>
<%=c.hostname or "" .. translate("unknown") .. ""%> <%=c.ip or "" .. translate("unknown") .. ""%> <%=showmac(c.mac)%>
-
<%:No clients connected%>
-
+
<%:No clients connected%>
+
<% if is_admin then %>
<% end %>
-- cgit v1.2.3