添加状态信息部分的frpc版本显示
This commit is contained in:
parent
d8287f5638
commit
e4087ab694
@ -13,6 +13,7 @@ end
|
|||||||
function act_status()
|
function act_status()
|
||||||
local e = {}
|
local e = {}
|
||||||
e.running = luci.sys.call("pidof frpc > /dev/null") == 0
|
e.running = luci.sys.call("pidof frpc > /dev/null") == 0
|
||||||
|
e.bin_version = luci.sys.exec("frpc -v")
|
||||||
luci.http.prepare_content("application/json")
|
luci.http.prepare_content("application/json")
|
||||||
luci.http.write_json(e)
|
luci.http.write_json(e)
|
||||||
end
|
end
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
<script type="text/javascript">//<![CDATA[
|
|
||||||
XHR.poll(3, '<%=url([[admin]], [[services]], [[frpc]], [[status]])%>', null,
|
|
||||||
function(x, data) {
|
|
||||||
var tb = document.getElementById('frpc_status');
|
|
||||||
if (data && tb) {
|
|
||||||
if (data.running) {
|
|
||||||
var links = '<em><b><font color=green>Frpc <%:RUNNING%></font></b></em>';
|
|
||||||
tb.innerHTML = links;
|
|
||||||
} else {
|
|
||||||
tb.innerHTML = '<em><b><font color=red>Frpc <%:NOT RUNNING%></font></b></em>';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
);
|
|
||||||
//]]>
|
|
||||||
</script>
|
|
||||||
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
|
||||||
<fieldset class="cbi-section">
|
|
||||||
<p id="frpc_status">
|
|
||||||
<em><%:Collecting data...%></em>
|
|
||||||
</p>
|
|
||||||
</fieldset>
|
|
27
luci-app-frpc/luasrc/view/frpc/frpc_status.htm
Normal file
27
luci-app-frpc/luasrc/view/frpc/frpc_status.htm
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
<script type="text/javascript">//<![CDATA[
|
||||||
|
XHR.poll(3, '<%=url([[admin]], [[services]], [[frpc]], [[status]])%>', null,
|
||||||
|
function(x, data) {
|
||||||
|
var tb = document.getElementById('frpc_status');
|
||||||
|
if (data && tb) {
|
||||||
|
if (data.running) {
|
||||||
|
tb.innerHTML = '<em><b><font color=green> <%:Frpc%> ' + data.bin_version + '<%:RUNNING%></font></b></em><input class="btn cbi-button mar-10" type="button" value="<%:Open Frpc page%>" onclick="openwebui();" />';
|
||||||
|
} else {
|
||||||
|
tb.innerHTML = '<em><b><font color=red> <%:Frpc%> ' + data.bin_version + '<%:NOT RUNNING%></font></b></em>';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
function openwebui(){
|
||||||
|
var url = window.location.host+":<%=luci.sys.exec("uci -q get frpc.common.transport_webServer_port"):gsub("^%s*(.-)%s*$", "%1")%>";
|
||||||
|
window.open('http://'+url,'target','');
|
||||||
|
}
|
||||||
|
|
||||||
|
//]]>
|
||||||
|
</script>
|
||||||
|
<style>.mar-10 {margin-left: 50px; margin-right: 10px;}</style>
|
||||||
|
<fieldset class="cbi-section">
|
||||||
|
<p id="frpc_status">
|
||||||
|
<em><%:Collecting data...%></em>
|
||||||
|
</p>
|
||||||
|
</fieldset>
|
Loading…
Reference in New Issue
Block a user