🦄 Sync 2026-08-26 20:42:53

This commit is contained in:
github-actions[bot] committed 2026-08-26 20:42:53 +08:00
1 parent 53bb25bf38
commit e7a277e681
487 files changed
+55081 -19590

No files matched your search

@@ -15,7 +15,8 @@ end
function act_status()
local e = {}
e.running = luci.sys.call("iptables -t filter -S MIAPLUS >/dev/null 2>&1") == 0
-- 交给 init 脚本的 status 方法判断:它会按 fw3(iptables)/fw4(nft) 自动分发
e.running = luci.sys.call("/etc/init.d/miaplus status >/dev/null 2>&1") == 0
luci.http.prepare_content("application/json")
luci.http.write_json(e)
end
@@ -16,13 +16,42 @@ e = t:option(Flag, "enable", translate("Enabled"))
e.rmempty = false
e.default = "1"
-- HH:MM / H:MM -> 分钟;非法或空返回 nil
local function time_to_min(s)
local h, m = s:match("^(%d?%d):(%d%d)$")
if not h then return nil end
h, m = tonumber(h), tonumber(m)
if h > 23 or m > 59 then return nil end
return h * 60 + m
end
e = t:option(Value, "timeon", translate("Start time"))
e.optional = false
e.default = "00:00"
function e.validate(self, value, section)
local mins = time_to_min(value)
if not mins then
return nil, translate("Invalid time, expected HH:MM")
end
return string.format("%02d:%02d", math.floor(mins / 60), mins % 60)
end
e = t:option(Value, "timeoff", translate("End time"))
e.optional=false
e.default = "23:59"
function e.validate(self, value, section)
local mins = time_to_min(value)
if not mins then
return nil, translate("Invalid time, expected HH:MM")
end
-- 跨字段:起止时间不能相同(起止相同即无管控,易误配)
local on = self.map:formvalue("cbid.miaplus." .. section .. ".timeon")
local on_min = on and time_to_min(on)
if on_min ~= nil and on_min == mins then
return nil, translate("Start and end time must differ")
end
return string.format("%02d:%02d", math.floor(mins / 60), mins % 60)
end
e = t:option(Flag, "z1", translate("Mon"))
e.rmempty = true