Add luci for new feature, and fix some bugs
This commit is contained in:
@@ -9,10 +9,12 @@ function index()
|
||||
end
|
||||
|
||||
local page
|
||||
page = entry({"admin", "services", "smartdns"}, cbi("smartdns"), _("SmartDNS"), 60)
|
||||
page = entry({"admin", "services", "smartdns"}, cbi("smartdns/smartdns"), _("SmartDNS"), 60)
|
||||
page.dependent = true
|
||||
page = entry({"admin", "services", "smartdns", "status"}, call("act_status"))
|
||||
page.leaf = true
|
||||
page = entry({"admin", "services", "smartdns", "upstream"}, cbi("smartdns/upstream"), nil)
|
||||
page.leaf = true
|
||||
end
|
||||
|
||||
local function is_running()
|
||||
|
||||
@@ -55,6 +55,12 @@ msgstr "IPV6服务器"
|
||||
msgid "Enable IPV6 DNS Server"
|
||||
msgstr "启用IPV6服务器"
|
||||
|
||||
msgid "Dual-stack IP Selection"
|
||||
msgstr "双栈IP优选"
|
||||
|
||||
msgid "Enable IP selection between IPV4 and IPV6"
|
||||
msgstr "启用或禁用IPV4,IPV6间的IP优选策略。"
|
||||
|
||||
msgid "Redirect"
|
||||
msgstr "重定向"
|
||||
|
||||
@@ -127,6 +133,9 @@ msgstr "IP黑名单过滤"
|
||||
msgid "Filtering IP with blacklist"
|
||||
msgstr "使用IP黑名单过滤"
|
||||
|
||||
msgid "Upstream DNS Server Configuration"
|
||||
msgstr "上游DNS服务器配置"
|
||||
|
||||
msgid "Set Specific domain ip address."
|
||||
msgstr "指定特定域名的IP地址"
|
||||
|
||||
|
||||
@@ -52,6 +52,14 @@ o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
---- Support DualStack ip selection
|
||||
o = s:taboption("settings", Flag, "dualstack_ip_selection", translate("Dual-stack IP Selection"), translate("Enable IP selection between IPV4 and IPV6"))
|
||||
o.rmempty = false
|
||||
o.default = o.disabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "0"
|
||||
end
|
||||
|
||||
---- Redirect
|
||||
o = s:taboption("settings", ListValue, "redirect", translate("Redirect"), translate("SmartDNS redirect mode"))
|
||||
o.placeholder = "none"
|
||||
@@ -102,6 +110,15 @@ s = m:section(TypedSection, "server", translate("Upstream Servers"), translate("
|
||||
s.anonymous = true
|
||||
s.addremove = true
|
||||
s.template = "cbi/tblsection"
|
||||
s.extedit = luci.dispatcher.build_url("admin/services/smartdns/upstream/%s")
|
||||
|
||||
---- enable flag
|
||||
o = s:option(Flag, "enabled", translate("Enable"), translate("Enable"))
|
||||
o.rmempty = false
|
||||
o.default = o.enabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "1"
|
||||
end
|
||||
|
||||
---- name
|
||||
s:option(Value, "name", translate("Name"), translate("DNS Server name"))
|
||||
@@ -124,14 +141,6 @@ o:value("tls", translate("tls"))
|
||||
o.default = "udp"
|
||||
o.rempty = false
|
||||
|
||||
---- blacklist_ip
|
||||
o = s:option(Flag, "blacklist_ip", translate("IP Blacklist Filtering"), translate("Filtering IP with blacklist"))
|
||||
o.rmempty = false
|
||||
o.default = o.disabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "0"
|
||||
end
|
||||
|
||||
-- Doman addresss
|
||||
s = m:section(TypedSection, "smartdns", translate("Domain Address"),
|
||||
translate("Set Specific domain ip address."))
|
||||
24
package/luci/files/luci/model/cbi/smartdns/upstream.lua
Normal file
24
package/luci/files/luci/model/cbi/smartdns/upstream.lua
Normal file
@@ -0,0 +1,24 @@
|
||||
local sid = arg[1]
|
||||
|
||||
m = Map("smartdns", "%s - %s" %{translate("SmartDNS Server"), translate("Upstream DNS Server Configuration")})
|
||||
m.redirect = luci.dispatcher.build_url("admin/services/smartdns")
|
||||
|
||||
if m.uci:get("smartdns", sid) ~= "server" then
|
||||
luci.http.redirect(m.redirect)
|
||||
return
|
||||
end
|
||||
|
||||
-- [[ Edit Server ]]--
|
||||
s = m:section(NamedSection, sid, "server")
|
||||
s.anonymous = true
|
||||
s.addremove = false
|
||||
|
||||
---- blacklist_ip
|
||||
o = s:option(Flag, "blacklist_ip", translate("IP Blacklist Filtering"), translate("Filtering IP with blacklist"))
|
||||
o.rmempty = false
|
||||
o.default = o.disabled
|
||||
o.cfgvalue = function(...)
|
||||
return Flag.cfgvalue(...) or "0"
|
||||
end
|
||||
|
||||
return m
|
||||
Reference in New Issue
Block a user