<%+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 %>

<%=is_edit and luci.i18n.translate("Edit combination") or luci.i18n.translate("Add combination")%>

<% if is_edit then %><% end %>
"/>
<% for _, x in ipairs(srcs) do %>
/>
<% end %> <% if #srcs == 0 then %> <%:No subscriptions yet.%> <% end %>
onchange="var r=document.getElementById('rules_row');if(r)r.style.display=this.checked?'block':'none';"/> <%:When enabled, apply keyword include/exclude and dedup rules to the merged nodes%>
">
/>
<% for _, p in ipairs(core.RULE_PROTOS) do %> /> <% end %>
<%:Separate multiple keywords with commas (e.g. HK,US,JP); include = keep if any matches, exclude = drop if any matches.%>
<%:Protocol filter: with none ticked no filtering is applied.%>
<%:Rename: one rule per line (# starts a comment); rules apply top to bottom and are chained. The three forms differ in scope:%>
<%:OLD=NEW — exact match: renames only nodes named exactly OLD.%>
<%:PATTERN -> REPLACEMENT — regex: replaces matches in the name of every node (Lua patterns, not PCRE; $1 for captures).%>
<%:{server}_{port}_{proto} — placeholder template: renames every node unconditionally.%>
<%:Placeholders: {server} {port} {proto} {name} {uuid} {password} {group}.%>
<% if is_edit then %>
<%:Nodes:%> <%=it.node_count or 0%> | <%:Last updated:%> <%=it.last_update and os.date("%Y-%m-%d %H:%M", it.last_update) or "-"%>
<% end %>
<%+footer%>