luci-app-https-dns-proxy: WebUI for dnsmasq config update, quad9 bootstrap IPv6
[project/luci.git] / applications / luci-app-https-dns-proxy / luasrc / model / cbi / https-dns-proxy.lua
index 4fdaf26a005c27ec3bba881da04c0128248cb868..8842909c8c03c0d05f65a88bd86a9ceab6d7f862 100644 (file)
@@ -6,6 +6,7 @@ local i18n = require "luci.i18n"
 local uci = require("luci.model.uci").cursor()
 
 local packageName = "https-dns-proxy"
+local readmeURL = "https://docs.openwrt.melmac.net/" .. packageName .. "/"
 local providers_dir = "/usr/lib/lua/luci/" .. packageName .. "/providers/"
 local helperText = ""
 
@@ -24,7 +25,7 @@ function getPackageVersion()
 end
 
 function createHelperText()
-       local initText = "<br />" .. translate("For more information on different options check") .. " "
+       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 })
@@ -122,9 +123,20 @@ else
        buttons.template = packageName .. "/buttons"
 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>"))
+d1 = c:option(ListValue, "update_dnsmasq_config", translate("Update DNSMASQ Config on Start/Stop"))
+d1:value('*', translate("Update all configs"))
+local dnsmasq_num = 0
+uci:foreach("dhcp", "dnsmasq", function(s)
+d1:value(tostring(dnsmasq_num), translatef("Update %s config", "dhcp.@dnsmasq[" .. tostring(dnsmasq_num) .. "]"))
+dnsmasq_num = dnsmasq_num + 1
+end)
+d1:value('-', translate("Do not update configs"))
+d1.default = '*'
+
 createHelperText()
 s3 = m:section(TypedSection, "https-dns-proxy", translate("Instances"), 
-       translatef("When you add/remove any instances below, they will be used to override the 'DNS forwardings' section of %sDHCP and DNS%s.", "<a href=\"" .. dispatcher.build_url("admin/network/dhcp") .. "\">", "</a>") .. helperText)
+       helperText)
 s3.template = "cbi/tblsection"
 s3.sortable  = false
 s3.anonymous = true