From c656aefad36c143efe495b1056fd20aa6f9df196 Mon Sep 17 00:00:00 2001 From: Stan Grishin Date: Mon, 6 Apr 2020 14:00:09 +0000 Subject: luci-app-https-dns-proxy: Move help links to providers files, Add LibreDNS. Signed-off-by: Stan Grishin --- .../luasrc/model/cbi/https-dns-proxy.lua | 40 ++++++++++++++++------ 1 file changed, 29 insertions(+), 11 deletions(-) (limited to 'applications/luci-app-https-dns-proxy/luasrc/model/cbi') 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 a50b5b17c9..d914bf09a3 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,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 ") .. [[ ]] - .. translate("DHCP and DNS") .. [[]] .. "." - .. "
" - .. translate("For more information on different options check ") - .. [[ ]] - .. "AdGuard.com" .. [[]] .. ", " - .. [[ ]] - .. "CleanBrowsing.org" .. [[]] .. " " - .. [[ ]] - .. "Libredns.gr" .. [[]] - .. "Quad9.net" .. [[]] .. ".") + .. translate("DHCP and DNS") .. [[]] .. "." .. helperText) s3.template = "cbi/tblsection" s3.sortable = false s3.anonymous = true -- cgit v1.2.3