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 +++++++++++++++++---- .../luci-splash/luasrc/view/splash/blocked.htm | 25 ++++ 2 files changed, 136 insertions(+), 20 deletions(-) create mode 100644 applications/luci-splash/luasrc/view/splash/blocked.htm (limited to 'applications/luci-splash/luasrc/view') 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 %>
diff --git a/applications/luci-splash/luasrc/view/splash/blocked.htm b/applications/luci-splash/luasrc/view/splash/blocked.htm new file mode 100644 index 0000000000..de61ecf011 --- /dev/null +++ b/applications/luci-splash/luasrc/view/splash/blocked.htm @@ -0,0 +1,25 @@ +<%# +LuCI - Lua Configuration Interface +Copyright 2011 Manuel Munz + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 +-%> +<% +local contacturl = luci.dispatcher.build_url("freifunk", "contact") +%> + +<%+header%> + +

<%:Blocked%>

+ +

<%:Your access to this network has been blocked, most likely because you did something that our rules explicitly forbid.%>

+

<%:To ask for the reason why you have been blocked or ask for access again you can try to contact the owner of this access point:%> <%:Contact%>

+ +<%+footer%> + + + -- cgit v1.2.3