summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.net>2020-04-06 14:00:09 +0000
committerStan Grishin <stangri@melmac.net>2020-04-06 14:00:09 +0000
commitc656aefad36c143efe495b1056fd20aa6f9df196 (patch)
tree307f5b514196da713854f4aacb15a48b4c6307e8 /applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua
parent77158e2a968734b285a2969d70f6836e04b6bb18 (diff)
luci-app-https-dns-proxy: Move help links to providers files, Add LibreDNS.
Signed-off-by: Stan Grishin <stangri@melmac.net>
Diffstat (limited to 'applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua')
-rw-r--r--applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua40
1 files changed, 29 insertions, 11 deletions
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 a50b5b17c..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 = "<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,19 +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>]] .. " "
- .. [[ <a href="https://libredns.gr/">]]
- .. "Libredns.gr" .. [[</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