Merge pull request #4797 from stangri/master-luci-app-https-dns-proxy

luci-app-https-dns-proxy: support for Force DNS option
This commit is contained in:
Stan Grishin 2021-02-18 14:07:41 -08:00 committed by GitHub
commit fa20ad41c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 68 additions and 50 deletions

View file

@ -69,18 +69,10 @@ local ubusStatus = util.ubus("service", "list", { name = packageName })
local packageVersion = getPackageVersion() local packageVersion = getPackageVersion()
if packageVersion == "" then if packageVersion == "" then
packageStatusCode = -1 packageStatusCode, packageStatus = -1, translatef("%s is not installed or not found", packageName)
packageStatus = translatef("%s is not installed or not found", packageName)
else else
if not ubusStatus or not ubusStatus[packageName] then
packageStatusCode = 0
packageStatus = translate("Stopped")
if not sys.init.enabled(packageName) then
packageStatus = packageStatus .. " (" .. translate("disabled") .. ")"
end
else
packageStatusCode, packageStatus = 1, "" packageStatusCode, packageStatus = 1, ""
for n = 1,1000 do for n = 1,20 do
if ubusStatus and ubusStatus[packageName] and if ubusStatus and ubusStatus[packageName] and
ubusStatus[packageName]["instances"] and ubusStatus[packageName]["instances"] and
ubusStatus[packageName]["instances"]["instance" .. n] and ubusStatus[packageName]["instances"]["instance" .. n] and
@ -101,6 +93,12 @@ else
break break
end end
end end
if packageStatus == "" then
packageStatusCode = 0
packageStatus = translate("Stopped")
if not sys.init.enabled(packageName) then
packageStatus = packageStatus .. " (" .. translate("disabled") .. ")"
end
end end
end end
@ -123,8 +121,8 @@ else
buttons.template = packageName .. "/buttons" buttons.template = packageName .. "/buttons"
end end
c = m:section(NamedSection, "config", "https-dns-proxy", translate("Configuration"), translatef("If update DNSMASQ config is selected, when you add/remove any instances below, they will be used to override the 'DNS forwardings' section of %sDHCP and DNS%s (%smore information%s).", "<a href=\"" .. dispatcher.build_url("admin/network/dhcp") .. "\">", "</a>", "<a href=\"" .. readmeURL .. "#default-settings" .. "\" target=\"_blank\">", "</a>")) c = m:section(NamedSection, "config", "https-dns-proxy", translate("Configuration"))
d1 = c:option(ListValue, "update_dnsmasq_config", translate("Update DNSMASQ Config on Start/Stop")) d1 = c:option(ListValue, "update_dnsmasq_config", translate("Update DNSMASQ Config on Start/Stop"), translatef("If update option is selected, the 'DNS forwardings' section of %sDHCP and DNS%s will be automatically updated to use selected DoH providers (%smore information%s).", "<a href=\"" .. dispatcher.build_url("admin/network/dhcp") .. "\">", "</a>", "<a href=\"" .. readmeURL .. "#default-settings" .. "\" target=\"_blank\">", "</a>"))
d1:value('*', translate("Update all configs")) d1:value('*', translate("Update all configs"))
local dnsmasq_num = 0 local dnsmasq_num = 0
uci:foreach("dhcp", "dnsmasq", function(s) uci:foreach("dhcp", "dnsmasq", function(s)
@ -133,6 +131,10 @@ dnsmasq_num = dnsmasq_num + 1
end) end)
d1:value('-', translate("Do not update configs")) d1:value('-', translate("Do not update configs"))
d1.default = '*' d1.default = '*'
f1 = c:option(ListValue, "force_dns", translate("Force Router DNS"), translate("Forces Router DNS use on local devices, also known as DNS Hijacking."))
f1:value("0", translate("Let local devices use their own DNS servers if set"))
f1:value("1", translate("Force Router DNS server to all local devices"))
f1.default = '1'
createHelperText() createHelperText()
s3 = m:section(TypedSection, "https-dns-proxy", translate("Instances"), s3 = m:section(TypedSection, "https-dns-proxy", translate("Instances"),

View file

@ -1,7 +1,7 @@
msgid "" msgid ""
msgstr "Content-Type: text/plain; charset=UTF-8" msgstr "Content-Type: text/plain; charset=UTF-8"
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:73 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:72
msgid "%s is not installed or not found" msgid "%s is not installed or not found"
msgstr "" msgstr ""
@ -53,7 +53,7 @@ msgstr ""
msgid "Cloudflare (Security Protection)" msgid "Cloudflare (Security Protection)"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:126 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:124
msgid "Configuration" msgid "Configuration"
msgstr "" msgstr ""
@ -61,7 +61,7 @@ msgstr ""
msgid "DNS HTTPS Proxy" msgid "DNS HTTPS Proxy"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:107 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:105
msgid "DNS HTTPS Proxy Settings" msgid "DNS HTTPS Proxy Settings"
msgstr "" msgstr ""
@ -81,7 +81,7 @@ msgstr ""
msgid "DNSPod.cn Public DNS" msgid "DNSPod.cn Public DNS"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:189 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:191
msgid "DSCP Codepoint" msgid "DSCP Codepoint"
msgstr "" msgstr ""
@ -93,7 +93,7 @@ msgstr ""
msgid "Disable" msgid "Disable"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:134 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:132
msgid "Do not update configs" msgid "Do not update configs"
msgstr "" msgstr ""
@ -105,6 +105,18 @@ msgstr ""
msgid "For more information on different options check" msgid "For more information on different options check"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:134
msgid "Force Router DNS"
msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:136
msgid "Force Router DNS server to all local devices"
msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:134
msgid "Forces Router DNS use on local devices, also known as DNS Hijacking."
msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/google.dns.lua:3 #: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/google.dns.lua:3
msgid "Google" msgid "Google"
msgstr "" msgstr ""
@ -113,17 +125,21 @@ msgstr ""
msgid "Grant UCI and file access for luci-app-https-dns-proxy" msgid "Grant UCI and file access for luci-app-https-dns-proxy"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:126 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:125
msgid "" msgid ""
"If update DNSMASQ config is selected, when you add/remove any instances " "If update option is selected, the 'DNS forwardings' section of %sDHCP and DNS"
"below, they will be used to override the 'DNS forwardings' section of %sDHCP " "%s will be automatically updated to use selected DoH providers (%smore "
"and DNS%s (%smore information%s)." "information%s)."
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:138 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:140
msgid "Instances" msgid "Instances"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:135
msgid "Let local devices use their own DNS servers if set"
msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua:3 #: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua:3
msgid "LibreDNS" msgid "LibreDNS"
msgstr "" msgstr ""
@ -132,11 +148,11 @@ msgstr ""
msgid "LibreDNS (No Ads)" msgid "LibreDNS (No Ads)"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:172 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:174
msgid "Listen Address" msgid "Listen Address"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:185 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:187
msgid "Listen Port" msgid "Listen Port"
msgstr "" msgstr ""
@ -160,7 +176,7 @@ msgstr ""
msgid "OpenDNS (Family Shield)" msgid "OpenDNS (Family Shield)"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:193 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:195
msgid "Proxy Server" msgid "Proxy Server"
msgstr "" msgstr ""
@ -188,19 +204,19 @@ msgstr ""
msgid "Reload" msgid "Reload"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:145 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:147
msgid "Resolver" msgid "Resolver"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:99 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:91
msgid "Running: %s DoH at %s:%s" msgid "Running: %s DoH at %s:%s"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:111 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:109
msgid "Service Status" msgid "Service Status"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:109 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:107
msgid "Service Status [%s %s]" msgid "Service Status [%s %s]"
msgstr "" msgstr ""
@ -212,7 +228,7 @@ msgstr ""
msgid "Stop" msgid "Stop"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:77 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:98
msgid "Stopped" msgid "Stopped"
msgstr "" msgstr ""
@ -220,15 +236,15 @@ msgstr ""
msgid "Unknown Provider" msgid "Unknown Provider"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:131 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:129
msgid "Update %s config" msgid "Update %s config"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:127 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:125
msgid "Update DNSMASQ Config on Start/Stop" msgid "Update DNSMASQ Config on Start/Stop"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:128 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:126
msgid "Update all configs" msgid "Update all configs"
msgstr "" msgstr ""
@ -236,7 +252,7 @@ msgstr ""
msgid "and" msgid "and"
msgstr "" msgstr ""
#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:79 #: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:100
msgid "disabled" msgid "disabled"
msgstr "" msgstr ""