Merge pull request #3854 from stangri/18.06-luci-app-https-dns-proxy
authorHannu Nyman <hannu.nyman@iki.fi>
Tue, 7 Apr 2020 07:18:17 +0000 (10:18 +0300)
committerGitHub <noreply@github.com>
Tue, 7 Apr 2020 07:18:17 +0000 (10:18 +0300)
[18.06] luci-app-https-dns-proxy: Move help links to providers files, Add LibreDNS

14 files changed:
applications/luci-app-https-dns-proxy/Makefile
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns-family.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh-ads.lua [new file with mode: 0644]
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua [new file with mode: 0644]
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns10.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns11.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns9.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-adult.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-family.lua
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-security.lua
applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua
applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot

index 3f93d6a5ce1944922bb7521ed6af78d3271ed665..918d8b0856cdd74872bbbac4b1ff0be3d9cec7aa 100644 (file)
@@ -10,7 +10,7 @@ LUCI_TITLE:=DNS Over HTTPS Proxy Web UI
 LUCI_DESCRIPTION:=Provides Web UI for DNS Over HTTPS Proxy
 LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +https-dns-proxy
 LUCI_PKGARCH:=all
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 
 include ../../luci.mk
 
index 5fb6df36327831289d984ee38576149b70b5152f..56a409f916736dbbd14387c958ed6b6ce1ed6b12 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "AdGuard-Family",
        label = _("AdGuard (Family Protection)"),
        resolver_url = "https://dns-family.adguard.com/dns-query",
-       bootstrap_dns = "176.103.130.132,176.103.130.134"
+       bootstrap_dns = "176.103.130.132,176.103.130.134",
+       help_link = "https://adguard.com/en/adguard-dns/overview.html",
+       help_link_text = "AdGuard.com"
 }
index 950f203f6eaa6f63ec3a8720ac3c39bc80a28df4..504070501f6f08ea353b31a868ae3bb91bb6a5fc 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "AdGuard-Standard",
        label = _("AdGuard (Standard)"),
        resolver_url = "https://dns.adguard.com/dns-query",
-       bootstrap_dns = "176.103.130.130,176.103.130.131"
+       bootstrap_dns = "176.103.130.130,176.103.130.131",
+       help_link = "https://adguard.com/en/adguard-dns/overview.html",
+       help_link_text = "AdGuard.com"
 }
diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh-ads.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh-ads.lua
new file mode 100644 (file)
index 0000000..22e6fff
--- /dev/null
@@ -0,0 +1,8 @@
+return {
+       name = "LibreDNS (No Ads)",
+       label = _("LibreDNS (No Ads)"),
+       resolver_url = "https://doh.libredns.gr/ads",
+       bootstrap_dns = "116.202.176.26",
+       help_link = "https://libredns.gr/",
+       help_link_text = "LibreDNS.gr"
+}
diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua
new file mode 100644 (file)
index 0000000..bd51e1b
--- /dev/null
@@ -0,0 +1,8 @@
+return {
+       name = "LibreDNS",
+       label = _("LibreDNS"),
+       resolver_url = "https://doh.libredns.gr/dns-query",
+       bootstrap_dns = "116.202.176.26",
+       help_link = "https://libredns.gr/",
+       help_link_text = "LibreDNS.gr"
+}
index 89becb18b3b1489e6b455aa2f751db54c2f40827..eaa4b83703763eca71123da194ab8189900d5717 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "Quad9-Recommended",
        label = _("Quad 9 (Recommended)"),
        resolver_url = "https://dns.quad9.net/dns-query",
-       bootstrap_dns = "9.9.9.9,149.112.112.112"
+       bootstrap_dns = "9.9.9.9,149.112.112.112",
+       help_link = "https://www.quad9.net/doh-quad9-dns-servers/",
+       help_link_text = "Quad9.net"
 }
index 67c24fa774524b343910a1b1f02c3c31c699b642..4d1914a0f6b358009320539b9e707cfbce75fe8a 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "Quad9-Unsecured",
        label = _("Quad 9 (Unsecured)"),
        resolver_url = "https://dns10.quad9.net/dns-query",
-       bootstrap_dns = "9.9.9.10,149.112.112.10"
+       bootstrap_dns = "9.9.9.10,149.112.112.10",
+       help_link = "https://www.quad9.net/doh-quad9-dns-servers/",
+       help_link_text = "Quad9.net"
 }
index e3677948207e79afa7e6c755623dbfe4ed8203d6..36fbeb39e8f2660d937380be928607665d145c35 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "Quad9-ECS",
        label = _("Quad 9 (Secured with ECS Support)"),
        resolver_url = "https://dns11.quad9.net/dns-query",
-       bootstrap_dns = "9.9.9.11,149.112.112.11"
+       bootstrap_dns = "9.9.9.11,149.112.112.11",
+       help_link = "https://www.quad9.net/doh-quad9-dns-servers/",
+       help_link_text = "Quad9.net"
 }
index e459f2933e7f056f2fac78c20c2be31982876f9f..61ca444eff72dc42a4c2d076af828a50850b32c3 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "Quad9-Secured",
        label = _("Quad 9 (Secured)"),
        resolver_url = "https://dns9.quad9.net/dns-query",
-       bootstrap_dns = "9.9.9.9,149.112.112.9"
+       bootstrap_dns = "9.9.9.9,149.112.112.9",
+       help_link = "https://www.quad9.net/doh-quad9-dns-servers/",
+       help_link_text = "Quad9.net"
 }
index e81637935b82fbbcfc09bc81d7c5bb423ba0f3c6..5b4d9085439483a9abd7d1dd8cced54ad274d1e8 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "CleanBrowsing-Adult",
        label = _("CleanBrowsing (Adult Filter)"),
        resolver_url = "https://doh.cleanbrowsing.org/doh/adult-filter/",
-       bootstrap_dns = "185.228.168.168"
+       bootstrap_dns = "185.228.168.168",
+       help_link = "https://cleanbrowsing.org/guides/dnsoverhttps",
+       help_link_text = "CleanBrowsing.org"
 }
index 9fabda1d77c2cd2375dbe91bbbdc03d8ed929b3e..47a0654d22108e832a9a009876c08d2324699cee 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "CleanBrowsing-Family",
        label = _("CleanBrowsing (Family Filter)"),
        resolver_url = "https://doh.cleanbrowsing.org/doh/family-filter/",
-       bootstrap_dns = "185.228.168.168"
+       bootstrap_dns = "185.228.168.168",
+       help_link = "https://cleanbrowsing.org/guides/dnsoverhttps",
+       help_link_text = "CleanBrowsing.org"
 }
index 0bf11f59d8700ba99ee9f3eef7455f8fdac11acb..6e370d513f6e0fa6094d4bd9516fc9b22bd051fe 100644 (file)
@@ -2,5 +2,7 @@ return {
        name = "CleanBrowsing-Security",
        label = _("CleanBrowsing (Security Filter)"),
        resolver_url = "https://doh.cleanbrowsing.org/doh/security-filter/",
-       bootstrap_dns = "185.228.168.168"
+       bootstrap_dns = "185.228.168.168",
+       help_link = "https://cleanbrowsing.org/guides/dnsoverhttps",
+       help_link_text = "CleanBrowsing.org"
 }
index 405eb2a846accdce3875e1325e50df59af1a0327..d914bf09a33fe58d1711e14540622a188b462b38 100644 (file)
@@ -7,6 +7,33 @@ local uci = require("luci.model.uci").cursor()
 
 local packageName = "https-dns-proxy"
 local providers_dir = "/usr/lib/lua/luci/" .. packageName .. "/providers/"
+local helperText = ""
+
+function create_helper_text()
+       local initText = "<br />" .. translate("For more information on different options check") .. " "
+       for filename in fs.dir(providers_dir) do
+               local p_func = loadfile(providers_dir .. filename)
+               setfenv(p_func, { _ = i18n.translate })
+               local p = p_func()
+               if p.help_link then
+                       local url, domain
+                       url = p.help_link
+                       domain = p.help_link_text or url:match('^%w+://([^/]+)')
+                       if not helperText:find(domain) then
+                               if helperText == "" then
+                                       helperText = initText
+                               else
+                                       helperText = helperText .. ", "
+                               end
+                               helperText = helperText .. [[<a href="]] .. url .. [[">]] .. domain .. [[</a>]]
+                       end
+               end
+       end
+       if helperText ~= "" then
+               local a = helperText:gsub('(.*),%s.*$', '%1')
+               helperText = a .. " " .. translate("and") .. helperText:sub(#a + 2) .. "."
+       end
+end
 
 function get_provider_name(value)
        for filename in fs.dir(providers_dir) do
@@ -83,17 +110,10 @@ else
        buttons.template = packageName .. "/buttons"
 end
 
+create_helper_text()
 s3 = m:section(TypedSection, "https-dns-proxy", translate("Instances"), translate("When you add/remove any instances below, they will be used to override the 'DNS forwardings' section of ")
                .. [[ <a href="]] .. dispatcher.build_url("admin/network/dhcp") .. [[">]]
-               .. translate("DHCP and DNS") .. [[</a>]] .. "."
-    .. "<br />"
-    .. translate("For more information on different options check ")
-               .. [[ <a href="https://adguard.com/en/adguard-dns/overview.html">]]
-    .. "AdGuard.com" .. [[</a>]] .. ", "
-               .. [[ <a href="https://cleanbrowsing.org/guides/dnsoverhttps">]]
-    .. "CleanBrowsing.org" .. [[</a>]] .. " " .. translate("and") .. " "
-               .. [[ <a href="https://www.quad9.net/doh-quad9-dns-servers/">]]
-    .. "Quad9.net" .. [[</a>]] .. ".")
+               .. translate("DHCP and DNS") .. [[</a>]] .. "." .. helperText)
 s3.template = "cbi/tblsection"
 s3.sortable  = false
 s3.anonymous = true
index 78352cc7adebcd3dbd1e377bcb9156ba06e153d2..6b7877f26587ffd45b8e0470725af41bc308aab3 100644 (file)
@@ -25,7 +25,7 @@ msgstr ""
 msgid "Cloudflare"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:88
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:116
 msgid "DHCP and DNS"
 msgstr ""
 
@@ -33,7 +33,7 @@ msgstr ""
 msgid "DNS Over HTTPS Proxy"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:67
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:94
 msgid "DNS Over HTTPS Proxy Settings"
 msgstr ""
 
@@ -49,11 +49,11 @@ msgstr ""
 msgid "Disable"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:59
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:86
 msgid "DoH"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:146
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:166
 msgid "EDNS client subnet"
 msgstr ""
 
@@ -61,7 +61,7 @@ msgstr ""
 msgid "Enable"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:90
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:13
 msgid "For more information on different options check"
 msgstr ""
 
@@ -69,15 +69,23 @@ msgstr ""
 msgid "Google"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:86
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:114
 msgid "Instances"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:129
+#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua:3
+msgid "LibreDNS"
+msgstr ""
+
+#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh-ads.lua:3
+msgid "LibreDNS (No Ads)"
+msgstr ""
+
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:149
 msgid "Listen address"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:142
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:162
 msgid "Listen port"
 msgstr ""
 
@@ -89,7 +97,7 @@ msgstr ""
 msgid "ODVR (nic.cz)"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:149
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:169
 msgid "Proxy server"
 msgstr ""
 
@@ -113,16 +121,16 @@ msgstr ""
 msgid "Reload"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:102
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:122
 msgid "Resolver"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:59
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:86
 msgid "Running"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:69
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:71
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:96
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:98
 msgid "Service Status"
 msgstr ""
 
@@ -134,33 +142,33 @@ msgstr ""
 msgid "Stop"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:37
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:64
 msgid "Stopped"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:22
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:49
 msgid "Unknown Provider"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:86
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:114
 msgid ""
 "When you add/remove any instances below, they will be used to override the "
 "'DNS forwardings' section of"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:94
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:34
 msgid "and"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:59
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:86
 msgid "at"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:39
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:66
 msgid "disabled"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:32
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:59
 msgid "is not installed or not found"
 msgstr ""