luci-app-https-dns-proxy: add Force DNS, IDNet support, add missing class to buttons 4830/head
authorStan Grishin <stangri@melmac.net>
Tue, 23 Feb 2021 00:54:04 +0000 (00:54 +0000)
committerStan Grishin <stangri@melmac.net>
Tue, 23 Feb 2021 00:54:04 +0000 (00:54 +0000)
Signed-off-by: Stan Grishin <stangri@melmac.net>
applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.idnet.doh.lua [new file with mode: 0644]
applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua
applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm
applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot

diff --git a/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.idnet.doh.lua b/applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.idnet.doh.lua
new file mode 100644 (file)
index 0000000..27ea3ec
--- /dev/null
@@ -0,0 +1,6 @@
+return{
+       name = "IDNet (UK)",
+       label = _("IDNet.net (UK)"),
+       resolver_url = "https://doh.idnet.net/dns-query",
+       bootstrap_dns = "212.69.36.23,212.69.40.23"
+}
index e38e4e39b6e43dfabb254d8da6725558addf0cc0..98fabf86aebaccdbb58e7bcaaa25b251bc390819 100644 (file)
@@ -69,38 +69,36 @@ local ubusStatus = util.ubus("service", "list", { name = packageName })
 local packageVersion = getPackageVersion()
 
 if packageVersion == "" then
-       packageStatusCode = -1
-       packageStatus = translatef("%s is not installed or not found", packageName)
+       packageStatusCode, packageStatus = -1, translatef("%s is not installed or not found", packageName)
 else  
-       if not ubusStatus or not ubusStatus[packageName] then
+       packageStatusCode, packageStatus = 1, ""
+       for n = 1,20 do
+               if ubusStatus and ubusStatus[packageName] and 
+                        ubusStatus[packageName]["instances"] and 
+                        ubusStatus[packageName]["instances"]["instance" .. n] and 
+                        ubusStatus[packageName]["instances"]["instance" .. n]["running"] then
+                       local value, k, v, url, url_flag, la, la_flag, lp, lp_flag
+                       for k, v in pairs(ubusStatus[packageName]["instances"]["instance" .. n]["command"]) do
+                               if la_flag then la, la_flag = v, false end
+                               if lp_flag then lp, lp_flag = v, false end
+                               if url_flag then url, url_flag = v, false end
+                               if v == "-a" then la_flag = true end
+                               if v == "-p" then lp_flag = true end
+                               if v == "-r" then url_flag = true end
+                       end
+                       la = la or "127.0.0.1"
+                       lp = lp or n + 5053
+                       packageStatus = packageStatus .. translatef("Running: %s DoH at %s:%s", getProviderName(url), la, lp) .. "\n"
+               else
+                       break
+               end
+       end
+       if packageStatus == "" then
                packageStatusCode = 0
                packageStatus = translate("Stopped")
                if not sys.init.enabled(packageName) then
                        packageStatus = packageStatus .. " (" .. translate("disabled") .. ")"
                end
-       else
-               packageStatusCode, packageStatus = 1, ""
-               for n = 1,1000 do
-                       if ubusStatus and ubusStatus[packageName] and 
-                                ubusStatus[packageName]["instances"] and 
-                                ubusStatus[packageName]["instances"]["instance" .. n] and 
-                                ubusStatus[packageName]["instances"]["instance" .. n]["running"] then
-                               local value, k, v, url, url_flag, la, la_flag, lp, lp_flag
-                               for k, v in pairs(ubusStatus[packageName]["instances"]["instance" .. n]["command"]) do
-                                       if la_flag then la, la_flag = v, false end
-                                       if lp_flag then lp, lp_flag = v, false end
-                                       if url_flag then url, url_flag = v, false end
-                                       if v == "-a" then la_flag = true end
-                                       if v == "-p" then lp_flag = true end
-                                       if v == "-r" then url_flag = true end
-                               end
-                               la = la or "127.0.0.1"
-                               lp = lp or n + 5053
-                               packageStatus = packageStatus .. translatef("Running: %s DoH at %s:%s", getProviderName(url), la, lp) .. "\n"
-                       else
-                               break
-                       end
-               end
        end
 end
 
@@ -123,8 +121,8 @@ 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"))
+c = m:section(NamedSection, "config", "https-dns-proxy", translate("Configuration"))
+d1 = c:option(ListValue, "update_dnsmasq_config", translate("Update DNSMASQ Config on Start/Stop"), translatef("If update option is selected, the 'DNS forwardings' section of %sDHCP and DNS%s will be automatically updated to use selected DoH providers (%smore information%s).", "<a href=\"" .. dispatcher.build_url("admin/network/dhcp") .. "\">", "</a>", "<a href=\"" .. readmeURL .. "#default-settings" .. "\" target=\"_blank\">", "</a>"))
 d1:value('*', translate("Update all configs"))
 local dnsmasq_num = 0
 uci:foreach("dhcp", "dnsmasq", function(s)
@@ -133,6 +131,10 @@ dnsmasq_num = dnsmasq_num + 1
 end)
 d1:value('-', translate("Do not update configs"))
 d1.default = '*'
+f1 = c:option(ListValue, "force_dns", translate("Force Router DNS"), translate("Forces Router DNS use on local devices, also known as DNS Hijacking."))
+f1:value("0", translate("Let local devices use their own DNS servers if set"))
+f1:value("1", translate("Force Router DNS server to all local devices"))
+f1.default = '1'
 
 createHelperText()
 s3 = m:section(TypedSection, "https-dns-proxy", translate("Instances"), 
index b7fcd472edaa8fc8639a7abd08f5fe83fd78c0a7..c5164d7292ad8e01d8893cd88bac2bdb292a267e 100644 (file)
 
 <div class="cbi-value"><label class="cbi-value-title">Service Control</label>
        <div class="cbi-value-field">
-               <input type="button" class="cbi-button cbi-button-apply" id="btn_start" name="start" value="<%:Start%>"
+               <input type="button" class="btn cbi-button cbi-button-apply" id="btn_start" name="start" value="<%:Start%>"
                        onclick="button_action(this)" />
                <span id="btn_start_spinner" class="btn_spinner"></span>
-               <input type="button" class="cbi-button cbi-button-apply" id="btn_action" name="action" value="<%:Reload%>"
+               <input type="button" class="btn cbi-button cbi-button-apply" id="btn_action" name="action" value="<%:Reload%>"
                        onclick="button_action(this)" />
                <span id="btn_action_spinner" class="btn_spinner"></span>
-               <input type="button" class="cbi-button cbi-button-reset" id="btn_stop" name="stop" value="<%:Stop%>"
+               <input type="button" class="btn cbi-button cbi-button-reset" id="btn_stop" name="stop" value="<%:Stop%>"
                        onclick="button_action(this)" />
                <span id="btn_stop_spinner" class="btn_spinner"></span>
                &nbsp;
                &nbsp;
                &nbsp;
                &nbsp;
-               <input type="button" class="cbi-button cbi-button-apply" id="btn_enable" name="enable" value="<%:Enable%>"
+               <input type="button" class="btn cbi-button cbi-button-apply" id="btn_enable" name="enable" value="<%:Enable%>"
                        onclick="button_action(this)" />
                <span id="btn_enable_spinner" class="btn_spinner"></span>
-               <input type="button" class="cbi-button cbi-button-reset" id="btn_disable" name="disable" value="<%:Disable%>"
+               <input type="button" class="btn cbi-button cbi-button-reset" id="btn_disable" name="disable" value="<%:Disable%>"
                        onclick="button_action(this)" />
                <span id="btn_disable_spinner" class="btn_spinner"></span>
        </div>
index 6ba0dfebc129864949063399f5d22424ac690582..aa181f1bc39d76dc087f10fa5b090bcfc6c97ffd 100644 (file)
@@ -1,7 +1,7 @@
 msgid ""
 msgstr "Content-Type: text/plain; charset=UTF-8"
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:73
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:72
 msgid "%s is not installed or not found"
 msgstr ""
 
@@ -53,7 +53,7 @@ msgstr ""
 msgid "Cloudflare (Security Protection)"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:126
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:124
 msgid "Configuration"
 msgstr ""
 
@@ -61,7 +61,7 @@ msgstr ""
 msgid "DNS HTTPS Proxy"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:107
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:105
 msgid "DNS HTTPS Proxy Settings"
 msgstr ""
 
@@ -81,7 +81,7 @@ msgstr ""
 msgid "DNSPod.cn Public DNS"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:189
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:191
 msgid "DSCP Codepoint"
 msgstr ""
 
@@ -93,7 +93,7 @@ msgstr ""
 msgid "Disable"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:134
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:132
 msgid "Do not update configs"
 msgstr ""
 
@@ -105,21 +105,45 @@ msgstr ""
 msgid "For more information on different options check"
 msgstr ""
 
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:134
+msgid "Force Router DNS"
+msgstr ""
+
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:136
+msgid "Force Router DNS server to all local devices"
+msgstr ""
+
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:134
+msgid "Forces Router DNS use on local devices, also known as DNS Hijacking."
+msgstr ""
+
 #: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/google.dns.lua:3
 msgid "Google"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:126
+#: applications/luci-app-https-dns-proxy/root/usr/share/rpcd/acl.d/luci-app-https-dns-proxy.json:3
+msgid "Grant UCI and file access for luci-app-https-dns-proxy"
+msgstr ""
+
+#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.idnet.doh.lua:3
+msgid "IDNet.net (UK)"
+msgstr ""
+
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:125
 msgid ""
-"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)."
+"If update option is selected, the 'DNS forwardings' section of %sDHCP and DNS"
+"%s will be automatically updated to use selected DoH providers (%smore "
+"information%s)."
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:138
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:140
 msgid "Instances"
 msgstr ""
 
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:135
+msgid "Let local devices use their own DNS servers if set"
+msgstr ""
+
 #: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/gr.libredns.doh.lua:3
 msgid "LibreDNS"
 msgstr ""
@@ -128,11 +152,11 @@ msgstr ""
 msgid "LibreDNS (No Ads)"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:172
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:174
 msgid "Listen Address"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:185
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:187
 msgid "Listen Port"
 msgstr ""
 
@@ -156,7 +180,7 @@ msgstr ""
 msgid "OpenDNS (Family Shield)"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:193
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:195
 msgid "Proxy Server"
 msgstr ""
 
@@ -184,19 +208,19 @@ msgstr ""
 msgid "Reload"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:145
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:147
 msgid "Resolver"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:99
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:91
 msgid "Running: %s DoH at %s:%s"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:111
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:109
 msgid "Service Status"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:109
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:107
 msgid "Service Status [%s %s]"
 msgstr ""
 
@@ -208,7 +232,7 @@ msgstr ""
 msgid "Stop"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:77
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:98
 msgid "Stopped"
 msgstr ""
 
@@ -216,15 +240,15 @@ msgstr ""
 msgid "Unknown Provider"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:131
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:129
 msgid "Update %s config"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:127
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:125
 msgid "Update DNSMASQ Config on Start/Stop"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:128
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:126
 msgid "Update all configs"
 msgstr ""
 
@@ -232,7 +256,7 @@ msgstr ""
 msgid "and"
 msgstr ""
 
-#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:79
+#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:100
 msgid "disabled"
 msgstr ""