diff options
Diffstat (limited to 'applications/luci-app-https-dns-proxy/luasrc')
13 files changed, 127 insertions, 49 deletions
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 5fb6df3632..56a409f916 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 950f203f6e..504070501f 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 0000000000..22e6fffe41 --- /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 0000000000..bd51e1be42 --- /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 89becb18b3..eaa4b83703 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 67c24fa774..4d1914a0f6 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 e367794820..36fbeb39e8 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 e459f2933e..61ca444eff 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 e81637935b..5b4d908543 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 9fabda1d77..47a0654d22 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 0bf11f59d8..6e370d513f 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 11eca60399..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 = "<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 @@ -35,6 +62,9 @@ else if not ubusStatus or not ubusStatus[packageName] then tmpfsStatusCode = 0 tmpfsStatus = translate("Stopped") + if not luci.sys.init.enabled(packageName) then + tmpfsStatus = tmpfsStatus .. " (" .. translate("disabled") .. ")" + end else tmpfsStatusCode, tmpfsStatus = 1, "" for n = 1,1000 do @@ -80,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 ") .. [[ <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>]] .. " " .. 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 diff --git a/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm b/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm index 52d2b50e52..b7fcd472ed 100644 --- a/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm +++ b/applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm @@ -1,56 +1,77 @@ -<%# - Copyright 2019 Stan Grishin <stangri@melmac.net> --%> +<%# Copyright 2020 Stan Grishin <stangri@melmac.net> -%> + +<%+https-dns-proxy/css%> +<%+https-dns-proxy/js%> <%- local packageName = "https-dns-proxy" - local enabledFlag = luci.sys.init.enabled(packageName) - local ubusStatus = luci.util.ubus("service", "list", { name = packageName }) + local serviceRunning, serviceEnabled = false, false; - if not ubusStatus or not ubusStatus[packageName] then - tmpfsStatusCode = 0 - else - tmpfsStatusCode = 1 + serviceEnabled = luci.sys.init.enabled(packageName) + local ubusStatus = luci.util.ubus("service", "list", { name = packageName }) + if ubusStatus and ubusStatus[packageName] then + serviceRunning = true end - if tmpfsStatusCode == 0 then - btn_start_style = "cbi-button cbi-button-apply important" - btn_action_style = "cbi-button cbi-button-apply important" - btn_stop_style = "cbi-button cbi-button-reset -disabled" + if serviceEnabled then + btn_start_status = true + btn_action_status = true + btn_stop_status = true + btn_enable_status = false + btn_disable_status = true else - btn_start_style = "cbi-button cbi-button-apply -disabled" - btn_action_style = "cbi-button cbi-button-apply important" - btn_stop_style = "cbi-button cbi-button-reset important" + btn_start_status = false + btn_action_status = false + btn_stop_status = false + btn_enable_status = true + btn_disable_status = false end - if not enabledFlag then - btn_start_style = "cbi-button cbi-button-apply -disabled" - btn_action_style = "cbi-button cbi-button-apply -disabled" - btn_enable_style = "cbi-button cbi-button-apply important" - btn_disable_style = "cbi-button cbi-button-reset -disabled" + if serviceRunning then + btn_start_status = false + btn_action_status = true + btn_stop_status = true else - btn_enable_style = "cbi-button cbi-button-apply -disabled" - btn_disable_style = "cbi-button cbi-button-reset important" + btn_action_status = false + btn_stop_status = false end -%> -<%+https-dns-proxy/css%> -<%+https-dns-proxy/js%> - <div class="cbi-value"><label class="cbi-value-title">Service Control</label> <div class="cbi-value-field"> - <input type="button" class="<%=btn_start_style%>" id="btn_start" name="start" value="<%:Start%>" onclick="button_action(this)" /> + <input type="button" class="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="<%=btn_action_style%>" id="btn_action" name="action" value="<%:Reload%>" onclick="button_action(this)" /> + <input type="button" class="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="<%=btn_stop_style%>" id="btn_stop" name="stop" value="<%:Stop%>" onclick="button_action(this)" /> + <input type="button" class="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> - <input type="button" class="<%=btn_enable_style%>" id="btn_enable" name="enable" value="<%:Enable%>" onclick="button_action(this)" /> + <input type="button" class="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="<%=btn_disable_style%>" id="btn_disable" name="disable" value="<%:Disable%>" onclick="button_action(this)" /> + <input type="button" class="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> </div> + +<%-if not btn_start_status then%> +<script type="text/javascript">document.getElementById("btn_start").disabled = true;</script> +<%-end%> +<%-if not btn_action_status then%> +<script type="text/javascript">document.getElementById("btn_action").disabled = true;</script> +<%-end%> +<%-if not btn_stop_status then%> +<script type="text/javascript">document.getElementById("btn_stop").disabled = true;</script> +<%-end%> +<%-if not btn_enable_status then%> +<script type="text/javascript">document.getElementById("btn_enable").disabled = true;</script> +<%-end%> +<%-if not btn_disable_status then%> +<script type="text/javascript">document.getElementById("btn_disable").disabled = true;</script> +<%-end%> |