Rework LuCI build system
[project/luci.git] / applications / luci-app-tinyproxy / luasrc / view / tinyproxy_status.htm
1 <%
2
3 if luci.http.formvalue("frame") == "1" then
4 local uci = require "luci.model.uci".cursor()
5 local addr = "127.0.0.1"
6 local port = "8888"
7
8 uci:foreach("tinyproxy", "tinyproxy",
9 function(s)
10 addr = s.StatHost or addr
11 port = s.Port or port
12 return false
13 end)
14
15 local data = false
16 local wget = io.popen("wget -qO- http://%s:%s" % { addr, port })
17 if wget then
18 while true do
19 local l = wget:read("*l")
20 if not l then
21 break
22 end
23
24 luci.http.write(l)
25 data = true
26 end
27
28 wget:close()
29 end
30
31 if not data then
32 luci.http.write(translate("Failed to retrieve statistics from url:"))
33 luci.http.write(" http://%s:%s" % { addr, port })
34 end
35
36 return
37 end
38
39 -%>
40
41 <%+header%>
42
43 <div class="cbi-map">
44 <h2><a id="content" name="content"><%:Tinyproxy Status%></a></h2>
45 <div class="cbi-section">
46 <iframe src="<%=REQUESTURL%>?frame=1" style="width:100%; height:350px; border:none"></iframe>
47 </div>
48 </div>
49
50 <%+footer%>