lede/package/lean/luci-app-frps/luasrc/view/frps/frps_status.htm
Beginner 80bb1fbd20
luci-app-frps: add open page link (#8331)
Co-authored-by: zxlhhyccc <45259624+zxlhhyccc@users.noreply.github.com>
2021-11-28 00:41:07 +08:00

27 lines
962 B
HTML

<script type="text/javascript">//<![CDATA[
XHR.poll(3, '<%=url([[admin]], [[services]], [[frps]], [[status]])%>', null,
function(x, data) {
var tb = document.getElementById('frps_status');
if (data && tb) {
if (data.running) {
tb.innerHTML = '<em><b><font color=green> <%:Frps%>' + data.bin_version + '<%:RUNNING%></font></b></em><input class="btn cbi-button mar-10" type="button" value="<%:Open Frps page%>" onclick="openwebui();" />';
} else {
tb.innerHTML = '<em><b><font color=red> <%:Frps%>' + data.bin_version + '<%:NOT RUNNING%></font></b></em>';
}
}
}
);
function openwebui(){
var url = window.location.host+":<%=luci.sys.exec("uci -q get frps.main.dashboard_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="frps_status">
<em><%:Collecting data...%></em>
</p>
</fieldset>