更新后,点击按钮依然无响应
自己模仿了一下别人的,以便适应新的luci (文件显示不全啊)
htm文件
<%
local dsp = require "luci.dispatcher"
-%>
<%:Running Status%>
<%:Status%>
<%:Collecting data...%>
<script type="text/javascript">//', null,
function(x, json) {
if (x && x.status == 200) {
if (_status)
_status.innerHTML = json.status ? '<%:RUNNING%> ?
' : '<%:NOT RUNNING%> X';
}
});
function openwebui(){
var url = window.location.host+":<%=luci.sys.exec("uci get baidupcs-web.config.port"):gsub("^%s*(.-)%s*$", "%1")%>";
window.open('http://'+url,'target','');
}
//]]></script>
module("luci.controller.baidupcs-web", package.seeall)
function index()
if not nixio.fs.access("/etc/config/baidupcs-web") then
return
end
entry({"admin", "nas", "baidupcs-web"}, cbi("baidupcs-web"), _("BaiduPCS Web"), 300).dependent = true
entry({"admin","nas","baidupcs-web","status"},call("act_status")).leaf=true
entry({"admin", "nas", "baidupcs-web", "check"}, call("action_check")).leaf = true
end
function act_status()
local e={}
e.status=luci.sys.call("pgrep baidupcs-web >/dev/null")==0
-- e.port=luci.sys.exec("uci get baidupcs-web.config.port")
luci.http.write_json(e)
end
function action_check()
local json = api.to_check()
http_write_json(json)
end