mirror of
https://github.com/caiwx86/small-packages.git
synced 2026-07-31 11:52:03 +08:00
31 lines
938 B
HTML
31 lines
938 B
HTML
<%
|
|
local api = require "luci.passwall.api"
|
|
local haproxy_enable = api.uci_get_type("global_haproxy", "balancing_enable", "0")
|
|
local console_port = api.uci_get_type("global_haproxy", "console_port", "")
|
|
-%>
|
|
<p id="_status"></p>
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
const haproxy_enable = "<%=haproxy_enable%>";
|
|
if (haproxy_enable == "1") {
|
|
function openwebui(){
|
|
var url = window.location.hostname + ":<%=console_port%>";
|
|
window.open('http://' + url, 'target', '');
|
|
}
|
|
XHR.poll(5, '<%=api.url("haproxy_status")%>', null,
|
|
function(x, result) {
|
|
if (x && x.status == 200) {
|
|
var _status = document.getElementById('_status');
|
|
if (_status) {
|
|
if (result.status) {
|
|
_status.innerHTML = '<input type="button" class="btn cbi-button cbi-button-apply" value="<%:Enter interface%>" onclick="openwebui()" />';
|
|
} else {
|
|
_status.innerHTML = '';
|
|
}
|
|
}
|
|
}
|
|
}
|
|
);
|
|
}
|
|
//]]></script>
|