%+header%> <% local http = require("luci.http") local core = require("substore.core") -- meta.error 是语言中立的 msgid(可能是组合消息),翻译在视图侧做 —— -- 后端模块不能 require("luci.i18n"),见 msg.lua 的文件头。 local msg = require("substore.msg") local function tmsg(s) return msg.translate(s, luci.i18n.translate) end 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 local_mode = (it and it.local_mode) or "text" local content = (it and it.raw_content) or "" -- 注入 JS 的初始内容:JSON 字符串字面量,把全部 "<" 转成 <, -- 同时挡住 "