From b3184860e1c4fac314bf505bf6e2c6e458b918bd Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Mon, 6 Apr 2020 14:00:33 +0000 Subject: [PATCH] luci-app-https-dns-proxy: Move help links to providers files, Add LibreDNS. Signed-off-by: Stan Grishin --- .../luci-app-https-dns-proxy/Makefile | 2 +- .../providers/com.adguard.dns-family.lua | 4 +- .../providers/com.adguard.dns.lua | 4 +- .../providers/gr.libredns.doh-ads.lua | 8 ++++ .../providers/gr.libredns.doh.lua | 8 ++++ .../providers/net.quad9.dns.lua | 4 +- .../providers/net.quad9.dns10.lua | 4 +- .../providers/net.quad9.dns11.lua | 4 +- .../providers/net.quad9.dns9.lua | 4 +- .../providers/org.cleanbrowsing.doh-adult.lua | 4 +- .../org.cleanbrowsing.doh-family.lua | 4 +- .../org.cleanbrowsing.doh-security.lua | 4 +- .../luasrc/model/cbi/https-dns-proxy.lua | 38 +++++++++++---- .../po/templates/https-dns-proxy.pot | 48 +++++++++++-------- 14 files changed, 101 insertions(+), 39 deletions(-) create mode 100644 applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh-ads.lua create mode 100644 applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua diff --git a/applications/luci-app-https-dns-proxy/Makefile b/applications/luci-app-https-dns-proxy/Makefile index 3f93d6a5c..918d8b085 100644 --- a/applications/luci-app-https-dns-proxy/Makefile +++ b/applications/luci-app-https-dns-proxy/Makefile @@ -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 diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns-family.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns-family.lua index 5fb6df363..56a409f91 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns-family.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns-family.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns.lua index 950f203f6..504070501 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns.lua @@ -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 index 000000000..22e6fffe4 --- /dev/null +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh-ads.lua @@ -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 index 000000000..bd51e1be4 --- /dev/null +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua @@ -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" +} diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns.lua index 89becb18b..eaa4b8370 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns10.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns10.lua index 67c24fa77..4d1914a0f 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns10.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns10.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns11.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns11.lua index e36779482..36fbeb39e 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns11.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns11.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns9.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns9.lua index e459f2933..61ca444ef 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns9.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns9.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-adult.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-adult.lua index e81637935..5b4d90854 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-adult.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-adult.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-family.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-family.lua index 9fabda1d7..47a0654d2 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-family.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-family.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-security.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-security.lua index 0bf11f59d..6e370d513 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-security.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-security.lua @@ -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" } diff --git a/applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua b/applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua index 405eb2a84..d914bf09a 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua +++ b/applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua @@ -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 = "
" .. 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 .. [[]] .. domain .. [[]] + 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 ") .. [[ ]] - .. translate("DHCP and DNS") .. [[]] .. "." - .. "
" - .. translate("For more information on different options check ") - .. [[ ]] - .. "AdGuard.com" .. [[]] .. ", " - .. [[ ]] - .. "CleanBrowsing.org" .. [[]] .. " " .. translate("and") .. " " - .. [[ ]] - .. "Quad9.net" .. [[]] .. ".") + .. translate("DHCP and DNS") .. [[]] .. "." .. helperText) s3.template = "cbi/tblsection" s3.sortable = false s3.anonymous = true diff --git a/applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot b/applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot index 78352cc7a..6b7877f26 100644 --- a/applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot +++ b/applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot @@ -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 "" -- 2.25.1