Add conf-file option.
Luci add custom.conf Bugfix for timer Update address matching.
This commit is contained in:
@@ -27,8 +27,8 @@ function act_status()
|
||||
e.local_port = smartdns.get_config_option("smartdns", "smartdns", "port", nil);
|
||||
if e.redirect == "1" then
|
||||
if e.local_port ~= nil and e.local_port ~= "53" then
|
||||
e.ipv4_works = luci.sys.call("iptables -t nat -nL PREROUTING | grep REDIRECT | grep dpt:53 | grep %q >/dev/null 2>&1" % e.local_port) == 0
|
||||
e.ipv6_works = luci.sys.call("ip6tables -t nat -nL PREROUTING | grep REDIRECT | grep dpt:53 | grep %q >/dev/null 2>&1" % e.local_port) == 0
|
||||
e.ipv4_works = luci.sys.call("iptables -t nat -nL PREROUTING 2>/dev/null | grep REDIRECT | grep dpt:53 | grep %q >/dev/null 2>&1" % e.local_port) == 0
|
||||
e.ipv6_works = luci.sys.call("ip6tables -t nat -nL PREROUTING 2>/dev/null| grep REDIRECT | grep dpt:53 | grep %q >/dev/null 2>&1" % e.local_port) == 0
|
||||
else
|
||||
e.redirect = 0
|
||||
end
|
||||
|
||||
@@ -13,6 +13,9 @@ msgstr "SmartDNS 服务器"
|
||||
msgid "SmartDNS is a local high-performance DNS server, supports finding fastest IP, supports ad filtering, and supports avoiding DNS poisoning."
|
||||
msgstr "SmartDNS是一个本地高性能DNS服务器,支持避免域名污染,支持返回最快IP,支持广告过滤。"
|
||||
|
||||
msgid "Custom Settings"
|
||||
msgstr "自定义设置"
|
||||
|
||||
msgid "Server Name"
|
||||
msgstr "服务器名称"
|
||||
|
||||
@@ -67,6 +70,9 @@ msgstr "域名TTL最大值"
|
||||
msgid "Maximum TTL for all domain result."
|
||||
msgstr "设置所有域名的TTL最大值"
|
||||
|
||||
msgid "smartdns custom settings"
|
||||
msgstr "smartdns 自定义设置,具体配置参数参考指导"
|
||||
|
||||
msgid "Upstream Servers"
|
||||
msgstr "上游服务器"
|
||||
|
||||
|
||||
@@ -15,25 +15,28 @@ m:section(SimpleSection).template = "smartdns/smartdns_status"
|
||||
s = m:section(TypedSection, "smartdns", translate("Settings"), translate("General Settings"))
|
||||
s.anonymous = true
|
||||
|
||||
s:tab("settings", translate("General Settings"))
|
||||
s:tab("custom", translate("Custom Settings"))
|
||||
|
||||
---- Eanble
|
||||
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server"))
|
||||
o = s:taboption("settings", Flag, "enabled", translate("Enable"), translate("Enable or disable smartdns server"))
|
||||
o.default = o.disabled
|
||||
o.rempty = false
|
||||
|
||||
---- server name
|
||||
o = s:option(Value, "server_name", translate("Server Name"), translate("Smartdns server name"))
|
||||
o = s:taboption("settings", Value, "server_name", translate("Server Name"), translate("Smartdns server name"))
|
||||
o.default = "smartdns"
|
||||
o.datatype = "hostname"
|
||||
o.rempty = false
|
||||
|
||||
---- Port
|
||||
o = s:option(Value, "port", translate("Local Port"), translate("Smartdns local server port"))
|
||||
o = s:taboption("settings", Value, "port", translate("Local Port"), translate("Smartdns local server port"))
|
||||
o.placeholder = 5353
|
||||
o.default = 5353
|
||||
o.datatype = "port"
|
||||
o.rempty = false
|
||||
|
||||
o = s:option(Flag, "redirect", translate("Redirect"), translate("Redirect standard dns query from 53 to smartdns, as default DNS server"))
|
||||
o = s:taboption("settings", Flag, "redirect", translate("Redirect"), translate("Redirect standard dns query from 53 to smartdns, as default DNS server"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
@@ -41,21 +44,40 @@ o.cfgvalue = function(...)
|
||||
end
|
||||
|
||||
---- cache-size
|
||||
o = s:option(Value, "cache_size", translate("Cache Size"), translate("DNS domain result cache size"))
|
||||
o = s:taboption("settings", Value, "cache_size", translate("Cache Size"), translate("DNS domain result cache size"))
|
||||
o.rempty = true
|
||||
|
||||
---- rr-ttl
|
||||
o = s:option(Value, "rr_ttl", translate("Domain TTL"), translate("TTL for all domain result."))
|
||||
o = s:taboption("settings", Value, "rr_ttl", translate("Domain TTL"), translate("TTL for all domain result."))
|
||||
o.rempty = true
|
||||
|
||||
---- rr-ttl-min
|
||||
o = s:option(Value, "rr_ttl_min", translate("Domain TTL Min"), translate("Minimum TTL for all domain result."))
|
||||
o = s:taboption("settings", Value, "rr_ttl_min", translate("Domain TTL Min"), translate("Minimum TTL for all domain result."))
|
||||
o.rempty = true
|
||||
|
||||
---- rr-ttl-max
|
||||
o = s:option(Value, "rr_ttl_max", translate("Domain TTL Max"), translate("Maximum TTL for all domain result."))
|
||||
o = s:taboption("settings", Value, "rr_ttl_max", translate("Domain TTL Max"), translate("Maximum TTL for all domain result."))
|
||||
o.rempty = true
|
||||
|
||||
|
||||
----- custom settings
|
||||
custom = s:taboption("custom", Value, "Custom Settings",
|
||||
translate(""),
|
||||
translate("smartdns custom settings"))
|
||||
|
||||
custom.template = "cbi/tvalue"
|
||||
custom.rows = 20
|
||||
|
||||
function custom.cfgvalue(self, section)
|
||||
return nixio.fs.readfile("/etc/smartdns/custom.conf")
|
||||
end
|
||||
|
||||
function custom.write(self, section, value)
|
||||
value = value:gsub("\r\n?", "\n")
|
||||
nixio.fs.writefile("/etc/smartdns/custom.conf", value)
|
||||
end
|
||||
|
||||
|
||||
-- Upstream servers
|
||||
s = m:section(TypedSection, "server", translate("Upstream Servers"), translate("Upstream Servers, support UDP, TCP protocol. " ..
|
||||
"Please configure multiple DNS servers, including multiple foreign DNS servers."))
|
||||
|
||||
Reference in New Issue
Block a user