Fixes & improvements

This commit is contained in:
gSpot
2025-03-01 18:31:36 +03:00
parent d94260e7ec
commit 55802f750f
18 changed files with 222 additions and 161 deletions

View File

@@ -15,22 +15,22 @@ Internet-detector is an application for checking the availability of the Interne
## Installation notes (OpenWrt >= 21.02) ## Installation notes (OpenWrt >= 21.02)
opkg update opkg update
wget --no-check-certificate -O /tmp/internet-detector_1.4.2-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.4.2-r1_all.ipk wget --no-check-certificate -O /tmp/internet-detector_1.4.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.4.3-r1_all.ipk
opkg install /tmp/internet-detector_1.4.2-r1_all.ipk opkg install /tmp/internet-detector_1.4.3-r1_all.ipk
rm /tmp/internet-detector_1.4.2-r1_all.ipk rm /tmp/internet-detector_1.4.3-r1_all.ipk
/etc/init.d/internet-detector start service internet-detector start
/etc/init.d/internet-detector enable service internet-detector enable
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.4.2-r2_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.4.2-r2_all.ipk wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.4.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.4.3-r1_all.ipk
opkg install /tmp/luci-app-internet-detector_1.4.2-r2_all.ipk opkg install /tmp/luci-app-internet-detector_1.4.3-r1_all.ipk
rm /tmp/luci-app-internet-detector_1.4.2-r2_all.ipk rm /tmp/luci-app-internet-detector_1.4.3-r1_all.ipk
/etc/init.d/rpcd restart service rpcd restart
i18n-ru: i18n-ru:
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.4.2-r2_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.4.2-r2_all.ipk wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.4.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.4.3-r1_all.ipk
opkg install /tmp/luci-i18n-internet-detector-ru_1.4.2-r2_all.ipk opkg install /tmp/luci-i18n-internet-detector-ru_1.4.3-r1_all.ipk
rm /tmp/luci-i18n-internet-detector-ru_1.4.2-r2_all.ipk rm /tmp/luci-i18n-internet-detector-ru_1.4.3-r1_all.ipk
## Screenshots: ## Screenshots:
@@ -42,10 +42,10 @@ i18n-ru:
**Dependences:** modemmanager. **Dependences:** modemmanager.
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.4.2-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.4.2-r1_all.ipk wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.4.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.4.3-r1_all.ipk
opkg install /tmp/internet-detector-mod-modem-restart_1.4.2-r1_all.ipk opkg install /tmp/internet-detector-mod-modem-restart_1.4.3-r1_all.ipk
rm /tmp/internet-detector-mod-modem-restart_1.4.2-r1_all.ipk rm /tmp/internet-detector-mod-modem-restart_1.4.3-r1_all.ipk
/etc/init.d/internet-detector restart service internet-detector restart
![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/04.jpg) ![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/04.jpg)
@@ -53,9 +53,9 @@ i18n-ru:
**Dependences:** mailsend. **Dependences:** mailsend.
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.4.2-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.4.2-r1_all.ipk wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.4.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.4.3-r1_all.ipk
opkg install /tmp/internet-detector-mod-email_1.4.2-r1_all.ipk opkg install /tmp/internet-detector-mod-email_1.4.3-r1_all.ipk
rm /tmp/internet-detector-mod-email_1.4.2-r1_all.ipk rm /tmp/internet-detector-mod-email_1.4.3-r1_all.ipk
/etc/init.d/internet-detector restart service internet-detector restart
![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/05.jpg) ![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/05.jpg)

View File

@@ -1,11 +1,11 @@
# #
# (с) 2024 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector) # (с) 2025 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector)
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector-mod-email PKG_NAME:=internet-detector-mod-email
PKG_VERSION:=1.4.2 PKG_VERSION:=1.4.3
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector> PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>

View File

@@ -142,7 +142,7 @@ function Module:sendMessage(msg, textPattern)
end end
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if not self._enabled then if not self._enabled then
return return
end end

View File

@@ -1,11 +1,11 @@
# #
# (с) 2024 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector) # (с) 2025 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector)
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector-mod-modem-restart PKG_NAME:=internet-detector-mod-modem-restart
PKG_VERSION:=1.4.2 PKG_VERSION:=1.4.3
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector> PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>

View File

@@ -80,7 +80,7 @@ function Module:init(t)
end end
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if not self._enabled then if not self._enabled then
return return
end end

View File

@@ -1,11 +1,11 @@
# #
# (с) 2024 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector) # (с) 2025 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector)
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector PKG_NAME:=internet-detector
PKG_VERSION:=1.4.2 PKG_VERSION:=1.4.3
PKG_RELEASE:=1 PKG_RELEASE:=1
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector> PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>

View File

@@ -8,7 +8,7 @@
luaposix luaposix
libuci-lua libuci-lua
(с) 2024 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector) (с) 2025 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector)
--]] --]]
local getopt = require("posix.unistd").getopt local getopt = require("posix.unistd").getopt

View File

@@ -268,7 +268,6 @@ function InternetDetector:TCPConnectionToHost(host, port)
io.stdout:write(string.format( io.stdout:write(string.format(
"SOCKET ERROR: %s, %s\n", errMsg, errNum)) "SOCKET ERROR: %s, %s\n", errMsg, errNum))
end end
unistd.close(sock) unistd.close(sock)
return retCode return retCode
end end
@@ -349,10 +348,12 @@ function InternetDetector:mainLoop()
signal.signal(signal.SIGUSR1, function(signo) self:resetUiCounter(signo) end) signal.signal(signal.SIGUSR1, function(signo) self:resetUiCounter(signo) end)
local lastStatus, currentStatus, mTimeNow, mTimeDiff, mLastTime, uiTimeNow, uiLastTime local lastStatus, currentStatus, mTimeNow, mTimeDiff, mLastTime, uiTimeNow, uiLastTime
local interval = self.serviceConfig.interval_up local interval = self.serviceConfig.interval_up
local counter = 0 local modulesStatus = {}
local onStart = true local counter = 0
_RUNNING = true local onStart = true
local inetChecked = false
_RUNNING = true
while _RUNNING do while _RUNNING do
if counter == 0 or counter >= interval then if counter == 0 or counter >= interval then
currentStatus = self:checkHosts() currentStatus = self:checkHosts()
@@ -377,11 +378,11 @@ function InternetDetector:mainLoop()
self:writeLogMessage("notice", "Disconnected") self:writeLogMessage("notice", "Disconnected")
end end
end end
counter = 0 counter = 0
end end
mTimeDiff = 0 mTimeDiff = 0
inetChecked = (counter == 0)
for _, e in ipairs(self.modules) do for _, e in ipairs(self.modules) do
mTimeNow = time.clock_gettime(time.CLOCK_MONOTONIC).tv_sec mTimeNow = time.clock_gettime(time.CLOCK_MONOTONIC).tv_sec
if mLastTime then if mLastTime then
@@ -390,16 +391,17 @@ function InternetDetector:mainLoop()
mTimeDiff = 1 mTimeDiff = 1
end end
mLastTime = mTimeNow mLastTime = mTimeNow
e:run(currentStatus, lastStatus, mTimeDiff, mTimeNow) e:run(currentStatus, lastStatus, mTimeDiff, mTimeNow, inetChecked)
end end
local modulesStatus = {} local modStatusChanged = false
for k, v in ipairs(self.modules) do for k, v in ipairs(self.modules) do
if v.status ~= nil then if modulesStatus[v.name] ~= v.status then
modulesStatus[v.name] = v.status modulesStatus[v.name] = v.status
modStatusChanged = true
end end
end end
if next(modulesStatus) then if modStatusChanged and next(modulesStatus) then
self:writeValueToFile(self.statusFile, self:statusJson( self:writeValueToFile(self.statusFile, self:statusJson(
currentStatus, self.serviceConfig.instance, modulesStatus)) currentStatus, self.serviceConfig.instance, modulesStatus))
end end

View File

@@ -140,7 +140,7 @@ function Module:ledRunFunc(t, currentStatus)
end end
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if not self._enabled then if not self._enabled then
return return
end end

View File

@@ -10,63 +10,68 @@ local Module = {
readValue = function(filePath) return nil end, readValue = function(filePath) return nil end,
deadPeriod = 900, deadPeriod = 900,
attempts = 1, attempts = 1,
iface = nil,
restartTimeout = 0, restartTimeout = 0,
status = nil, status = nil,
_attemptsCounter = 0, _attemptsCounter = 0,
_deadCounter = 0, _deadCounter = 0,
_networkRestarted = false,
_ifaceRestarting = false, _ifaceRestarting = false,
_ifaceRestartCounter = 0, _ifaceRestartCounter = 0,
_netIfaces = {},
_netDevices = {},
_netItemsNum = 0,
} }
function Module:toggleFunc(flag) function Module:toggleDevices(flag)
return if #self._netDevices == 0 then
end
function Module:toggleDevice(flag)
if not self.iface then
return return
end end
local ip = "/sbin/ip" local ip = "/sbin/ip"
if unistd.access(ip, "x") then if unistd.access(ip, "x") then
return os.execute(string.format( for _, v in ipairs(self._netDevices) do
"%s link set dev %s %s", ip, self.iface, (flag and "up" or "down")) os.execute(string.format("%s link set dev %s %s", ip, v, (flag and "up" or "down")))
) end
end end
end end
function Module:toggleIface(flag) function Module:toggleIfaces(flag)
if not self.iface then if #self._netIfaces == 0 then
return return
end end
return os.execute( for _, v in ipairs(self._netIfaces) do
string.format("%s %s", (flag and "/sbin/ifup" or "/sbin/ifdown"), self.iface) os.execute(string.format("%s %s", (flag and "/sbin/ifup" or "/sbin/ifdown"), v))
) end
end end
function Module:ifaceUp() function Module:netItemsUp()
self:toggleFunc(true) self:toggleDevices(true)
self:toggleIfaces(true)
end end
function Module:ifaceDown() function Module:netItemsDown()
self:toggleFunc(false) self:toggleIfaces(false)
self:toggleDevices(false)
end end
function Module:networkRestart() function Module:restartNetworkService()
return os.execute("/etc/init.d/network restart") return os.execute("/etc/init.d/network restart")
end end
function Module:init(t) function Module:init(t)
local iface = t.iface if t.ifaces ~= nil and type(t.ifaces) == "table" then
if iface then self._netIfaces = {}
self.iface = iface self._netDevices = {}
if self.iface:match("^@") then self._netItemsNum = 0
self.iface = self.iface:gsub("^@", "") for k, v in ipairs(t.ifaces) do
self.toggleFunc = self.toggleIface if v:match("^@") then
else self._netIfaces[#self._netIfaces + 1] = v:gsub("^@", "")
self.toggleFunc = self.toggleDevice else
self._netDevices[#self._netDevices + 1] = v
end
self._netItemsNum = self._netItemsNum + 1
end end
end end
if t.attempts ~= nil then if t.attempts ~= nil then
self.attempts = tonumber(t.attempts) self.attempts = tonumber(t.attempts)
end end
@@ -79,10 +84,34 @@ function Module:init(t)
self._attemptsCounter = self.attempts self._attemptsCounter = self.attempts
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:networkRestartFunc()
if self._netItemsNum > 0 then
if #self._netIfaces > 0 then
self.syslog("info", string.format("%s: restarting interfaces: %s",
self.name, table.concat(self._netIfaces, ", ")))
end
if #self._netDevices > 0 then
self.syslog("info", string.format("%s: restarting devices: %s",
self.name, table.concat(self._netDevices, ", ")))
end
self:netItemsDown()
if self.restartTimeout < 1 then
self:netItemsUp()
else
self._ifaceRestarting = true
end
else
self.syslog("info", string.format(
"%s: restarting network", self.name))
self:restartNetworkService()
end
self._attemptsCounter = self._attemptsCounter + 1
end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if self._ifaceRestarting then if self._ifaceRestarting then
if self._ifaceRestartCounter >= self.restartTimeout then if self._ifaceRestartCounter >= self.restartTimeout then
self:ifaceUp() self:netItemsUp()
self._ifaceRestarting = false self._ifaceRestarting = false
self._ifaceRestartCounter = 0 self._ifaceRestartCounter = 0
else else
@@ -90,31 +119,23 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
end end
else else
if currentStatus == 1 then if currentStatus == 1 then
if self._attemptsCounter < self.attempts then if not self._networkRestarted then
if self._deadCounter >= self.deadPeriod then if self._attemptsCounter < self.attempts then
if self.iface then if self._deadCounter >= self.deadPeriod then
self.syslog("info", string.format( self:networkRestartFunc()
"%s: restarting network interface '%s'", self.name, self.iface)) self._networkRestarted = true
self:ifaceDown() self._deadCounter = 0
if self.restartTimeout < 1 then
self:ifaceUp()
else
self._ifaceRestarting = true
end
else else
self.syslog("info", string.format( self._deadCounter = self._deadCounter + timeDiff
"%s: restarting network", self.name))
self:networkRestart()
end end
self._deadCounter = 0
self._attemptsCounter = self._attemptsCounter + 1
else
self._deadCounter = self._deadCounter + timeDiff
end end
elseif inetChecked and self._attemptsCounter < self.attempts then
self:networkRestartFunc()
end end
else else
self._attemptsCounter = 0 self._attemptsCounter = 0
self._deadCounter = 0 self._deadCounter = 0
self._networkRestarted = false
end end
self._ifaceRestartCounter = 0 self._ifaceRestartCounter = 0
end end

View File

@@ -256,7 +256,6 @@ function Module:decodeMessage(message)
if numAnswers > 0 then if numAnswers > 0 then
for answerCount = 1, numAnswers do for answerCount = 1, numAnswers do
if answerSectionStarts < #message then if answerSectionStarts < #message then
local ATYPE = tonumber( local ATYPE = tonumber(
message:sub(answerSectionStarts + 5, answerSectionStarts + 8), 16) message:sub(answerSectionStarts + 5, answerSectionStarts + 8), 16)
@@ -359,7 +358,7 @@ function Module:init(t)
self._enabled = true self._enabled = true
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if not self._enabled then if not self._enabled then
return return
end end
@@ -384,22 +383,16 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
if self._counter > 0 then if self._counter > 0 then
self:runIpScript() self:runIpScript()
end end
else
self.status = nil
end end
self._currentIp = ip self._currentIp = ip
self._counter = 0 self._counter = 0
else
self.status = nil
end end
else else
self.status = nil
self._currentIp = nil self._currentIp = nil
self.status = self._currentIp
self._counter = 0 self._counter = 0
self._interval = self.runInterval self._interval = self.runInterval
end end
self._counter = self._counter + timeDiff self._counter = self._counter + timeDiff
end end

View File

@@ -36,7 +36,7 @@ function Module:init(t)
end end
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if currentStatus == 1 then if currentStatus == 1 then
if not self._rebooted then if not self._rebooted then
if timeNow >= self.antiBootloopDelay and self._deadCounter >= self.deadPeriod then if timeNow >= self.antiBootloopDelay and self._deadCounter >= self.deadPeriod then

View File

@@ -1,6 +1,7 @@
local stdlib = require("posix.stdlib") local stdlib = require("posix.stdlib")
local unistd = require("posix.unistd") local unistd = require("posix.unistd")
local time = require("posix.time")
local Module = { local Module = {
name = "mod_regular_script", name = "mod_regular_script",
@@ -14,6 +15,7 @@ local Module = {
script = "", script = "",
status = nil, status = nil,
_nextTime = nil, _nextTime = nil,
_firstRun = true,
} }
function Module:runExternalScript(scriptPath, currentStatus) function Module:runExternalScript(scriptPath, currentStatus)
@@ -36,7 +38,7 @@ function Module:init(t)
end end
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if not self._nextTime then if not self._nextTime then
if timeNow < self.runInterval then if timeNow < self.runInterval then
self._nextTime = self.runInterval self._nextTime = self.runInterval
@@ -44,11 +46,16 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
self._nextTime = timeNow - (timeNow % self.runInterval) + self.runInterval self._nextTime = timeNow - (timeNow % self.runInterval) + self.runInterval
end end
end end
if self._firstRun then
self.status = time.strftime ("%Y-%m-%d %H:%M:%S %z", time.localtime(time.time() + self._nextTime - timeNow))
self._firstRun = false
end
if timeNow >= self._nextTime then if timeNow >= self._nextTime then
self._nextTime = self._nextTime + self.runInterval
if self.inetState == 2 or (self.inetState == 0 and currentStatus == 0) or (self.inetState == 1 and currentStatus == 1) then if self.inetState == 2 or (self.inetState == 0 and currentStatus == 0) or (self.inetState == 1 and currentStatus == 1) then
self.status = time.strftime ("%Y-%m-%d %H:%M:%S %z", time.localtime(time.time() + self._nextTime - timeNow))
self:runExternalScript(self.script, currentStatus) self:runExternalScript(self.script, currentStatus)
end end
self._nextTime = self._nextTime + self.runInterval
end end
end end

View File

@@ -40,7 +40,7 @@ function Module:init(t)
end end
end end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if currentStatus == 1 then if currentStatus == 1 then
self._aliveCounter = 0 self._aliveCounter = 0
self._upScriptExecuted = false self._upScriptExecuted = false

View File

@@ -1,12 +1,12 @@
# #
# (с) 2024 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector) # (с) 2025 gSpot (https://github.com/gSpotx2f/luci-app-internet-detector)
# #
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-internet-detector PKG_NAME:=luci-app-internet-detector
PKG_VERSION:=1.4.2 PKG_VERSION:=1.4.3
PKG_RELEASE:=2 PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for internet-detector LUCI_TITLE:=LuCI support for internet-detector
LUCI_DEPENDS:=+internet-detector LUCI_DEPENDS:=+internet-detector
LUCI_PKGARCH:=all LUCI_PKGARCH:=all

View File

@@ -134,24 +134,25 @@ var Timefield = ui.Textfield.extend({
}); });
return view.extend({ return view.extend({
appName : 'internet-detector', appName : 'internet-detector',
configDir : '/etc/internet-detector', configDir : '/etc/internet-detector',
pollInterval : L.env.pollinterval, pollInterval : L.env.pollinterval,
appStatus : 'stoped', appStatus : 'stoped',
initStatus : null, initStatus : null,
inetStatus : null, inetStatus : null,
inetStatusArea : E('div', { 'class': 'cbi-value-field', 'id': 'inetStatusArea' }), inetStatusArea : E('div', { 'class': 'cbi-value-field', 'id': 'inetStatusArea' }),
serviceStatusLabel : E('em', { 'id': 'serviceStatusLabel' }), serviceStatusLabel : E('em', { 'id': 'serviceStatusLabel' }),
initButton : null, initButton : null,
currentAppMode : '0', currentAppMode : '0',
defaultHosts : [ '8.8.8.8', '1.1.1.1' ], defaultHosts : [ '8.8.8.8', '1.1.1.1' ],
ledsPath : '/sys/class/leds', ledsPath : '/sys/class/leds',
ledsPerInstance : 3, ledsPerInstance : 3,
leds : [], leds : [],
mm : false, mm : false,
mmInit : false, mmInit : false,
email : false, email : false,
emailExec : false, emailExec : false,
modRegularScriptNextRun: {},
callInitStatus: rpc.declare({ callInitStatus: rpc.declare({
object: 'luci', object: 'luci',
@@ -273,6 +274,18 @@ return view.extend({
i.instance + ': ', status, publicIp) i.instance + ': ', status, publicIp)
) )
); );
if(i.mod_regular_script) {
this.modRegularScriptNextRun[i.instance] = i.mod_regular_script;
let nextRunLabel = document.getElementById('id_next_run_' + i.instance);
if(nextRunLabel) {
if(this.appStatus === 'running') {
nextRunLabel.innerHTML = this.modRegularScriptNextRun[i.instance];
} else {
nextRunLabel.innerHTML = _('Not scheduled');
};
};
};
}; };
}; };
@@ -670,8 +683,8 @@ return view.extend({
// iface // iface
o = s.taboption('main', widgets.DeviceSelect, o = s.taboption('main', widgets.DeviceSelect,
'iface', _('Interface'), 'iface', _('Device'),
_('Network interface for Internet access. If not specified, the default interface is used.') _('Network device for Internet access. If not specified, the default device is used.')
); );
o.noaliases = true; o.noaliases = true;
@@ -765,7 +778,7 @@ return view.extend({
// enabled // enabled
o = s.taboption('led_control', form.Flag, 'mod_led_control_enabled', o = s.taboption('led_control', form.Flag, 'mod_led_control_enabled',
_('Enabled')); _('Enabled'));
o.rmempty = false; o.rmempty = false;
o.modalonly = true; o.modalonly = true;
o = s.taboption('led_control', form.SectionValue, s.section, form.NamedSection, o = s.taboption('led_control', form.SectionValue, s.section, form.NamedSection,
@@ -827,7 +840,7 @@ return view.extend({
// enabled // enabled
o = s.taboption('reboot_device', form.Flag, 'mod_reboot_enabled', o = s.taboption('reboot_device', form.Flag, 'mod_reboot_enabled',
_('Enabled')); _('Enabled'));
o.rmempty = false; o.rmempty = false;
o.modalonly = true; o.modalonly = true;
// dead_period // dead_period
@@ -866,13 +879,13 @@ return view.extend({
// enabled // enabled
o = s.taboption('restart_network', form.Flag, 'mod_network_restart_enabled', o = s.taboption('restart_network', form.Flag, 'mod_network_restart_enabled',
_('Enabled')); _('Enabled'));
o.rmempty = false; o.rmempty = false;
o.modalonly = true; o.modalonly = true;
// dead_period // dead_period
o = s.taboption('restart_network', this.CBITimeInput, o = s.taboption('restart_network', this.CBITimeInput,
'mod_network_restart_dead_period', _('Dead period'), 'mod_network_restart_dead_period', _('Dead period'),
_('Period of time without Internet access before network restart or between restart attempts.') _('Period of time without Internet access before network restart.')
); );
o.default = '900'; o.default = '900';
o.rmempty = false; o.rmempty = false;
@@ -891,17 +904,18 @@ return view.extend({
o.value(5); o.value(5);
o.default = '1'; o.default = '1';
// iface // ifaces
o = s.taboption('restart_network', widgets.DeviceSelect, 'mod_network_restart_iface', o = s.taboption('restart_network', widgets.DeviceSelect, 'mod_network_restart_ifaces',
_('Interface'), _('Device'),
_('Network interface to restart. If not specified, then the network service is restarted.') _('Network device or interface to restart. If not specified, then the network service is restarted.')
); );
o.modalonly = true; o.modalonly = true;
o.multiple = true;
// restart_timeout // restart_timeout
o = s.taboption('restart_network', form.ListValue, o = s.taboption('restart_network', form.ListValue,
'mod_network_restart_restart_timeout', _('Restart timeout'), 'mod_network_restart_restart_timeout', _('Restart timeout'),
_('Timeout between stopping and starting the interface.') _('Timeout between stopping and starting a network device.')
); );
o.modalonly = true; o.modalonly = true;
o.value(0, '0 ' + _('sec')); o.value(0, '0 ' + _('sec'));
@@ -1065,7 +1079,7 @@ return view.extend({
// enabled // enabled
o = s.taboption('email', form.Flag, 'mod_email_enabled', o = s.taboption('email', form.Flag, 'mod_email_enabled',
_('Enabled')); _('Enabled'));
o.rmempty = false; o.rmempty = false;
o.modalonly = true; o.modalonly = true;
// mode // mode
@@ -1083,7 +1097,7 @@ return view.extend({
'mod_email_alive_period', _('Alive period'), 'mod_email_alive_period', _('Alive period'),
_('Period of time after connecting to the Internet before sending a message.') _('Period of time after connecting to the Internet before sending a message.')
); );
o.rmempty = false; o.rmempty = false;
o.modalonly = true; o.modalonly = true;
o.depends({ 'mod_email_mode': '0' }); o.depends({ 'mod_email_mode': '0' });
o.depends({ 'mod_email_mode': '2' }); o.depends({ 'mod_email_mode': '2' });
@@ -1094,7 +1108,7 @@ return view.extend({
'mod_email_dead_period', _('Dead period'), 'mod_email_dead_period', _('Dead period'),
_('Period of time after disconnecting from Internet before sending a message.') _('Period of time after disconnecting from Internet before sending a message.')
); );
o.rmempty = false; o.rmempty = false;
o.modalonly = true; o.modalonly = true;
o.depends({ 'mod_email_mode': '1' }); o.depends({ 'mod_email_mode': '1' });
o.depends({ 'mod_email_mode': '2' }); o.depends({ 'mod_email_mode': '2' });
@@ -1231,6 +1245,20 @@ return view.extend({
o.rmempty = false; o.rmempty = false;
o.modalonly = true; o.modalonly = true;
// next run
o = s.taboption('regular_script', form.DummyValue, '_dummy', _('Next run'));
o.rawhtml = true;
o.default = '<span id="id_next_run_' + s.section + '">' + (this.modRegularScriptNextRun[s.section] || _('Not scheduled')) + '</span>';
o.modalonly = true;
// interval
o = s.taboption('regular_script', this.CBITimeInput,
'mod_regular_script_interval', _('Run interval')
);
o.default = '3600';
o.rmempty = false;
o.modalonly = true;
// inet_state // inet_state
o = s.taboption('regular_script', form.ListValue, o = s.taboption('regular_script', form.ListValue,
'mod_regular_script_inet_state', _('Run if Internet state is') 'mod_regular_script_inet_state', _('Run if Internet state is')
@@ -1249,14 +1277,6 @@ return view.extend({
_('Shell commands that run regularly at a specified interval. Current state of the Internet is available as value of the <code>$INET_STATE</code> variable (<code>0</code> - connected, <code>1</code> - disconnected).') _('Shell commands that run regularly at a specified interval. Current state of the Internet is available as value of the <code>$INET_STATE</code> variable (<code>0</code> - connected, <code>1</code> - disconnected).')
); );
o.modalonly = true; o.modalonly = true;
// interval
o = s.taboption('regular_script', this.CBITimeInput,
'mod_regular_script_interval', _('Run interval')
);
o.default = '3600';
o.rmempty = false;
o.modalonly = true;
}; };
}; };

View File

@@ -83,6 +83,9 @@ msgstr "Период после отключения"
msgid "Default port value for TCP connections." msgid "Default port value for TCP connections."
msgstr "Стандартное значение порта для TCP-подключений." msgstr "Стандартное значение порта для TCP-подключений."
msgid "Device"
msgstr "Устройство"
msgid "Device will be rebooted when the Internet is disconnected." msgid "Device will be rebooted when the Internet is disconnected."
msgstr "Устройство будет перезагружено при отключении Интернет." msgstr "Устройство будет перезагружено при отключении Интернет."
@@ -255,24 +258,30 @@ msgstr ""
"ModemManger." "ModemManger."
msgid "" msgid ""
"Network interface for Internet access. If not specified, the default " "Network device for Internet access. If not specified, the default "
"interface is used." "device is used."
msgstr "" msgstr ""
"Сетевой интерфейс для доступа в Интернет. Если не указан, используется " "Сетевое устройство для доступа в Интернет. Если не указано, используется "
"интерфейс по умолчанию." "устройство по умолчанию."
msgid "" msgid ""
"Network interface to restart. If not specified, then the network service is restarted." "Network device or interface to restart. If not specified, then the network service is restarted."
msgstr "" msgstr ""
"Сетевой интерфейс для перезапуска. Если не задан, то будет перезапущена сетевая " "Сетевое устройство или интерфейс для перезапуска. Если не задано, то будет перезапущена сетевая "
"служба." "служба."
msgid "Network will be restarted when the Internet is disconnected." msgid "Network will be restarted when the Internet is disconnected."
msgstr "Сеть будет перезапущена при отключении Интернет." msgstr "Сеть будет перезапущена при отключении Интернет."
msgid "Next run"
msgstr "Следующий запуск"
msgid "No <abbr title=\"Light Emitting Diode\">LED</abbr>s available..." msgid "No <abbr title=\"Light Emitting Diode\">LED</abbr>s available..."
msgstr "Нет доступных <abbr title=\"Светодиод\">LED</abbr>..." msgstr "Нет доступных <abbr title=\"Светодиод\">LED</abbr>..."
msgid "Not scheduled"
msgstr "Не запланирован"
msgid "Off" msgid "Off"
msgstr "Выключить" msgstr "Выключить"
@@ -309,8 +318,8 @@ msgstr "Период времени отсутствия доступа в Ин
msgid "Period of time without Internet access before modem restart." msgid "Period of time without Internet access before modem restart."
msgstr "Период времени отсутствия доступа в Интренет перед перезапуском модема." msgstr "Период времени отсутствия доступа в Интренет перед перезапуском модема."
msgid "Period of time without Internet access before network restart or between restart attempts." msgid "Period of time without Internet access before network restart."
msgstr "Период времени отсутствия доступа в Интренет перед перезапуском сети или между попытками перезапуска." msgstr "Период времени отсутствия доступа в Интренет перед перезапуском сети."
msgid "" msgid ""
"Period of time without Internet access until the device is rebooted." "Period of time without Internet access until the device is rebooted."
@@ -440,8 +449,8 @@ msgstr "Тип записи запрашиваемой в DNS-запросе (е
msgid "TLS: use STARTTLS if the server supports it." msgid "TLS: use STARTTLS if the server supports it."
msgstr "TLS: использовать STARTTLS если сервер поддерживает." msgstr "TLS: использовать STARTTLS если сервер поддерживает."
msgid "Timeout between stopping and starting the interface." msgid "Timeout between stopping and starting a network device."
msgstr "Таймаут между остановкой и запуском интерфейса." msgstr "Таймаут между остановкой и запуском сетевого устройства."
msgid "Type a time string" msgid "Type a time string"
msgstr "Введите строку времени" msgstr "Введите строку времени"

View File

@@ -71,6 +71,9 @@ msgstr ""
msgid "Default port value for TCP connections." msgid "Default port value for TCP connections."
msgstr "" msgstr ""
msgid "Device"
msgstr ""
msgid "Device will be rebooted when the Internet is disconnected." msgid "Device will be rebooted when the Internet is disconnected."
msgstr "" msgstr ""
@@ -237,20 +240,26 @@ msgid ""
msgstr "" msgstr ""
msgid "" msgid ""
"Network interface for Internet access. If not specified, the default " "Network device for Internet access. If not specified, the default "
"interface is used." "interface is used."
msgstr "" msgstr ""
msgid "" msgid ""
"Network interface to restart. If not specified, then the network service is restarted." "Network device or interface to restart. If not specified, then the network service is restarted."
msgstr "" msgstr ""
msgid "Network will be restarted when the Internet is disconnected." msgid "Network will be restarted when the Internet is disconnected."
msgstr "" msgstr ""
msgid "Next run"
msgstr ""
msgid "No <abbr title=\"Light Emitting Diode\">LED</abbr>s available..." msgid "No <abbr title=\"Light Emitting Diode\">LED</abbr>s available..."
msgstr "" msgstr ""
msgid "Not scheduled"
msgstr ""
msgid "Off" msgid "Off"
msgstr "" msgstr ""
@@ -285,7 +294,7 @@ msgstr ""
msgid "Period of time without Internet access before modem restart." msgid "Period of time without Internet access before modem restart."
msgstr "" msgstr ""
msgid "Period of time without Internet access before network restart or between restart attempts." msgid "Period of time without Internet access before network restart."
msgstr "" msgstr ""
msgid "" msgid ""
@@ -415,7 +424,7 @@ msgstr ""
msgid "TLS: use STARTTLS if the server supports it." msgid "TLS: use STARTTLS if the server supports it."
msgstr "" msgstr ""
msgid "Timeout between stopping and starting the interface." msgid "Timeout between stopping and starting a network device."
msgstr "" msgstr ""
msgid "Type a time string" msgid "Type a time string"