From: Stan Grishin Date: Fri, 3 Apr 2020 12:50:35 +0000 (+0000) Subject: luci-app-https-dns-proxy: better service control & buttons styling X-Git-Url: https://git.librecmc.org/?a=commitdiff_plain;h=6d2a667205c3df3d5ce0f912309c5da8e01fdc33;p=oweals%2Fluci.git luci-app-https-dns-proxy: better service control & buttons styling Signed-off-by: Stan Grishin --- diff --git a/applications/luci-app-https-dns-proxy/Makefile b/applications/luci-app-https-dns-proxy/Makefile index 47e897191..3f93d6a5c 100644 --- a/applications/luci-app-https-dns-proxy/Makefile +++ b/applications/luci-app-https-dns-proxy/Makefile @@ -10,7 +10,7 @@ LUCI_TITLE:=DNS Over HTTPS Proxy Web UI LUCI_DESCRIPTION:=Provides Web UI for DNS Over HTTPS Proxy LUCI_DEPENDS:=+luci-compat +luci-mod-admin-full +https-dns-proxy LUCI_PKGARCH:=all -PKG_RELEASE:=1 +PKG_RELEASE:=2 include ../../luci.mk 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 11eca6039..405eb2a84 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 @@ -35,6 +35,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 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 52d2b50e5..b7fcd472e 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 --%> +<%# Copyright 2020 Stan Grishin -%> + +<%+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%> -
- + - + - +         - + - +
+ +<%-if not btn_start_status then%> + +<%-end%> +<%-if not btn_action_status then%> + +<%-end%> +<%-if not btn_stop_status then%> + +<%-end%> +<%-if not btn_enable_status then%> + +<%-end%> +<%-if not btn_disable_status then%> + +<%-end%> diff --git a/applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot b/applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot new file mode 100644 index 000000000..78352cc7a --- /dev/null +++ b/applications/luci-app-https-dns-proxy/po/templates/https-dns-proxy.pot @@ -0,0 +1,169 @@ +msgid "" +msgstr "Content-Type: text/plain; charset=UTF-8" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns-family.lua:3 +msgid "AdGuard (Family Protection)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.adguard.dns.lua:3 +msgid "AdGuard (Standard)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-adult.lua:3 +msgid "CleanBrowsing (Adult Filter)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-family.lua:3 +msgid "CleanBrowsing (Family Filter)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/org.cleanbrowsing.doh-security.lua:3 +msgid "CleanBrowsing (Security Filter)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/com.cloudflare-dns.lua:3 +msgid "Cloudflare" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:88 +msgid "DHCP and DNS" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/controller/https-dns-proxy.lua:4 +msgid "DNS Over HTTPS Proxy" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:67 +msgid "DNS Over HTTPS Proxy Settings" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers.disabled/sb.dns.lua:3 +msgid "DNS.SB" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers.disabled/ch.digitale-gesellschaft.dns.lua:3 +msgid "Digitale Gesellschaft" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm:57 +msgid "Disable" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:59 +msgid "DoH" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:146 +msgid "EDNS client subnet" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm:54 +msgid "Enable" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:90 +msgid "For more information on different options check" +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:86 +msgid "Instances" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:129 +msgid "Listen address" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:142 +msgid "Listen port" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/js.htm:52 +msgid "Loading" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/cz.nic.odvr.lua:3 +msgid "ODVR (nic.cz)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:149 +msgid "Proxy server" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns.lua:3 +msgid "Quad 9 (Recommended)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns11.lua:3 +msgid "Quad 9 (Secured with ECS Support)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns9.lua:3 +msgid "Quad 9 (Secured)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers/net.quad9.dns10.lua:3 +msgid "Quad 9 (Unsecured)" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm:44 +msgid "Reload" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:102 +msgid "Resolver" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:59 +msgid "Running" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:69 +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:71 +msgid "Service Status" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm:41 +msgid "Start" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/view/https-dns-proxy/buttons.htm:47 +msgid "Stop" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:37 +msgid "Stopped" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:22 +msgid "Unknown Provider" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:86 +msgid "" +"When you add/remove any instances below, they will be used to override the " +"'DNS forwardings' section of" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:94 +msgid "and" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:59 +msgid "at" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:39 +msgid "disabled" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/model/cbi/https-dns-proxy.lua:32 +msgid "is not installed or not found" +msgstr "" + +#: applications/luci-app-https-dns-proxy/luasrc/https-dns-proxy/providers.disabled/cn.rubyfish.dns.lua:3 +msgid "rubyfish.cn" +msgstr ""