mod_network_restart, mod_modem_restart, mod_user_scripts: New option attempt_interval.

This commit is contained in:
gSpot
2025-06-08 16:15:58 +03:00
parent 75652f5e7d
commit 0e65c8a059
13 changed files with 288 additions and 180 deletions

View File

@@ -17,22 +17,22 @@ Internet-detector is an application for checking the availability of the Interne
## Installation notes: ## Installation notes:
opkg update opkg update
wget --no-check-certificate -O /tmp/internet-detector_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.5.0-r1_all.ipk wget --no-check-certificate -O /tmp/internet-detector_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.5.1-r1_all.ipk
opkg install /tmp/internet-detector_1.5.0-r1_all.ipk opkg install /tmp/internet-detector_1.5.1-r1_all.ipk
rm /tmp/internet-detector_1.5.0-r1_all.ipk rm /tmp/internet-detector_1.5.1-r1_all.ipk
service internet-detector start service internet-detector start
service internet-detector enable service internet-detector enable
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.5.0-r1_all.ipk wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.5.1-r1_all.ipk
opkg install /tmp/luci-app-internet-detector_1.5.0-r1_all.ipk opkg install /tmp/luci-app-internet-detector_1.5.1-r1_all.ipk
rm /tmp/luci-app-internet-detector_1.5.0-r1_all.ipk rm /tmp/luci-app-internet-detector_1.5.1-r1_all.ipk
service rpcd restart service rpcd restart
i18n-ru: i18n-ru:
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk
opkg install /tmp/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk opkg install /tmp/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk
rm /tmp/luci-i18n-internet-detector-ru_1.5.0-r1_all.ipk rm /tmp/luci-i18n-internet-detector-ru_1.5.1-r1_all.ipk
## Screenshots: ## Screenshots:
@@ -44,9 +44,9 @@ i18n-ru:
**Dependences:** modemmanager. **Dependences:** modemmanager.
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk
opkg install /tmp/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk opkg install /tmp/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk
rm /tmp/internet-detector-mod-modem-restart_1.5.0-r1_all.ipk rm /tmp/internet-detector-mod-modem-restart_1.5.1-r1_all.ipk
service 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)
@@ -55,9 +55,9 @@ i18n-ru:
**Dependences:** mailsend. **Dependences:** mailsend.
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.5.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.5.0-r1_all.ipk wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.5.1-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.5.1-r1_all.ipk
opkg install /tmp/internet-detector-mod-email_1.5.0-r1_all.ipk opkg install /tmp/internet-detector-mod-email_1.5.1-r1_all.ipk
rm /tmp/internet-detector-mod-email_1.5.0-r1_all.ipk rm /tmp/internet-detector-mod-email_1.5.1-r1_all.ipk
service 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

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector-mod-email PKG_NAME:=internet-detector-mod-email
PKG_VERSION:=1.5.0 PKG_VERSION:=1.5.1
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

@@ -5,7 +5,7 @@
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.5.0 PKG_VERSION:=1.5.1
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

@@ -5,27 +5,29 @@
local unistd = require("posix.unistd") local unistd = require("posix.unistd")
local Module = { local Module = {
name = "mod_modem_restart", name = "mod_modem_restart",
runPrio = 40, runPrio = 40,
config = {}, config = {},
syslog = function(level, msg) return true end, syslog = function(level, msg) return true end,
writeValue = function(filePath, str) return false end, writeValue = function(filePath, str) return false end,
readValue = function(filePath) return nil end, readValue = function(filePath) return nil end,
mmcli = "/usr/bin/mmcli", mmcli = "/usr/bin/mmcli",
mmInit = "/etc/init.d/modemmanager", mmInit = "/etc/init.d/modemmanager",
deadPeriod = 600, deadPeriod = 600,
attempts = 1, attempts = 1,
ifaceTimeout = 0, attemptInterval = 15,
iface = nil, ifaceTimeout = 0,
anyBand = false, iface = nil,
status = nil, anyBand = false,
_enabled = false, status = nil,
_attemptsCounter = 0, _enabled = false,
_deadCounter = 0, _attemptsCounter = 0,
_modemRestarted = false, _attemptIntervalCounter = 0,
_ifaceRestarting = false, _deadCounter = 0,
_ifaceRestartCounter = 0, _firstAttempt = true,
_disconnectedAtStartup = false, _ifaceRestarting = false,
_ifaceRestartCounter = 0,
_disconnectedAtStartup = false,
} }
function Module:toggleIface(flag) function Module:toggleIface(flag)
@@ -38,11 +40,14 @@ function Module:toggleIface(flag)
end end
function Module:init(t) function Module:init(t)
if t.dead_period ~= nil then
self.deadPeriod = tonumber(t.dead_period)
end
if t.attempts ~= nil then if t.attempts ~= nil then
self.attempts = tonumber(t.attempts) self.attempts = tonumber(t.attempts)
end end
if t.dead_period ~= nil then if t.attempt_interval ~= nil then
self.deadPeriod = tonumber(t.dead_period) self.attemptInterval = tonumber(t.attempt_interval)
end end
if t.iface ~= nil then if t.iface ~= nil then
self.iface = t.iface self.iface = t.iface
@@ -115,24 +120,25 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
end end
else else
if currentStatus == 1 then if currentStatus == 1 then
if not self._modemRestarted then if self._disconnectedAtStartup and self._deadCounter >= self.deadPeriod then
if self._disconnectedAtStartup and (self.attempts == 0 or self._attemptsCounter < self.attempts) then if self.attempts == 0 or self._attemptsCounter < self.attempts then
if self._deadCounter >= self.deadPeriod then if self._firstAttempt or self._attemptIntervalCounter >= self.attemptInterval then
self:restartMM() self:restartMM()
self._modemRestarted = true self._attemptIntervalCounter = 0
self._deadCounter = 0 self._firstAttempt = false
else else
self._deadCounter = self._deadCounter + timeDiff self._attemptIntervalCounter = self._attemptIntervalCounter + timeDiff
end end
end end
elseif inetChecked and (self.attempts == 0 or self._attemptsCounter < self.attempts) then else
self:restartMM() self._deadCounter = self._deadCounter + timeDiff
end end
else else
self._attemptsCounter = 0 self._attemptsCounter = 0
self._deadCounter = 0 self._attemptIntervalCounter = 0
self._disconnectedAtStartup = true self._deadCounter = 0
self._modemRestarted = false self._disconnectedAtStartup = true
self._firstAttempt = true
end end
self._ifaceRestartCounter = 0 self._ifaceRestartCounter = 0
end end

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector PKG_NAME:=internet-detector
PKG_VERSION:=1.5.0 PKG_VERSION:=1.5.1
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

@@ -22,11 +22,13 @@ config instance 'internet'
option mod_network_restart_disconnected_at_startup '0' option mod_network_restart_disconnected_at_startup '0'
option mod_network_restart_dead_period '900' option mod_network_restart_dead_period '900'
option mod_network_restart_attempts '1' option mod_network_restart_attempts '1'
option mod_network_restart_restart_timeout '0' option mod_network_restart_attempt_interval '15'
option mod_network_restart_device_timeout '0'
option mod_modem_restart_enabled '0' option mod_modem_restart_enabled '0'
option mod_modem_restart_disconnected_at_startup '0' option mod_modem_restart_disconnected_at_startup '0'
option mod_modem_restart_dead_period '600' option mod_modem_restart_dead_period '600'
option mod_modem_restart_attempts '1' option mod_modem_restart_attempts '1'
option mod_modem_restart_attempt_interval '15'
option mod_modem_restart_iface_timeout '0' option mod_modem_restart_iface_timeout '0'
option mod_modem_restart_any_band '0' option mod_modem_restart_any_band '0'
option mod_public_ip_enabled '0' option mod_public_ip_enabled '0'
@@ -45,9 +47,11 @@ config instance 'internet'
option mod_user_scripts_enabled '0' option mod_user_scripts_enabled '0'
option mod_user_scripts_alive_period '0' option mod_user_scripts_alive_period '0'
option mod_user_scripts_up_script_attempts '1' option mod_user_scripts_up_script_attempts '1'
option mod_user_scripts_up_script_attempt_interval '15'
option mod_user_scripts_connected_at_startup '0' option mod_user_scripts_connected_at_startup '0'
option mod_user_scripts_dead_period '0' option mod_user_scripts_dead_period '0'
option mod_user_scripts_down_script_attempts '1' option mod_user_scripts_down_script_attempts '1'
option mod_user_scripts_down_script_attempt_interval '15'
option mod_user_scripts_disconnected_at_startup '0' option mod_user_scripts_disconnected_at_startup '0'
option mod_regular_script_enabled '0' option mod_regular_script_enabled '0'
option mod_regular_script_inet_state '2' option mod_regular_script_inet_state '2'

View File

@@ -2,25 +2,27 @@
local unistd = require("posix.unistd") local unistd = require("posix.unistd")
local Module = { local Module = {
name = "mod_network_restart", name = "mod_network_restart",
runPrio = 30, runPrio = 30,
config = {}, config = {},
syslog = function(level, msg) return true end, syslog = function(level, msg) return true end,
writeValue = function(filePath, str) return false end, writeValue = function(filePath, str) return false end,
readValue = function(filePath) return nil end, readValue = function(filePath) return nil end,
deadPeriod = 900, deadPeriod = 900,
attempts = 1, attempts = 1,
restartTimeout = 0, attemptInterval = 15,
status = nil, deviceTimeout = 0,
_attemptsCounter = 0, status = nil,
_deadCounter = 0, _attemptsCounter = 0,
_networkRestarted = false, _attemptIntervalCounter = 0,
_ifaceRestarting = false, _deadCounter = 0,
_ifaceRestartCounter = 0, _firstAttempt = true,
_netIfaces = {}, _ifaceRestarting = false,
_netDevices = {}, _ifaceRestartCounter = 0,
_netItemsNum = 0, _netIfaces = {},
_disconnectedAtStartup = false, _netDevices = {},
_netItemsNum = 0,
_disconnectedAtStartup = false,
} }
function Module:toggleDevices(flag) function Module:toggleDevices(flag)
@@ -72,15 +74,17 @@ function Module:init(t)
self._netItemsNum = self._netItemsNum + 1 self._netItemsNum = self._netItemsNum + 1
end end
end end
if t.attempts ~= nil then
self.attempts = tonumber(t.attempts)
end
if t.dead_period ~= nil then if t.dead_period ~= nil then
self.deadPeriod = tonumber(t.dead_period) self.deadPeriod = tonumber(t.dead_period)
end end
if t.restart_timeout ~= nil then if t.attempts ~= nil then
self.restartTimeout = tonumber(t.restart_timeout) self.attempts = tonumber(t.attempts)
end
if t.attempt_interval ~= nil then
self.attemptInterval = tonumber(t.attempt_interval)
end
if t.device_timeout ~= nil then
self.deviceTimeout = tonumber(t.device_timeout)
end end
if tonumber(t.disconnected_at_startup) == 1 then if tonumber(t.disconnected_at_startup) == 1 then
self._disconnectedAtStartup = true self._disconnectedAtStartup = true
@@ -98,7 +102,7 @@ function Module:networkRestartFunc()
self.name, table.concat(self._netDevices, ", "))) self.name, table.concat(self._netDevices, ", ")))
end end
self:netItemsDown() self:netItemsDown()
if self.restartTimeout < 1 then if self.deviceTimeout < 1 then
self:netItemsUp() self:netItemsUp()
else else
self._ifaceRestarting = true self._ifaceRestarting = true
@@ -115,7 +119,7 @@ end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked) 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.deviceTimeout then
self:netItemsUp() self:netItemsUp()
self._ifaceRestarting = false self._ifaceRestarting = false
self._ifaceRestartCounter = 0 self._ifaceRestartCounter = 0
@@ -124,24 +128,25 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
end end
else else
if currentStatus == 1 then if currentStatus == 1 then
if not self._networkRestarted then if self._disconnectedAtStartup and self._deadCounter >= self.deadPeriod then
if self._disconnectedAtStartup and (self.attempts == 0 or self._attemptsCounter < self.attempts) then if self.attempts == 0 or self._attemptsCounter < self.attempts then
if self._deadCounter >= self.deadPeriod then if self._firstAttempt or self._attemptIntervalCounter >= self.attemptInterval then
self:networkRestartFunc() self:networkRestartFunc()
self._networkRestarted = true self._attemptIntervalCounter = 0
self._deadCounter = 0 self._firstAttempt = false
else else
self._deadCounter = self._deadCounter + timeDiff self._attemptIntervalCounter = self._attemptIntervalCounter + timeDiff
end end
end end
elseif inetChecked and (self.attempts == 0 or self._attemptsCounter < self.attempts) then else
self:networkRestartFunc() self._deadCounter = self._deadCounter + timeDiff
end end
else else
self._attemptsCounter = 0 self._attemptsCounter = 0
self._deadCounter = 0 self._attemptIntervalCounter = 0
self._disconnectedAtStartup = true self._deadCounter = 0
self._networkRestarted = false self._disconnectedAtStartup = true
self._firstAttempt = true
end end
self._ifaceRestartCounter = 0 self._ifaceRestartCounter = 0
end end

View File

@@ -2,27 +2,31 @@
local unistd = require("posix.unistd") local unistd = require("posix.unistd")
local Module = { local Module = {
name = "mod_user_scripts", name = "mod_user_scripts",
runPrio = 80, runPrio = 80,
config = {}, config = {},
syslog = function(level, msg) return true end, syslog = function(level, msg) return true end,
writeValue = function(filePath, str) return false end, writeValue = function(filePath, str) return false end,
readValue = function(filePath) return nil end, readValue = function(filePath) return nil end,
deadPeriod = 0, deadPeriod = 0,
alivePeriod = 0, alivePeriod = 0,
upScript = "", upScript = "",
downScript = "", downScript = "",
upScriptAttempts = 1, upScriptAttempts = 1,
downScriptAttempts = 1, upScriptAttemptInterval = 15,
status = nil, downScriptAttempts = 1,
_deadCounter = 0, downScriptAttemptInterval = 15,
_aliveCounter = 0, status = nil,
_upScriptAttemptsCounter = 0, _deadCounter = 0,
_downScriptAttemptsCounter = 0, _aliveCounter = 0,
_upScriptExecuted = false, _upScriptAttemptsCounter = 0,
_downScriptExecuted = false, _upScriptAttemptIntervalCounter = 0,
_disconnectedAtStartup = false, _downScriptAttemptsCounter = 0,
_connectedAtStartup = false, _downScriptAttemptIntervalCounter = 0,
_upScriptFirstAttempt = true,
_downScriptFirstAttempt = true,
_disconnectedAtStartup = false,
_connectedAtStartup = false,
} }
function Module:runExternalScript(scriptPath) function Module:runExternalScript(scriptPath)
@@ -41,9 +45,15 @@ function Module:init(t)
if t.up_script_attempts ~= nil then if t.up_script_attempts ~= nil then
self.upScriptAttempts = tonumber(t.up_script_attempts) self.upScriptAttempts = tonumber(t.up_script_attempts)
end end
if t.up_script_attempt_interval ~= nil then
self.upScriptAttemptInterval = tonumber(t.up_script_attempt_interval)
end
if t.down_script_attempts ~= nil then if t.down_script_attempts ~= nil then
self.downScriptAttempts = tonumber(t.down_script_attempts) self.downScriptAttempts = tonumber(t.down_script_attempts)
end end
if t.down_script_attempt_interval ~= nil then
self.downScriptAttemptInterval = tonumber(t.down_script_attempt_interval)
end
if self.config.configDir then if self.config.configDir then
self.upScript = string.format( self.upScript = string.format(
"%s/up-script.%s", self.config.configDir, self.config.serviceConfig.instance) "%s/up-script.%s", self.config.configDir, self.config.serviceConfig.instance)
@@ -74,41 +84,44 @@ end
function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked) function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
if currentStatus == 1 then if currentStatus == 1 then
self._upScriptAttemptsCounter = 0 self._upScriptAttemptsCounter = 0
self._aliveCounter = 0 self._upScriptAttemptIntervalCounter = 0
self._connectedAtStartup = true self._aliveCounter = 0
self._upScriptExecuted = false self._connectedAtStartup = true
if not self._downScriptExecuted then self._upScriptFirstAttempt = true
if self._disconnectedAtStartup and (self.downScriptAttempts == 0 or self._downScriptAttemptsCounter < self.downScriptAttempts) then
if self._deadCounter >= self.deadPeriod then if self._disconnectedAtStartup and self._deadCounter >= self.deadPeriod then
if self.downScriptAttempts == 0 or self._downScriptAttemptsCounter < self.downScriptAttempts then
if self._downScriptFirstAttempt or self._downScriptAttemptIntervalCounter >= self.downScriptAttemptInterval then
self:runDownScriptFunc() self:runDownScriptFunc()
self._downScriptExecuted = true self._downScriptAttemptIntervalCounter = 0
self._deadCounter = 0 self._downScriptFirstAttempt = false
else else
self._deadCounter = self._deadCounter + timeDiff self._downScriptAttemptIntervalCounter = self._downScriptAttemptIntervalCounter + timeDiff
end end
end end
else
elseif inetChecked and (self.downScriptAttempts == 0 or self._downScriptAttemptsCounter < self.downScriptAttempts) then self._deadCounter = self._deadCounter + timeDiff
self:runDownScriptFunc()
end end
elseif currentStatus == 0 then elseif currentStatus == 0 then
self._downScriptAttemptsCounter = 0 self._downScriptAttemptsCounter = 0
self._deadCounter = 0 self._downScriptAttemptIntervalCounter = 0
self._disconnectedAtStartup = true self._deadCounter = 0
self._downScriptExecuted = false self._disconnectedAtStartup = true
if not self._upScriptExecuted then self._downScriptFirstAttempt = true
if self._connectedAtStartup and (self.upScriptAttempts == 0 or self._upScriptAttemptsCounter < self.upScriptAttempts) then
if self._aliveCounter >= self.alivePeriod then if self._connectedAtStartup and self._aliveCounter >= self.alivePeriod then
if self.upScriptAttempts == 0 or self._upScriptAttemptsCounter < self.upScriptAttempts then
if self._upScriptFirstAttempt or self._upScriptAttemptIntervalCounter >= self.upScriptAttemptInterval then
self:runUpScriptFunc() self:runUpScriptFunc()
self._upScriptExecuted = true self._upScriptAttemptIntervalCounter = 0
self._aliveCounter = 0 self._upScriptFirstAttempt = false
else else
self._aliveCounter = self._aliveCounter + timeDiff self._upScriptAttemptIntervalCounter = self._upScriptAttemptIntervalCounter + timeDiff
end end
end end
elseif inetChecked and (self.upScriptAttempts == 0 or self._upScriptAttemptsCounter < self.upScriptAttempts) then else
self:runUpScriptFunc() self._aliveCounter = self._aliveCounter + timeDiff
end end
end end
end end

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-internet-detector PKG_NAME:=luci-app-internet-detector
PKG_VERSION:=1.5.0 PKG_VERSION:=1.5.1
PKG_RELEASE:=1 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

View File

@@ -56,6 +56,7 @@ document.head.append(E('style', {'type': 'text/css'},
-moz-border-radius: 4px; -moz-border-radius: 4px;
border-radius: 4px; border-radius: 4px;
font-weight: bold; font-weight: bold;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
} }
`)); `));
@@ -593,7 +594,7 @@ return view.extend({
mode.default = '0'; mode.default = '0';
/* Service instances configuration */ /* Instances configuration */
if(this.currentAppMode !== '2') { if(this.currentAppMode !== '2') {
@@ -608,7 +609,7 @@ return view.extend({
s = m.section(form.GridSection, 'instance'); s = m.section(form.GridSection, 'instance');
s.title = _('Service instances'); s.title = _('Instances');
s.addremove = true; s.addremove = true;
s.sortable = true; s.sortable = true;
s.nodescriptions = true; s.nodescriptions = true;
@@ -830,11 +831,11 @@ return view.extend({
// Reboot device // Reboot device
o = s.taboption('reboot_device', form.DummyValue, '_dummy'); o = s.taboption('reboot_device', form.DummyValue, '_dummy');
o.rawhtml = true; o.rawhtml = true;
o.default = '<div class="cbi-section-descr">' + o.default = '<div class="cbi-section-descr">' +
_('Device will be rebooted when the Internet is disconnected.') + _('Device will be rebooted when the Internet is disconnected.') +
'</div>'; '</div>';
o.modalonly = true; o.modalonly = true;
// enabled // enabled
@@ -921,10 +922,19 @@ return view.extend({
o.value(0, _('infinitely')); o.value(0, _('infinitely'));
o.default = '1'; o.default = '1';
// restart_timeout // attempt_interval
o = s.taboption('restart_network', this.CBITimeInput,
'mod_network_restart_attempt_interval', _('Attempt interval'),
_('Interval between network restarts.')
);
o.default = '15';
o.rmempty = false;
o.modalonly = true;
// device_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_device_timeout', _('Device timeout'),
_('Timeout between stopping and starting a network device.') _('Timeout between stopping and starting a network device when restarting.')
); );
o.modalonly = true; o.modalonly = true;
o.value(0, '0 ' + _('sec')); o.value(0, '0 ' + _('sec'));
@@ -998,6 +1008,15 @@ return view.extend({
o.value(0, _('infinitely')); o.value(0, _('infinitely'));
o.default = '1'; o.default = '1';
// attempt_interval
o = s.taboption('restart_modem', this.CBITimeInput,
'mod_modem_restart_attempt_interval', _('Attempt interval'),
_('Interval between modem restarts.')
);
o.default = '15';
o.rmempty = false;
o.modalonly = true;
// iface // iface
o = s.taboption('restart_modem', widgets.NetworkSelect, 'mod_modem_restart_iface', o = s.taboption('restart_modem', widgets.NetworkSelect, 'mod_modem_restart_iface',
_('Interface'), _('Interface'),
@@ -1010,7 +1029,7 @@ return view.extend({
// iface_timeout // iface_timeout
o = s.taboption('restart_modem', form.ListValue, o = s.taboption('restart_modem', form.ListValue,
'mod_modem_restart_iface_timeout', _('Interface timeout'), 'mod_modem_restart_iface_timeout', _('Interface timeout'),
_('Timeout between stopping and starting a ModemManger interface.') _('Timeout between stopping and starting a ModemManger interface when restarting.')
); );
o.modalonly = true; o.modalonly = true;
o.value(0, '0 ' + _('sec')); o.value(0, '0 ' + _('sec'));
@@ -1152,11 +1171,11 @@ return view.extend({
if(this.email) { if(this.email) {
if(this.emailExec) { if(this.emailExec) {
o = s.taboption('email', form.DummyValue, '_dummy'); o = s.taboption('email', form.DummyValue, '_dummy');
o.rawhtml = true; o.rawhtml = true;
o.default = '<div class="cbi-section-descr">' + o.default = '<div class="cbi-section-descr">' +
_('An email will be sent when connected or disconnected from the Internet.') + _('An email will be sent when connected or disconnected from the Internet.') +
'</div>'; '</div>';
o.modalonly = true; o.modalonly = true;
// enabled // enabled
@@ -1272,11 +1291,11 @@ return view.extend({
// User scripts // User scripts
o = s.taboption('user_scripts', form.DummyValue, '_dummy'); o = s.taboption('user_scripts', form.DummyValue, '_dummy');
o.rawhtml = true; o.rawhtml = true;
o.default = '<div class="cbi-section-descr">' + o.default = '<div class="cbi-section-descr">' +
_('Shell commands to run when connected or disconnected from the Internet.') + _('Shell commands to run when connected or disconnected from the Internet.') +
'</div>'; '</div>';
o.modalonly = true; o.modalonly = true;
// enabled // enabled
@@ -1318,6 +1337,15 @@ return view.extend({
o.value(0, _('infinitely')); o.value(0, _('infinitely'));
o.default = '1'; o.default = '1';
// up_script_attempt_interval
o = s.taboption('user_scripts', this.CBITimeInput,
'mod_user_scripts_up_script_attempt_interval', _('up_script attempt interval'),
_('Interval between up-script runs.')
);
o.default = '15';
o.rmempty = false;
o.modalonly = true;
// connected_at_startup // connected_at_startup
o = s.taboption('user_scripts', form.Flag, 'mod_user_scripts_connected_at_startup', o = s.taboption('user_scripts', form.Flag, 'mod_user_scripts_connected_at_startup',
_('On startup'), _('On startup'),
@@ -1359,6 +1387,15 @@ return view.extend({
o.value(0, _('infinitely')); o.value(0, _('infinitely'));
o.default = '1'; o.default = '1';
// down_script_attempt_interval
o = s.taboption('user_scripts', this.CBITimeInput,
'mod_user_scripts_down_script_attempt_interval', _('down-script attempt interval'),
_('Interval between down-script runs.')
);
o.default = '15';
o.rmempty = false;
o.modalonly = true;
// disconnected_at_startup // disconnected_at_startup
o = s.taboption('user_scripts', form.Flag, 'mod_user_scripts_disconnected_at_startup', o = s.taboption('user_scripts', form.Flag, 'mod_user_scripts_disconnected_at_startup',
_('On startup'), _('On startup'),

View File

@@ -51,14 +51,15 @@ document.head.append(E('style', {'type': 'text/css'},
-moz-border-radius: 4px; -moz-border-radius: 4px;
border-radius: 4px; border-radius: 4px;
font-weight: bold; font-weight: bold;
box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
} }
`)); `));
return baseclass.extend({ return baseclass.extend({
title : _('Internet'), title : _('Internet'),
appName : 'internet-detector', appName : 'internet-detector',
currentAppMode : null, currentAppMode : null,
inetStatus : null, inetStatus : null,
callUIPoll: rpc.declare({ callUIPoll: rpc.declare({
object: 'luci.internet-detector', object: 'luci.internet-detector',

View File

@@ -44,6 +44,9 @@ msgstr "Сообщение будет отправлено при подключ
msgid "An error has occurred" msgid "An error has occurred"
msgstr "Произошла ошибка" msgstr "Произошла ошибка"
msgid "Attempt interval"
msgstr "Интервал попыток"
msgid "Attempts" msgid "Attempts"
msgstr "Попытки" msgstr "Попытки"
@@ -198,6 +201,9 @@ msgstr "Запрос ICMP-echo (ping)"
msgid "ICMP packet data size" msgid "ICMP packet data size"
msgstr "Размер данных ICMP-пакета" msgstr "Размер данных ICMP-пакета"
msgid "Instances"
msgstr "Экземпляры"
msgid "Interface" msgid "Interface"
msgstr "Интерфейс" msgstr "Интерфейс"
@@ -222,6 +228,18 @@ msgstr "Интервал между запросами IP адреса."
msgid "Interval between IP address requests if the IP address is not defined." msgid "Interval between IP address requests if the IP address is not defined."
msgstr "Интервал между запросами IP адреса, если IP адрес не определён." msgstr "Интервал между запросами IP адреса, если IP адрес не определён."
msgid "Interval between modem restarts."
msgstr "Интервал между перезапусками модема."
msgid "Interval between network restarts."
msgstr "Интервал между перезапусками сети."
msgid "Interval between down-script runs."
msgstr "Интервал между запусками down-script."
msgid "Interval between up-script runs."
msgstr "Интервал между запусками up-script."
msgid "Jumbo: 9000 bytes" msgid "Jumbo: 9000 bytes"
msgstr "Гигантский: 9000 байт" msgstr "Гигантский: 9000 байт"
@@ -391,8 +409,8 @@ msgstr "Перезапуск сети если Интренет отключен
msgid "Restart service" msgid "Restart service"
msgstr "Перезапуск службы" msgstr "Перезапуск службы"
msgid "Restart timeout" msgid "Device timeout"
msgstr "Таймаут перезапуска" msgstr "Таймаут устройства"
msgid "Run interval" msgid "Run interval"
msgstr "Интервал запуска" msgstr "Интервал запуска"
@@ -451,9 +469,6 @@ msgstr "Сервис для определения публичного IP ад
msgid "Service: detector always runs as a system service." msgid "Service: detector always runs as a system service."
msgstr "Служба: детектор работает постоянно, как системная служба." msgstr "Служба: детектор работает постоянно, как системная служба."
msgid "Service instances"
msgstr "Экземпляры службы"
msgid "Set the modem to be allowed to use any band." msgid "Set the modem to be allowed to use any band."
msgstr "Разрешить модему использование любой частоты." msgstr "Разрешить модему использование любой частоты."
@@ -496,11 +511,11 @@ 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 a network device." msgid "Timeout between stopping and starting a network device when restarting."
msgstr "Таймаут между остановкой и запуском сетевого устройства." msgstr "Таймаут между остановкой и запуском сетевого устройства при перезапуске."
msgid "Timeout between stopping and starting a ModemManger interface." msgid "Timeout between stopping and starting a ModemManger interface when restarting."
msgstr "Таймаут между остановкой и запуском интерфейса ModemManger." msgstr "Таймаут между остановкой и запуском интерфейса ModemManger при перезапуске."
msgid "Type a time string" msgid "Type a time string"
msgstr "Введите строку времени" msgstr "Введите строку времени"
@@ -599,5 +614,11 @@ msgstr "up-script"
msgid "down-script attempts" msgid "down-script attempts"
msgstr "Попытки down-script" msgstr "Попытки down-script"
msgid "down-script attempt interval"
msgstr "Интервал попыток down-script"
msgid "up-script attempts" msgid "up-script attempts"
msgstr "Попытки up-script" msgstr "Попытки up-script"
msgid "up_script attempt interval"
msgstr "Интервал попыток up_script"

View File

@@ -32,6 +32,9 @@ msgstr ""
msgid "An error has occurred" msgid "An error has occurred"
msgstr "" msgstr ""
msgid "Attempt interval"
msgstr ""
msgid "Attempts" msgid "Attempts"
msgstr "" msgstr ""
@@ -184,6 +187,9 @@ msgstr ""
msgid "ICMP packet data size" msgid "ICMP packet data size"
msgstr "" msgstr ""
msgid "Instances"
msgstr ""
msgid "Interface" msgid "Interface"
msgstr "" msgstr ""
@@ -208,6 +214,18 @@ msgstr ""
msgid "Interval between IP address requests if the IP address is not defined." msgid "Interval between IP address requests if the IP address is not defined."
msgstr "" msgstr ""
msgid "Interval between modem restarts."
msgstr ""
msgid "Interval between network restarts."
msgstr ""
msgid "Interval between down-script runs."
msgstr ""
msgid "Interval between up-script runs."
msgstr ""
msgid "Jumbo: 9000 bytes" msgid "Jumbo: 9000 bytes"
msgstr "" msgstr ""
@@ -363,7 +381,7 @@ msgstr ""
msgid "Restart service" msgid "Restart service"
msgstr "" msgstr ""
msgid "Restart timeout" msgid "Device timeout"
msgstr "" msgstr ""
msgid "Run interval" msgid "Run interval"
@@ -423,9 +441,6 @@ msgstr ""
msgid "Service: detector always runs as a system service." msgid "Service: detector always runs as a system service."
msgstr "" msgstr ""
msgid "Service instances"
msgstr ""
msgid "Set the modem to be allowed to use any band." msgid "Set the modem to be allowed to use any band."
msgstr "" msgstr ""
@@ -468,10 +483,10 @@ 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 a network device." msgid "Timeout between stopping and starting a network device when restarting."
msgstr "" msgstr ""
msgid "Timeout between stopping and starting a ModemManger interface." msgid "Timeout between stopping and starting a ModemManger interface when restarting."
msgstr "" msgstr ""
msgid "Type a time string" msgid "Type a time string"
@@ -564,5 +579,11 @@ msgstr ""
msgid "down-script attempts" msgid "down-script attempts"
msgstr "" msgstr ""
msgid "down-script attempt interval"
msgstr ""
msgid "up-script attempts" msgid "up-script attempts"
msgstr "" msgstr ""
msgid "up_script attempt interval"
msgstr ""