mirror of
https://github.com/wangyu-/udp2raw.git
synced 2025-01-19 22:39:31 +08:00
40 lines
1.4 KiB
HTML
40 lines
1.4 KiB
HTML
<%
|
|
local function get_udp2raw_version(name)
|
|
local info = luci.util.split(luci.sys.exec("%s -h 2>/dev/null" %{name}), "\n")
|
|
local version = string.match(info[2], "git version:(%w+)")
|
|
local build = string.match(info[2], "build date:(.+)")
|
|
return info[1] == "udp2raw-tunnel" and version or "", info[1] == "udp2raw-tunnel" and build or ""
|
|
end
|
|
|
|
local udp2raw_version, udp2raw_build = get_udp2raw_version("udp2raw")
|
|
-%>
|
|
|
|
<fieldset class="cbi-section">
|
|
<legend><%:Running Status%></legend>
|
|
<table width="100%" cellspacing="10" id="_udp2raw_status_table">
|
|
<tr>
|
|
<td width="33%"><%:Binary Version%></td>
|
|
<td>
|
|
<% if udp2raw_version == "" then -%>
|
|
<em><%:Invalid Binary File.%></em>
|
|
<% else -%>
|
|
<%=pcdata(udp2raw_version)%>
|
|
<%- end %>
|
|
</td>
|
|
</tr>
|
|
<% if udp2raw_build ~= "" then -%>
|
|
<tr><td width="33%"><%:Build Time%></td><td><%=pcdata(udp2raw_build)%></td></tr>
|
|
<% end -%>
|
|
<tr><td width="33%"><%:Running Status%></td><td id="_udp2raw_status"><em><%:Collecting data...%></em></td></tr>
|
|
</table>
|
|
</fieldset>
|
|
|
|
<script type="text/javascript">//<![CDATA[
|
|
var udp2raw_status = document.getElementById('_udp2raw_status');
|
|
XHR.poll(5, '<%=luci.dispatcher.build_url("admin", "services", "udp2raw", "status")%>', null, function(x, status) {
|
|
if ( x && x.status == 200 ) {
|
|
udp2raw_status.innerHTML = status.running ? '<%:RUNNING%>' : '<%:NOT RUNNING%>';
|
|
}
|
|
});
|
|
//]]></script>
|