summaryrefslogtreecommitdiffhomepage
path: root/applications/luci-app-ddns
diff options
context:
space:
mode:
Diffstat (limited to 'applications/luci-app-ddns')
-rw-r--r--applications/luci-app-ddns/Makefile6
-rwxr-xr-xapplications/luci-app-ddns/luasrc/controller/ddns.lua39
-rw-r--r--applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua41
-rwxr-xr-xapplications/luci-app-ddns/luasrc/tools/ddns.lua19
-rw-r--r--applications/luci-app-ddns/po/ru/ddns.po32
5 files changed, 84 insertions, 53 deletions
diff --git a/applications/luci-app-ddns/Makefile b/applications/luci-app-ddns/Makefile
index 69f9880d4f..50365e5215 100644
--- a/applications/luci-app-ddns/Makefile
+++ b/applications/luci-app-ddns/Makefile
@@ -2,7 +2,7 @@
# Copyright 2008 Steven Barth <steven@midlink.org>
# Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
# Copyright 2013 Manuel Munz <freifunk at somakoma dot de>
-# Copyright 2014-2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+# Copyright 2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
#
# This is free software, licensed under the Apache License, Version 2.0
@@ -12,11 +12,11 @@ include $(TOPDIR)/rules.mk
# Version == major.minor.patch
# increase on new functionality (minor) or patches (patch)
-PKG_VERSION:=2.4.8
+PKG_VERSION:=2.4.9
# Release == build
# increase on changes of translation files
-PKG_RELEASE:=2
+PKG_RELEASE:=1
PKG_LICENSE:=Apache-2.0
PKG_MAINTAINER:=Christian Schoenebeck <christian.schoenebeck@gmail.com>
diff --git a/applications/luci-app-ddns/luasrc/controller/ddns.lua b/applications/luci-app-ddns/luasrc/controller/ddns.lua
index 1dfa625541..3d31e4e0b6 100755
--- a/applications/luci-app-ddns/luasrc/controller/ddns.lua
+++ b/applications/luci-app-ddns/luasrc/controller/ddns.lua
@@ -1,7 +1,7 @@
-- Copyright 2008 Steven Barth <steven@midlink.org>
-- Copyright 2008 Jo-Philipp Wich <jow@openwrt.org>
-- Copyright 2013 Manuel Munz <freifunk at somakoma dot de>
--- Copyright 2014-2017 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+-- Copyright 2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
-- Licensed to the public under the Apache License 2.0.
module("luci.controller.ddns", package.seeall)
@@ -20,11 +20,11 @@ local DDNS = require "luci.tools.ddns" -- ddns multiused functions
luci_helper = "/usr/lib/ddns/dynamic_dns_lucihelper.sh"
local srv_name = "ddns-scripts"
-local srv_ver_min = "2.7.6" -- minimum version of service required
+local srv_ver_min = "2.7.7" -- minimum version of service required
local srv_ver_cmd = luci_helper .. [[ -V | awk {'print $2'}]]
local app_name = "luci-app-ddns"
local app_title = "Dynamic DNS"
-local app_version = "2.4.8-2"
+local app_version = "2.4.9-1"
function index()
local nxfs = require "nixio.fs" -- global definitions not available
@@ -187,19 +187,26 @@ local function _get_status()
-- try to get registered IP
local lookup_host = s["lookup_host"] or "_nolookup_"
- local dnsserver = s["dns_server"] or ""
- local force_ipversion = tonumber(s["force_ipversion"] or 0)
- local force_dnstcp = tonumber(s["force_dnstcp"] or 0)
- local is_glue = tonumber(s["is_glue"] or 0)
- local command = luci_helper .. [[ -]]
- if (use_ipv6 == 1) then command = command .. [[6]] end
- if (force_ipversion == 1) then command = command .. [[f]] end
- if (force_dnstcp == 1) then command = command .. [[t]] end
- if (is_glue == 1) then command = command .. [[g]] end
- command = command .. [[l ]] .. lookup_host
- if (#dnsserver > 0) then command = command .. [[ -d ]] .. dnsserver end
- command = command .. [[ -- get_registered_ip]]
- local reg_ip = SYS.exec(command)
+ local chk_sec = DDNS.calc_seconds(
+ tonumber(s["check_interval"]) or 10,
+ s["check_unit"] or "minutes" )
+ local reg_ip = DDNS.get_regip(section, chk_sec)
+ if reg_ip == "NOFILE" then
+ local dnsserver = s["dns_server"] or ""
+ local force_ipversion = tonumber(s["force_ipversion"] or 0)
+ local force_dnstcp = tonumber(s["force_dnstcp"] or 0)
+ local is_glue = tonumber(s["is_glue"] or 0)
+ local command = luci_helper .. [[ -]]
+ if (use_ipv6 == 1) then command = command .. [[6]] end
+ if (force_ipversion == 1) then command = command .. [[f]] end
+ if (force_dnstcp == 1) then command = command .. [[t]] end
+ if (is_glue == 1) then command = command .. [[g]] end
+ command = command .. [[l ]] .. lookup_host
+ command = command .. [[ -S ]] .. section
+ if (#dnsserver > 0) then command = command .. [[ -d ]] .. dnsserver end
+ command = command .. [[ -- get_registered_ip]]
+ reg_ip = SYS.exec(command)
+ end
if reg_ip == "" then
reg_ip = "_nodata_"
end
diff --git a/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua b/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua
index 6ba3ea0dd8..114f831c17 100644
--- a/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua
+++ b/applications/luci-app-ddns/luasrc/model/cbi/ddns/overview.lua
@@ -1,4 +1,4 @@
--- Copyright 2014-2016 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+-- Copyright 2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
-- Licensed to the public under the Apache License 2.0.
local NXFS = require "nixio.fs"
@@ -122,22 +122,29 @@ function dom.set_one(self, section)
end
end
function dom.set_two(self, section)
- local lookup_host = self.map:get(section, "lookup_host") or ""
- if lookup_host == "" then return "" end
- local dnsserver = self.map:get(section, "dnsserver") or ""
- local use_ipv6 = tonumber(self.map:get(section, "use_ipv6") or 0)
- local force_ipversion = tonumber(self.map:get(section, "force_ipversion") or 0)
- local force_dnstcp = tonumber(self.map:get(section, "force_dnstcp") or 0)
- local is_glue = tonumber(self.map:get(section, "is_glue") or 0)
- local command = CTRL.luci_helper .. [[ -]]
- if (use_ipv6 == 1) then command = command .. [[6]] end
- if (force_ipversion == 1) then command = command .. [[f]] end
- if (force_dnstcp == 1) then command = command .. [[t]] end
- if (is_glue == 1) then command = command .. [[g]] end
- command = command .. [[l ]] .. lookup_host
- if (#dnsserver > 0) then command = command .. [[ -d ]] .. dnsserver end
- command = command .. [[ -- get_registered_ip]]
- local ip = SYS.exec(command)
+ local chk_sec = DDNS.calc_seconds(
+ tonumber(self.map:get(section, "check_interval")) or 10,
+ self.map:get(section, "check_unit") or "minutes" )
+ local ip = DDNS.get_regip(section, chk_sec)
+ if ip == "NOFILE" then
+ local lookup_host = self.map:get(section, "lookup_host") or ""
+ if lookup_host == "" then return "" end
+ local dnsserver = self.map:get(section, "dnsserver") or ""
+ local use_ipv6 = tonumber(self.map:get(section, "use_ipv6") or 0)
+ local force_ipversion = tonumber(self.map:get(section, "force_ipversion") or 0)
+ local force_dnstcp = tonumber(self.map:get(section, "force_dnstcp") or 0)
+ local is_glue = tonumber(self.map:get(section, "is_glue") or 0)
+ local command = CTRL.luci_helper .. [[ -]]
+ if (use_ipv6 == 1) then command = command .. [[6]] end
+ if (force_ipversion == 1) then command = command .. [[f]] end
+ if (force_dnstcp == 1) then command = command .. [[t]] end
+ if (is_glue == 1) then command = command .. [[g]] end
+ command = command .. [[l ]] .. lookup_host
+ command = command .. [[ -S ]] .. section
+ if (#dnsserver > 0) then command = command .. [[ -d ]] .. dnsserver end
+ command = command .. [[ -- get_registered_ip]]
+ ip = SYS.exec(command)
+ end
if ip == "" then ip = translate("no data") end
return ip
end
diff --git a/applications/luci-app-ddns/luasrc/tools/ddns.lua b/applications/luci-app-ddns/luasrc/tools/ddns.lua
index 209d9c3a41..690b9b30ce 100755
--- a/applications/luci-app-ddns/luasrc/tools/ddns.lua
+++ b/applications/luci-app-ddns/luasrc/tools/ddns.lua
@@ -1,4 +1,4 @@
--- Copyright 2014-2016 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
+-- Copyright 2014-2018 Christian Schoenebeck <christian dot schoenebeck at gmail dot com>
-- Licensed to the public under the Apache License 2.0.
module("luci.tools.ddns", package.seeall)
@@ -74,6 +74,23 @@ function get_lastupd(section)
return etime
end
+-- read registered IP from [section].ip file
+function get_regip(section, chk_sec)
+ local uci = UCI.cursor()
+ local rdir = uci:get("ddns", "global", "ddns_rundir") or "/var/run/ddns"
+ local ip = "NOFILE"
+ if NXFS.access("%s/%s.ip" % { rdir, section }) then
+ local ftime = NXFS.stat("%s/%s.ip" % { rdir, section }, "ctime") or 0
+ local otime = os.time()
+ -- give ddns-scripts time (9 sec) to update file
+ if otime < (ftime + chk_sec + 9) then
+ ip = NXFS.readfile("%s/%s.ip" % { rdir, section })
+ end
+ end
+ uci:unload("ddns")
+ return ip
+end
+
-- read PID from run file and verify if still running
function get_pid(section)
local uci = UCI.cursor()
diff --git a/applications/luci-app-ddns/po/ru/ddns.po b/applications/luci-app-ddns/po/ru/ddns.po
index b9be300fbf..fae11275d3 100644
--- a/applications/luci-app-ddns/po/ru/ddns.po
+++ b/applications/luci-app-ddns/po/ru/ddns.po
@@ -3,7 +3,7 @@ msgstr ""
"Content-Type: text/plain; charset=UTF-8\n"
"Project-Id-Version: LuCI: ddns\n"
"POT-Creation-Date: 2017-10-17 21:00+0300\n"
-"PO-Revision-Date: 2018-01-14 11:45+0300\n"
+"PO-Revision-Date: 2018-01-24 14:58+0300\n"
"Language-Team: http://cyber-place.ru\n"
"MIME-Version: 1.0\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -64,14 +64,14 @@ msgid ""
"of default UDP when requesting DNS server!"
msgstr ""
"nslookup и hostip - BusyBox-а, не поддерживают указание использовать TCP "
-"вместо UDP по умолчанию при запросе DNS-сервера!"
+"вместо UDP по умолчанию при запросе DNS сервера!"
msgid ""
"BusyBox's nslookup in the current compiled version does not handle given DNS "
"Servers correctly!"
msgstr ""
"Благодаря текущей скомпилированной версии nslookup, BusyBox не обрабатывает "
-"данные Серверы DNS правильно!"
+"данные DNS сервера правильно!"
msgid "Casual users should not change this setting"
msgstr "Случайные пользователи, не должны изменять эти настройки"
@@ -83,13 +83,13 @@ msgid "Check Interval"
msgstr "Интервал проверки"
msgid "Collecting data..."
-msgstr "Сбор данных"
+msgstr "Сбор данных..."
msgid "Config error"
msgstr "Ошибка config файла"
msgid "Configuration"
-msgstr "Настройка"
+msgstr "Настройка config файла"
msgid ""
"Configure here the details for all Dynamic DNS services including this LuCI "
@@ -185,7 +185,7 @@ msgstr ""
"Задайте версию протокола IP-адреса 'IPv4/IPv6' отправляется провайдеру DDNS."
msgid "Details for"
-msgstr "Подробно"
+msgstr "Подробности для"
msgid "Directory contains Log files for each running section"
msgstr "Папка содержит файлы системного журнала для каждого запуска."
@@ -214,7 +214,7 @@ msgid "Enable secure communication with DDNS provider"
msgstr "Включить безопасное соединение с провайдером DDNS."
msgid "Enabled"
-msgstr "Включить"
+msgstr "Включено"
msgid "Error"
msgstr "Ошибка"
@@ -409,7 +409,7 @@ msgid "Lookup Hostname"
msgstr "Поиск имени хоста"
msgid "NOT installed"
-msgstr "Не установлено"
+msgstr "Не установлена"
msgid ""
"Neither GNU Wget with SSL nor cURL installed to select a network to use for "
@@ -469,7 +469,7 @@ msgstr "Необязательно: Прокси-сервер для обнар
msgid "OPTIONAL: Use non-default DNS-Server to detect 'Registered IP'."
msgstr ""
-"Необязательно: Использовать по умолчанию DNS-сервер, чтобы обнаружить "
+"Необязательно: Использовать по умолчанию DNS сервер, чтобы обнаружить "
"'Зарегистрированный IP-адрес'."
msgid "On Error the script will retry the failed action after given time"
@@ -511,7 +511,7 @@ msgid "Password"
msgstr "Пароль"
msgid "Path to CA-Certificate"
-msgstr "Путь к CA-Certificate"
+msgstr "Путь к CA-Сертификату"
msgid "Please [Save & Apply] your changes first"
msgstr "Нажмите [Сохранить и применить] чтобы сохранить ваши настройки."
@@ -556,7 +556,7 @@ msgid "Software update required"
msgstr "Требуется обновление программного обеспечения."
msgid "Specifying a DNS-Server is not supported"
-msgstr "Указанный DNS-сервер не поддерживается"
+msgstr "Указанный DNS сервер не поддерживается"
msgid "Start"
msgstr "Старт"
@@ -623,7 +623,7 @@ msgid "Username"
msgstr "Имя пользователя"
msgid "Using specific DNS Server not supported"
-msgstr "Использование определенного DNS-сервера не поддерживается."
+msgstr "Использование определенного DNS сервера не поддерживается."
msgid "Verify"
msgstr "Проверить"
@@ -658,7 +658,7 @@ msgid ""
"package, if you need to specify a DNS server to detect your registered IP."
msgstr ""
"Установите 'bind-host' или 'knot-host' или 'drill' или 'hostip' пакеты если "
-"вам нужно указать DNS-сервер для обнаружения вашего зарегистрированного IP-"
+"вам нужно указать DNS сервер для обнаружения вашего зарегистрированного IP-"
"адреса."
msgid ""
@@ -717,7 +717,7 @@ msgid "help"
msgstr "помощь"
msgid "hours"
-msgstr "часы"
+msgstr "часа(ов)"
msgid "installed"
msgstr "установлено"
@@ -735,7 +735,7 @@ msgid "minimum value 5 minutes == 300 seconds"
msgstr "минимальное значение 5 минут == 300 секунд"
msgid "minutes"
-msgstr "минуты"
+msgstr "минут(ы)"
msgid "missing / required"
msgstr "отсутствует / не требуется"
@@ -790,7 +790,7 @@ msgid "required"
msgstr "требовать"
msgid "seconds"
-msgstr "секунды"
+msgstr "секунд(ы)"
msgid "to run HTTPS without verification of server certificates (insecure)"
msgstr "использовать HTTPS без проверки сертификатов сервера (небезопасно)"