From f00b055431ae274cae9f392ad4ff6c33c1bcdf8b Mon Sep 17 00:00:00 2001 From: sbwml Date: Fri, 13 May 2022 04:14:52 +0800 Subject: [PATCH] luci-app-mosdns: disable domains input check * Allow Domain Matching Rules --- .../luasrc/model/cbi/mosdns/rule_list.lua | 34 ------------------- luci-app-mosdns/po/zh-cn/mosdns.po | 7 ++-- 2 files changed, 2 insertions(+), 39 deletions(-) diff --git a/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua b/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua index b86e785..853c1c8 100644 --- a/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua +++ b/luci-app-mosdns/luasrc/model/cbi/mosdns/rule_list.lua @@ -22,16 +22,6 @@ o.cfgvalue = function(self, section) return nixio.fs.readfile(white_list_file) o o.write = function(self, section, value) nixio.fs.writefile(white_list_file , value:gsub("\r\n", "\n")) end o.remove = function(self, section, value) nixio.fs.writefile(white_list_file , "") end o.validate = function(self, value) - local hosts= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(hosts, w) end) - for index, host in ipairs(hosts) do - if host:find("#") and host:find("#") == 1 then - return value - end - if not datatypes.hostname(host) then - return nil, host .. " " .. translate("Not valid domain name, Please Re-enter.") - end - end return value end @@ -42,16 +32,6 @@ o.cfgvalue = function(self, section) return nixio.fs.readfile(block_list_file) o o.write = function(self, section, value) nixio.fs.writefile(block_list_file, value:gsub("\r\n", "\n")) end o.remove = function(self, section, value) nixio.fs.writefile(block_list_file, "") end o.validate = function(self, value) - local hosts= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(hosts, w) end) - for index, host in ipairs(hosts) do - if host:find("#") and host:find("#") == 1 then - return value - end - if not datatypes.hostname(host) then - return nil, host .. " " .. translate("Not valid domain name, Please Re-enter.") - end - end return value end @@ -62,13 +42,6 @@ o.cfgvalue = function(self, section) return nixio.fs.readfile(hosts_list_file) o o.write = function(self, section, value) nixio.fs.writefile(hosts_list_file, value:gsub("\r\n", "\n")) end o.remove = function(self, section, value) nixio.fs.writefile(hosts_list_file, "") end o.validate = function(self, value) - local hosts= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(hosts, w) end) - for index, host in ipairs(hosts) do - if host:find("#") and host:find("#") == 1 then - return value - end - end return value end @@ -79,13 +52,6 @@ o.cfgvalue = function(self, section) return nixio.fs.readfile(redirect_list_file o.write = function(self, section, value) nixio.fs.writefile(redirect_list_file, value:gsub("\r\n", "\n")) end o.remove = function(self, section, value) nixio.fs.writefile(redirect_list_file, "") end o.validate = function(self, value) - local hosts= {} - string.gsub(value, '[^' .. "\r\n" .. ']+', function(w) table.insert(hosts, w) end) - for index, host in ipairs(hosts) do - if host:find("#") and host:find("#") == 1 then - return value - end - end return value end diff --git a/luci-app-mosdns/po/zh-cn/mosdns.po b/luci-app-mosdns/po/zh-cn/mosdns.po index 873263f..efa4b51 100644 --- a/luci-app-mosdns/po/zh-cn/mosdns.po +++ b/luci-app-mosdns/po/zh-cn/mosdns.po @@ -119,16 +119,13 @@ msgid "White Lists" msgstr "白名单" msgid "These domain names allow DNS resolution with the highest priority. Please input the domain names of websites, every line can input only one website domain. For example: hm.baidu.com." -msgstr "加入的域名始终允许 DNS 解析,且优先级最高(每个域名一行)" +msgstr "加入的域名始终允许 DNS 解析,且优先级最高(每个域名一行,支持域名匹配规则)" msgid "Block Lists" msgstr "黑名单" msgid "These domains are blocked from DNS resolution. Please input the domain names of websites, every line can input only one website domain. For example: baidu.com." -msgstr "加入的域名将屏蔽 DNS 解析(每个域名一行)" - -msgid "Not valid domain name, Please Re-enter." -msgstr "不是有效域名,请重新输入" +msgstr "加入的域名将屏蔽 DNS 解析(每个域名一行,支持域名匹配规则)" msgid "Hosts For example: baidu.com 10.0.0.1" msgstr "自定义 Hosts 重写,如:baidu.com 10.0.0.1(每个规则一行)"