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