mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-07 20:54:14 +08:00
41 lines
1.1 KiB
HTML
41 lines
1.1 KiB
HTML
<%+cbi/valueheader%>
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
|
|
function act_flush_dns_cache(btn)
|
|
{
|
|
var statusEl = document.getElementById('oc_flush_dns_status');
|
|
btn.disabled = true;
|
|
btn.value = '<%:Flushing...%> ';
|
|
if (statusEl) { statusEl.textContent = ''; statusEl.className = 'oc-flush-status'; }
|
|
XHR.get('<%=luci.dispatcher.build_url("admin", "services", "openclash","flush_dns_cache")%>',
|
|
null,
|
|
function(x,status)
|
|
{
|
|
var msg, ok;
|
|
btn.disabled = false;
|
|
btn.value = '<%:Flush%>';
|
|
if ( x && x.status == 200 ) {
|
|
ok = (status.fakeip_flush === "" && status.dns_flush === "");
|
|
msg = ok ? '<%:Flush Successful%>' : '<%:Flush Failed%>';
|
|
}
|
|
else {
|
|
ok = false;
|
|
msg = '<%:Flush Timeout%>';
|
|
}
|
|
if (statusEl) {
|
|
statusEl.textContent = msg;
|
|
statusEl.className = 'oc-flush-status' + (ok ? '' : ' err');
|
|
}
|
|
}
|
|
);
|
|
return false;
|
|
};
|
|
|
|
//]]></script>
|
|
|
|
|
|
<input type="button" class="btn cbi-button cbi-input-reload" value="<%:Flush%>" onclick="return act_flush_dns_cache(this)" />
|
|
<span id="oc_flush_dns_status" class="oc-flush-status"></span>
|
|
<%+cbi/valuefooter%>
|