diff options
Diffstat (limited to 'applications/luci-app-dnscrypt-proxy')
-rw-r--r-- | applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua | 60 | ||||
-rw-r--r-- | applications/luci-app-dnscrypt-proxy/po/ru/dnscrypt-proxy.po | 28 |
2 files changed, 52 insertions, 36 deletions
diff --git a/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua b/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua index 368c6673ad..999c81dee7 100644 --- a/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua +++ b/applications/luci-app-dnscrypt-proxy/luasrc/model/cbi/dnscrypt-proxy/overview_tab.lua @@ -1,4 +1,4 @@ --- Copyright 2017 Dirk Brenken (dev@brenken.org) +-- Copyright 2017-2018 Dirk Brenken (dev@brenken.org) -- This is free software, licensed under the Apache License, Version 2.0 local fs = require("nixio.fs") @@ -6,10 +6,11 @@ local uci = require("luci.model.uci").cursor() local util = require("luci.util") local date = require("luci.http.protocol.date") local res_input = "/usr/share/dnscrypt-proxy/dnscrypt-resolvers.csv" +local res_dir = fs.dirname(res_input) local dump = util.ubus("network.interface", "dump", {}) local plug_cnt = tonumber(luci.sys.exec("env -i /usr/sbin/dnscrypt-proxy --version | grep 'Support for plugins: present' | wc -l")) local res_list = {} -local url = "https://download.dnscrypt.org/dnscrypt-proxy/dnscrypt-resolvers.csv" +local url = "https://raw.githubusercontent.com/dyne/dnscrypt-proxy/master/dnscrypt-resolvers.csv" if not fs.access(res_input) then if not fs.access("/lib/libustream-ssl.so") then @@ -29,22 +30,24 @@ if not uci:get_first("dnscrypt-proxy", "global") then uci:commit("dnscrypt-proxy") end -for line in io.lines(res_input) do - local name, - location, - dnssec, - nolog = line:match("^([^,]+),.-,\".-\",\"*(.-)\"*,.-,[0-9],\"*([yesno]+)\"*,\"*([yesno]+)\"*,.*") - if name ~= "" and name ~= "Name" then - if location == "" then - location = "-" - end - if dnssec == "" then - dnssec = "-" - end - if nolog == "" then - nolog = "-" +if fs.access(res_input) then + for line in io.lines(res_input) or {} do + local name, + location, + dnssec, + nolog = line:match("^([^,]+),.-,\".-\",\"*(.-)\"*,.-,[0-9],\"*([yesno]+)\"*,\"*([yesno]+)\"*,.*") + if name ~= "" and name ~= "Name" then + if location == "" then + location = "-" + end + if dnssec == "" then + dnssec = "-" + end + if nolog == "" then + nolog = "-" + end + res_list[#res_list + 1] = { name = name, location = location, dnssec = dnssec, nolog = nolog } end - res_list[#res_list + 1] = { name = name, location = location, dnssec = dnssec, nolog = nolog } end end @@ -60,7 +63,7 @@ function m.on_after_commit(self) if value == "1" then uci:commit("dnscrypt-proxy") uci:set("dhcp", s1, "noresolv", 1) - if not fs.access("/etc/resolv-crypt.conf") or nixio.fs.stat("/etc/resolv-crypt.conf").size == 0 then + if not fs.access("/etc/resolv-crypt.conf") or fs.stat("/etc/resolv-crypt.conf").size == 0 then uci:set("dhcp", s1, "resolvfile", "/tmp/resolv.conf.auto") else uci:set("dhcp", s1, "resolvfile", "/etc/resolv-crypt.conf") @@ -98,32 +101,43 @@ o1.value = res_input o2 = s:option(DummyValue, "", translate("File Date")) o2.template = "dnscrypt-proxy/res_options" -o2.value = date.to_http(nixio.fs.stat(res_input).mtime) +if fs.access(res_input) then + o2.value = date.to_http(fs.stat(res_input).mtime) +else + o2.value = "-" +end o3 = s:option(DummyValue, "", translate("File Checksum")) o3.template = "dnscrypt-proxy/res_options" -o3.value = luci.sys.exec("sha256sum " .. res_input .. " | awk '{print $1}'") +if fs.access(res_input) then + o3.value = luci.sys.exec("sha256sum " .. res_input .. " | awk '{print $1}'") +else + o3.value = "-" +end if fs.access("/lib/libustream-ssl.so") then btn1 = s:option(Button, "", translate("Refresh Resolver List"), - translate("Download the current resolver list from 'download.dnscrypt.org'.")) + translate("Download the current resolver list from 'github.com/dyne/dnscrypt-proxy'.")) btn1.inputtitle = translate("Refresh List") btn1.inputstyle = "apply" btn1.disabled = false function btn1.write() + if not fs.access(res_dir) then + fs.mkdir(res_dir) + end luci.sys.call("env -i /bin/uclient-fetch --no-check-certificate -O " .. res_input .. " " .. url .. " >/dev/null 2>&1") luci.http.redirect(luci.dispatcher.build_url("admin", "services", "dnscrypt-proxy")) end else btn1 = s:option(Button, "", translate("Refresh Resolver List"), translate("No SSL support available.<br />") - .. translate("Please install a 'libustream-ssl' library to download the current resolver list from 'download.dnscrypt.org'.")) + .. translate("Please install a 'libustream-ssl' library to download the current resolver list from 'github.com/dyne/dnscrypt-proxy'.")) btn1.inputtitle = translate("-------") btn1.inputstyle = "button" btn1.disabled = true end -if not fs.access("/etc/resolv-crypt.conf") or nixio.fs.stat("/etc/resolv-crypt.conf").size == 0 then +if not fs.access("/etc/resolv-crypt.conf") or fs.stat("/etc/resolv-crypt.conf").size == 0 then btn2 = s:option(Button, "", translate("Create Custom Config File"), translate("Create '/etc/resolv-crypt.conf' with 'options timeout:1' to reduce DNS upstream timeouts with multiple DNSCrypt instances.<br />") .. translatef("For further information " diff --git a/applications/luci-app-dnscrypt-proxy/po/ru/dnscrypt-proxy.po b/applications/luci-app-dnscrypt-proxy/po/ru/dnscrypt-proxy.po index 385d81219c..4c340527f3 100644 --- a/applications/luci-app-dnscrypt-proxy/po/ru/dnscrypt-proxy.po +++ b/applications/luci-app-dnscrypt-proxy/po/ru/dnscrypt-proxy.po @@ -3,7 +3,7 @@ msgstr "" "Content-Type: text/plain; charset=UTF-8\n" "Project-Id-Version: LuCI: dnscrypt-proxy\n" "POT-Creation-Date: 2017-10-17 14:30+0300\n" -"PO-Revision-Date: 2018-01-06 14:20+0300\n" +"PO-Revision-Date: 2018-01-10 14:20+0300\n" "Language-Team: http://cyber-place.ru\n" "MIME-Version: 1.0\n" "Content-Transfer-Encoding: 8bit\n" @@ -14,7 +14,7 @@ msgstr "" "Language: ru\n" msgid "-------" -msgstr "" +msgstr "-------" msgid "Advanced" msgstr "Дополнительно" @@ -47,9 +47,9 @@ msgid "" "Create '/etc/resolv-crypt.conf' with 'options timeout:1' to reduce DNS " "upstream timeouts with multiple DNSCrypt instances.<br />" msgstr "" -"Создать конфиг файл '/etc/resolv-crypt.conf' с 'options timeout:1' для " -"уменьшения восходящих тайм-аутов DNS с многократными DNSCrypt instances.<br /" -">" +"Создать config файл /etc/resolv-crypt.none с 'options timeout:1' для " +"уменьшения тайм-аутов DNS внешней сети с многократными DNSCrypt instances." +"<br />" msgid "Create Config File" msgstr "Создать сonfig файл" @@ -78,8 +78,10 @@ msgstr "Отключить IPv6 для DNSCrypt-Proxy." msgid "Dnsmasq Options" msgstr "Настройка Dnsmasq" -msgid "Download the current resolver list from 'download.dnscrypt.org'." -msgstr "Скачать текущий список разрешенных серверов с 'download.dnscrypt.org'." +msgid "" +"Download the current resolver list from 'download.dnscrypt.org'." +msgstr "" +"Загрузить текущий список клиентов из 'download.dnscrypt.org'." msgid "Edit DNSCrypt-Proxy Configuration" msgstr "Настройка config файла DNSCrypt-Proxy" @@ -164,15 +166,15 @@ msgid "" "Please install a 'libustream-ssl' library to download the current resolver " "list from 'download.dnscrypt.org'." msgstr "" -"Пожалуйста установите 'libustream-openssl' для загрузки текущего списка " -"разрешенных серверов с 'download.dnscrypt.org'." +"Установите библиотеку 'libustream-ssl', чтобы скачать текущий список " +"клиентов с 'download.dnscrypt.org'." msgid "" "Please install a resolver list to '/usr/share/dnscrypt-proxy/dnscrypt-" "resolvers.csv' to use this package." msgstr "" -"Пожалуйста установите список разрешенных серверов в '/usr/share/dnscrypt-" -"proxy/dnscrypt-resolvers.csv' для использования данного сервиса." +"Пожалуйста установите список разрешенных серверов в /usr/share/dnscrypt-" +"proxy/dnscrypt-resolvers.csv для использования данного сервиса." msgid "" "Please note: This may change the values for 'noresolv', 'resolvfile', " @@ -197,13 +199,13 @@ msgid "Save" msgstr "Сохранить" msgid "Specify a non-default Resolver List." -msgstr "Специальный недефолтный список разрешенных серверов." +msgstr "Специальный не дефолтный список разрешенных серверов." msgid "Startup Trigger" msgstr "Выберите интерфейс" msgid "The config file '/etc/resolv-crypt.conf' already exist.<br />" -msgstr "Config файл '/etc/resolv-crypt.conf' уже существует.<br />" +msgstr "Config файл /etc/resolv-crypt.conf уже существует.<br />" msgid "The listening port for DNS queries." msgstr "Прослушивание порта для DNS запросов." |