mirror of
https://github.com/coolsnowwolf/lede.git
synced 2025-04-16 04:13:31 +00:00
luci-app-xlnetacc: tidy up code (#8196)
This commit is contained in:
parent
fed785d92f
commit
e2307cd837
@ -5,30 +5,30 @@ function index()
|
||||
return
|
||||
end
|
||||
|
||||
entry({"admin", "services", "xlnetacc"}, firstchild(), _("XLNetAcc")).dependent = false
|
||||
entry({"admin", "services", "xlnetacc", "general"}, cbi("xlnetacc"), _("Settings"), 1)
|
||||
entry({"admin", "services", "xlnetacc", "log"}, template("xlnetacc/logview"), _("Log"), 2)
|
||||
entry({"admin", "services", "xlnetacc", "status"}, call("action_status"))
|
||||
entry({"admin", "services", "xlnetacc", "logdata"}, call("action_log"))
|
||||
entry({"admin", "services", "xlnetacc"}, alias("admin", "services", "xlnetacc", "general"), _("XLNetAcc"), 90).dependent = true
|
||||
entry({"admin", "services", "xlnetacc", "general"}, cbi("xlnetacc"), _("Settings"), 1).leaf = true
|
||||
entry({"admin", "services", "xlnetacc", "log"}, template("xlnetacc/logview"), _("Log"), 2).leaf = true
|
||||
entry({"admin", "services", "xlnetacc", "status"}, call("action_status")).leaf = true
|
||||
entry({"admin", "services", "xlnetacc", "logdata"}, call("action_log")).leaf = true
|
||||
end
|
||||
|
||||
function action_status()
|
||||
luci.http.prepare_content("application/json")
|
||||
luci.http.write_json({
|
||||
run_state=luci.sys.call("ps -w | grep xlnetacc.sh | grep -v grep >/dev/null")==0,
|
||||
down_state=nixio.fs.readfile("/var/state/xlnetacc_down_state") or "",
|
||||
up_state=nixio.fs.readfile("/var/state/xlnetacc_up_state") or ""
|
||||
run_state = luci.sys.call("ps -w | grep xlnetacc.sh | grep -v grep >/dev/null")==0,
|
||||
down_state = nixio.fs.readfile("/var/state/xlnetacc_down_state") or "",
|
||||
up_state = nixio.fs.readfile("/var/state/xlnetacc_up_state") or ""
|
||||
})
|
||||
end
|
||||
|
||||
function action_log()
|
||||
local uci=require "luci.model.uci".cursor()
|
||||
local util=require "luci.util"
|
||||
local log_data={}
|
||||
local uci = require "luci.model.uci".cursor()
|
||||
local util = require "luci.util"
|
||||
local log_data = {}
|
||||
|
||||
log_data.syslog=util.trim(util.exec("logread | grep xlnetacc"))
|
||||
log_data.syslog = util.trim(util.exec("logread | grep xlnetacc"))
|
||||
if uci:get("xlnetacc","general","logging")~="0" then
|
||||
log_data.client=nixio.fs.readfile("/var/log/xlnetacc.log") or ""
|
||||
log_data.client = nixio.fs.readfile("/var/log/xlnetacc.log") or ""
|
||||
end
|
||||
uci:unload("xlnetacc")
|
||||
luci.http.prepare_content("application/json")
|
||||
|
@ -1,51 +1,57 @@
|
||||
local m,s,o
|
||||
local uci=luci.model.uci.cursor()
|
||||
local uci = luci.model.uci.cursor()
|
||||
|
||||
m=Map("xlnetacc","%s - %s"%{translate("XLNetAcc"),translate("Settings")},translate("XLNetAcc is a Thunder joint broadband operators launched a commitment to help users solve the low broadband, slow Internet access, poor Internet experience of professional-grade broadband upgrade software."))
|
||||
m:append(Template("xlnetacc/xlnetacc_status"))
|
||||
m = Map("xlnetacc")
|
||||
m.title = translate("XLNetAcc - Settings")
|
||||
m.description = translate("XLNetAcc is a Thunder joint broadband operators launched a commitment to help users solve the low broadband, slow Internet access, poor Internet experience of professional-grade broadband upgrade software.")
|
||||
|
||||
s=m:section(NamedSection,"general","general",translate("General Settings"))
|
||||
s.anonymous=true
|
||||
s.addremove=false
|
||||
m:section(SimpleSection).template = "xlnetacc/xlnetacc_status"
|
||||
|
||||
o=s:option(Flag,"enabled",translate("Enabled"))
|
||||
o.rmempty=false
|
||||
s = m:section(NamedSection, "general", "general")
|
||||
s.title = translate("General Settings")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
o=s:option(Flag,"down_acc",translate("Enable DownLink Upgrade"))
|
||||
o = s:option(Flag, "enabled", translate("Enabled"))
|
||||
o.rmempty = false
|
||||
|
||||
o=s:option(Flag,"up_acc",translate("Enable UpLink Upgrade"))
|
||||
o = s:option(Flag, "down_acc", translate("Enable DownLink Upgrade"))
|
||||
|
||||
o=s:option(Flag,"logging",translate("Enable Logging"))
|
||||
o.default=1
|
||||
o = s:option(Flag, "up_acc", translate("Enable UpLink Upgrade"))
|
||||
|
||||
o=s:option(Flag,"verbose",translate("Enable verbose logging"))
|
||||
o = s:option(Flag, "logging", translate("Enable Logging"))
|
||||
o.default = 1
|
||||
|
||||
o = s:option(Flag, "verbose", translate("Enable verbose logging"))
|
||||
o:depends("logging",1)
|
||||
|
||||
o=s:option(ListValue,"network",translate("Upgrade interface"))
|
||||
o = s:option(ListValue, "network", translate("Upgrade interface"))
|
||||
uci:foreach("network","interface",function(section)
|
||||
if section[".name"]~="loopback" then
|
||||
o:value(section[".name"])
|
||||
end
|
||||
end)
|
||||
|
||||
o=s:option(Value,"keepalive",translate("Keepalive interval"),"5-60 "..translate("minutes"))
|
||||
o = s:option(Value, "keepalive", translate("Keepalive interval"))
|
||||
o.description = translate("5 ~ 60 minutes")
|
||||
for _,v in ipairs({5,10,20,30,60}) do
|
||||
o:value(v,v.." "..translate("minutes"))
|
||||
end
|
||||
o.datatype="range(5,60)"
|
||||
o.default=10
|
||||
o.datatype = "range(5,60)"
|
||||
o.default = 10
|
||||
|
||||
o=s:option(Value,"relogin",translate("Account relogin"),"1-48 "..translate("hours"))
|
||||
o:value(0,translate("Not enabled"))
|
||||
o = s:option(Value, "relogin", translate("Account relogin"))
|
||||
o.description = translate("1 ~ 48 hours")
|
||||
o:value(0, translate("Not enabled"))
|
||||
for _,v in ipairs({3,12,18,24,30}) do
|
||||
o:value(v,v.." "..translate("hours"))
|
||||
end
|
||||
o.datatype="max(48)"
|
||||
o.default=0
|
||||
o.datatype = "max(48)"
|
||||
o.default = 0
|
||||
|
||||
o=s:option(Value,"account",translate("XLNetAcc account"))
|
||||
o = s:option(Value, "account", translate("XLNetAcc account"))
|
||||
|
||||
o=s:option(Value,"password",translate("XLNetAcc password"))
|
||||
o.password=true
|
||||
o = s:option(Value, "password", translate("XLNetAcc password"))
|
||||
o.password = true
|
||||
|
||||
return m
|
||||
|
@ -19,7 +19,7 @@
|
||||
<%+header%>
|
||||
|
||||
<div class="cbi-map">
|
||||
<h2 name="content"><%:XLNetAcc%> - <%:Log Data%></h2>
|
||||
<h2 name="content"><%:XLNetAcc - Log%></h2>
|
||||
<fieldset class="cbi-section">
|
||||
<fieldset class="cbi-section-node">
|
||||
<div id="log_text"><img src="<%=resource%>/icons/loading.gif" alt="<%:Loading...%>" style="vertical-align:middle"/><%:Collecting data...%></div>
|
||||
@ -28,7 +28,7 @@
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js"></script>
|
||||
<script type="text/javascript" src="<%=resource%>/cbi.js?v=1.0.5"></script>
|
||||
<script type="text/javascript">//<![CDATA[
|
||||
var log_id=document.getElementById('log_text');
|
||||
XHR.poll(5,'<%=luci.dispatcher.build_url("admin","services","xlnetacc","logdata")%>',null,function(x,data){
|
||||
|
@ -1,6 +1,12 @@
|
||||
msgid "XLNetAcc"
|
||||
msgstr "迅雷快鸟"
|
||||
|
||||
msgid "XLNetAcc - Settings"
|
||||
msgstr "迅雷快鸟 - 设置"
|
||||
|
||||
msgid "XLNetAcc - Log"
|
||||
msgstr "迅雷快鸟 - 日志"
|
||||
|
||||
msgid "XLNetAcc is a Thunder joint broadband operators launched a commitment to help users solve the low broadband, slow Internet access, poor Internet experience of professional-grade broadband upgrade software."
|
||||
msgstr "迅雷快鸟是迅雷联合宽带运营商推出的一款致力于帮助用户解决宽带低、网速慢、上网体验差的专业级宽带加速软件。"
|
||||
|
||||
@ -61,9 +67,15 @@ msgstr "帐号重新登录"
|
||||
msgid "Not enabled"
|
||||
msgstr "未启用"
|
||||
|
||||
msgid "5 ~ 60 minutes"
|
||||
msgstr "5 ~ 60 分钟"
|
||||
|
||||
msgid "minutes"
|
||||
msgstr "分钟"
|
||||
|
||||
msgid "1 ~ 48 hours"
|
||||
msgstr "1 ~ 48 小时"
|
||||
|
||||
msgid "hours"
|
||||
msgstr "小时"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user