From 495fe886a3b79da448eef05ccfe8a702e711b283 Mon Sep 17 00:00:00 2001 From: Beginner <70857188+Beginner-Go@users.noreply.github.com> Date: Tue, 16 Nov 2021 20:33:55 +0800 Subject: [PATCH] luci-app-accesscontrol: tidy up code (#8241) --- .../luasrc/controller/mia.lua | 6 +- .../luasrc/model/cbi/mia.lua | 88 ++++++++++--------- .../luci-app-accesscontrol/po/zh-cn/mia.po | 2 - 3 files changed, 48 insertions(+), 48 deletions(-) diff --git a/package/lean/luci-app-accesscontrol/luasrc/controller/mia.lua b/package/lean/luci-app-accesscontrol/luasrc/controller/mia.lua index 2dd6e51e4..e3e541623 100644 --- a/package/lean/luci-app-accesscontrol/luasrc/controller/mia.lua +++ b/package/lean/luci-app-accesscontrol/luasrc/controller/mia.lua @@ -5,13 +5,13 @@ function index() return end - entry({"admin", "services", "mia"}, cbi("mia"), _("Internet Access Schedule Control"),30).dependent = true + entry({"admin", "services", "mia"}, cbi("mia"), _("Internet Access Schedule Control"), 30).dependent = true entry({"admin", "services", "mia", "status"}, call("act_status")).leaf = true end function act_status() - local e={} - e.running=luci.sys.call("iptables -L INPUT |grep MIA >/dev/null")==0 + local e = {} + e.running = luci.sys.call("iptables -L INPUT |grep MIA >/dev/null") == 0 luci.http.prepare_content("application/json") luci.http.write_json(e) end diff --git a/package/lean/luci-app-accesscontrol/luasrc/model/cbi/mia.lua b/package/lean/luci-app-accesscontrol/luasrc/model/cbi/mia.lua index cf850ec0f..1f55ee944 100644 --- a/package/lean/luci-app-accesscontrol/luasrc/model/cbi/mia.lua +++ b/package/lean/luci-app-accesscontrol/luasrc/model/cbi/mia.lua @@ -1,66 +1,68 @@ +a = Map("mia") +a.title = translate("Internet Access Schedule Control") +a.description = translate("Access Schedule Control Settins") -a=Map("mia",translate("Internet Access Schedule Control"),translate("Access Schedule Control Settins")) -a:section(SimpleSection).template = "mia/mia_status" +a:section(SimpleSection).template = "mia/mia_status" -t=a:section(TypedSection,"basic") -t.anonymous=true +t = a:section(TypedSection, "basic") +t.anonymous = true -e=t:option(Flag,"enable",translate("Enabled")) -e.rmempty=false +e = t:option(Flag, "enable", translate("Enabled")) +e.rmempty = false -e=t:option(Flag,"strict",translate("Strict Mode")) -e.rmempty=false +e = t:option(Flag, "strict", translate("Strict Mode")) e.description = translate("Strict Mode will degrade CPU performance, but it can achieve better results") +e.rmempty = false -t=a:section(TypedSection,"macbind",translate("Client Rules")) -t.template="cbi/tblsection" -t.anonymous=true -t.addremove=true +t = a:section(TypedSection, "macbind", translate("Client Rules")) +t.template = "cbi/tblsection" +t.anonymous = true +t.addremove = true -e=t:option(Flag,"enable",translate("√")) -e.rmempty=false -e.default="1" +e = t:option(Flag, "enable", translate("Enabled")) +e.rmempty = false +e.default = "1" -e=t:option(Value,"macaddr",translate("MAC address (Computer Name)")) -e.rmempty=true +e = t:option(Value, "macaddr", translate("MAC address (Computer Name)")) +e.rmempty = true luci.sys.net.mac_hints(function(t,a) e:value(t,"%s (%s)"%{t,a}) end) -e=t:option(Value,"timeon",translate("Start time")) -e.default="00:00" +e = t:option(Value, "timeon", translate("Start time")) +e.optional = false +e.default = "00:00" + +e = t:option(Value, "timeoff", translate("End time")) e.optional=false +e.default = "23:59" -e=t:option(Value,"timeoff",translate("End time")) -e.default="23:59" -e.optional=false +e = t:option(Flag, "z1", translate("Mon")) +e.rmempty = true +e.default = 1 -e=t:option(Flag,"z1",translate("Mon")) -e.rmempty=true +e = t:option(Flag, "z2", translate("Tue")) +e.rmempty = true e.default=1 -e=t:option(Flag,"z2",translate("Tue")) -e.rmempty=true -e.default=1 +e = t:option(Flag, "z3", translate("Wed")) +e.rmempty = true +e.default = 1 -e=t:option(Flag,"z3",translate("Wed")) -e.rmempty=true -e.default=1 +e = t:option(Flag, "z4", translate("Thu")) +e.rmempty = true +e.default = 1 -e=t:option(Flag,"z4",translate("Thu")) -e.rmempty=true -e.default=1 +e = t:option(Flag, "z5", translate("Fri")) +e.rmempty = true +e.default = 1 -e=t:option(Flag,"z5",translate("Fri")) -e.rmempty=true -e.default=1 +e = t:option(Flag, "z6", translate("Sat")) +e.rmempty = true +e.default = 1 -e=t:option(Flag,"z6",translate("Sat")) -e.rmempty=true -e.default=1 - -e=t:option(Flag,"z7",translate("Sun")) -e.rmempty=true -e.default=1 +e = t:option(Flag, "z7", translate("Sun")) +e.rmempty = true +e.default = 1 return a diff --git a/package/lean/luci-app-accesscontrol/po/zh-cn/mia.po b/package/lean/luci-app-accesscontrol/po/zh-cn/mia.po index cc976522b..8f7c16aae 100644 --- a/package/lean/luci-app-accesscontrol/po/zh-cn/mia.po +++ b/package/lean/luci-app-accesscontrol/po/zh-cn/mia.po @@ -48,5 +48,3 @@ msgstr "六" msgid "Sun" msgstr "日" - -