%+header%> <% local http = require("luci.http") local core = require("substore.core") local id = http.formvalue("id") or "" local it = id ~= "" and core.get(id) or nil local is_edit = it ~= nil local rules_enabled = it and (it.rules_enable == true or it.rules_enable == "1") or false local ki = (it and it.keyword_include) or "" local ke = (it and it.keyword_exclude) or "" local dedup = it and (it.dedup == "1" or it.dedup == true) -- 协议筛选 / 重命名:控制器一直在读这两项(read_rules_fields),但此前三个表单 -- 都没有提交它们的控件 —— 字段永远写空,且每次保存会把 UCI 里已有的值重置为 ""。 local proto_sel = {} for p in ((it and it.proto_filter) or ""):gmatch("[^,]+") do proto_sel[p:match("^%s*(.-)%s*$")] = true end local rm = (it and it.rename_map) or "" local sel = {} if it and type(it.sources) == "table" then for _, s in ipairs(it.sources) do sel[s] = true end end local srcs = {} for _, x in ipairs(core.list()) do if not x.combo then srcs[#srcs + 1] = x end end %>