luci-app-mosdns: disable domains input check
* Allow Domain Matching Rules
This commit is contained in:
parent
c4dfc569a1
commit
f00b055431
@ -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.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.remove = function(self, section, value) nixio.fs.writefile(white_list_file , "") end
|
||||||
o.validate = function(self, value)
|
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
|
return value
|
||||||
end
|
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.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.remove = function(self, section, value) nixio.fs.writefile(block_list_file, "") end
|
||||||
o.validate = function(self, value)
|
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
|
return value
|
||||||
end
|
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.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.remove = function(self, section, value) nixio.fs.writefile(hosts_list_file, "") end
|
||||||
o.validate = function(self, value)
|
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
|
return value
|
||||||
end
|
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.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.remove = function(self, section, value) nixio.fs.writefile(redirect_list_file, "") end
|
||||||
o.validate = function(self, value)
|
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
|
return value
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -119,16 +119,13 @@ msgid "White Lists"
|
|||||||
msgstr "白名单"
|
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."
|
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"
|
msgid "Block Lists"
|
||||||
msgstr "黑名单"
|
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."
|
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 解析(每个域名一行)"
|
msgstr "加入的域名将屏蔽 DNS 解析(每个域名一行,支持域名匹配规则)"
|
||||||
|
|
||||||
msgid "Not valid domain name, Please Re-enter."
|
|
||||||
msgstr "不是有效域名,请重新输入"
|
|
||||||
|
|
||||||
msgid "Hosts For example: baidu.com 10.0.0.1"
|
msgid "Hosts For example: baidu.com 10.0.0.1"
|
||||||
msgstr "自定义 Hosts 重写,如:baidu.com 10.0.0.1(每个规则一行)"
|
msgstr "自定义 Hosts 重写,如:baidu.com 10.0.0.1(每个规则一行)"
|
||||||
|
Loading…
Reference in New Issue
Block a user