mirror of
https://github.com/gSpotx2f/luci-app-internet-detector.git
synced 2025-12-06 19:46:51 +03:00
v1.4. New module: mod_regular_script
This commit is contained in:
30
README.md
30
README.md
@@ -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.3.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.3.3-r1_all.ipk
|
wget --no-check-certificate -O /tmp/internet-detector_1.4.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.4.0-r1_all.ipk
|
||||||
opkg install /tmp/internet-detector_1.3.3-r1_all.ipk
|
opkg install /tmp/internet-detector_1.4.0-r1_all.ipk
|
||||||
rm /tmp/internet-detector_1.3.3-r1_all.ipk
|
rm /tmp/internet-detector_1.4.0-r1_all.ipk
|
||||||
/etc/init.d/internet-detector start
|
/etc/init.d/internet-detector start
|
||||||
/etc/init.d/internet-detector enable
|
/etc/init.d/internet-detector enable
|
||||||
|
|
||||||
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.3.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.3.3-r1_all.ipk
|
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.4.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.4.0-r1_all.ipk
|
||||||
opkg install /tmp/luci-app-internet-detector_1.3.3-r1_all.ipk
|
opkg install /tmp/luci-app-internet-detector_1.4.0-r1_all.ipk
|
||||||
rm /tmp/luci-app-internet-detector_1.3.3-r1_all.ipk
|
rm /tmp/luci-app-internet-detector_1.4.0-r1_all.ipk
|
||||||
/etc/init.d/rpcd restart
|
/etc/init.d/rpcd restart
|
||||||
|
|
||||||
i18n-ru:
|
i18n-ru:
|
||||||
|
|
||||||
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.3.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.3.3-r1_all.ipk
|
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.4.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.4.0-r1_all.ipk
|
||||||
opkg install /tmp/luci-i18n-internet-detector-ru_1.3.3-r1_all.ipk
|
opkg install /tmp/luci-i18n-internet-detector-ru_1.4.0-r1_all.ipk
|
||||||
rm /tmp/luci-i18n-internet-detector-ru_1.3.3-r1_all.ipk
|
rm /tmp/luci-i18n-internet-detector-ru_1.4.0-r1_all.ipk
|
||||||
|
|
||||||
## Screenshots:
|
## Screenshots:
|
||||||
|
|
||||||
@@ -42,9 +42,9 @@ i18n-ru:
|
|||||||
|
|
||||||
**Dependences:** modemmanager.
|
**Dependences:** modemmanager.
|
||||||
|
|
||||||
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.3.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.3.3-r1_all.ipk
|
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.4.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.4.0-r1_all.ipk
|
||||||
opkg install /tmp/internet-detector-mod-modem-restart_1.3.3-r1_all.ipk
|
opkg install /tmp/internet-detector-mod-modem-restart_1.4.0-r1_all.ipk
|
||||||
rm /tmp/internet-detector-mod-modem-restart_1.3.3-r1_all.ipk
|
rm /tmp/internet-detector-mod-modem-restart_1.4.0-r1_all.ipk
|
||||||
/etc/init.d/internet-detector restart
|
/etc/init.d/internet-detector restart
|
||||||
|
|
||||||

|

|
||||||
@@ -53,9 +53,9 @@ i18n-ru:
|
|||||||
|
|
||||||
**Dependences:** mailsend.
|
**Dependences:** mailsend.
|
||||||
|
|
||||||
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.3.3-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.3.3-r1_all.ipk
|
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.4.0-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.4.0-r1_all.ipk
|
||||||
opkg install /tmp/internet-detector-mod-email_1.3.3-r1_all.ipk
|
opkg install /tmp/internet-detector-mod-email_1.4.0-r1_all.ipk
|
||||||
rm /tmp/internet-detector-mod-email_1.3.3-r1_all.ipk
|
rm /tmp/internet-detector-mod-email_1.4.0-r1_all.ipk
|
||||||
/etc/init.d/internet-detector restart
|
/etc/init.d/internet-detector restart
|
||||||
|
|
||||||

|

|
||||||
|
|||||||
@@ -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.3.3
|
PKG_VERSION:=1.4.0
|
||||||
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>
|
||||||
|
|
||||||
|
|||||||
@@ -129,7 +129,7 @@ function Module:sendMessage(msg, textPattern)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Module:run(currentStatus, lastStatus, timeDiff)
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
if not self._enabled then
|
if not self._enabled then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -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.3.3
|
PKG_VERSION:=1.4.0
|
||||||
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>
|
||||||
|
|
||||||
|
|||||||
@@ -80,7 +80,7 @@ function Module:init(t)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Module:run(currentStatus, lastStatus, timeDiff)
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
if not self._enabled then
|
if not self._enabled then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -5,7 +5,7 @@
|
|||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=internet-detector
|
PKG_NAME:=internet-detector
|
||||||
PKG_VERSION:=1.3.3
|
PKG_VERSION:=1.4.0
|
||||||
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>
|
||||||
|
|
||||||
@@ -31,6 +31,7 @@ define Package/$(PKG_NAME)/conffiles
|
|||||||
/etc/internet-detector/down-script.internet
|
/etc/internet-detector/down-script.internet
|
||||||
/etc/internet-detector/up-script.internet
|
/etc/internet-detector/up-script.internet
|
||||||
/etc/internet-detector/public-ip-script.internet
|
/etc/internet-detector/public-ip-script.internet
|
||||||
|
/etc/internet-detector/regular-script.internet
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Build/Configure
|
define Build/Configure
|
||||||
@@ -46,6 +47,7 @@ define Package/$(PKG_NAME)/install
|
|||||||
$(INSTALL_DATA) ./files/etc/internet-detector/down-script.internet $(1)/etc/internet-detector/down-script.internet
|
$(INSTALL_DATA) ./files/etc/internet-detector/down-script.internet $(1)/etc/internet-detector/down-script.internet
|
||||||
$(INSTALL_DATA) ./files/etc/internet-detector/up-script.internet $(1)/etc/internet-detector/up-script.internet
|
$(INSTALL_DATA) ./files/etc/internet-detector/up-script.internet $(1)/etc/internet-detector/up-script.internet
|
||||||
$(INSTALL_DATA) ./files/etc/internet-detector/public-ip-script.internet $(1)/etc/internet-detector/public-ip-script.internet
|
$(INSTALL_DATA) ./files/etc/internet-detector/public-ip-script.internet $(1)/etc/internet-detector/public-ip-script.internet
|
||||||
|
$(INSTALL_DATA) ./files/etc/internet-detector/regular-script.internet $(1)/etc/internet-detector/regular-script.internet
|
||||||
$(INSTALL_DIR) $(1)/etc/init.d
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
$(INSTALL_BIN) ./files/etc/init.d/internet-detector $(1)/etc/init.d/internet-detector
|
$(INSTALL_BIN) ./files/etc/init.d/internet-detector $(1)/etc/init.d/internet-detector
|
||||||
$(INSTALL_DIR) $(1)/usr/bin
|
$(INSTALL_DIR) $(1)/usr/bin
|
||||||
@@ -57,6 +59,7 @@ define Package/$(PKG_NAME)/install
|
|||||||
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/mod_network_restart.lua $(1)/usr/lib/lua/internet-detector/mod_network_restart.lua
|
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/mod_network_restart.lua $(1)/usr/lib/lua/internet-detector/mod_network_restart.lua
|
||||||
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/mod_public_ip.lua $(1)/usr/lib/lua/internet-detector/mod_public_ip.lua
|
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/mod_public_ip.lua $(1)/usr/lib/lua/internet-detector/mod_public_ip.lua
|
||||||
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/mod_user_scripts.lua $(1)/usr/lib/lua/internet-detector/mod_user_scripts.lua
|
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/mod_user_scripts.lua $(1)/usr/lib/lua/internet-detector/mod_user_scripts.lua
|
||||||
|
$(INSTALL_DATA) ./files/usr/lib/lua/internet-detector/mod_regular_script.lua $(1)/usr/lib/lua/internet-detector/mod_regular_script.lua
|
||||||
endef
|
endef
|
||||||
|
|
||||||
$(eval $(call BuildPackage,$(PKG_NAME)))
|
$(eval $(call BuildPackage,$(PKG_NAME)))
|
||||||
|
|||||||
@@ -36,3 +36,6 @@ 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_dead_period '0'
|
option mod_user_scripts_dead_period '0'
|
||||||
|
option mod_regular_script_enabled '0'
|
||||||
|
option mod_regular_script_inet_state '2'
|
||||||
|
option mod_regular_script_interval '3600'
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
# Shell commands that are run regularly
|
||||||
@@ -390,7 +390,7 @@ function InternetDetector:mainLoop()
|
|||||||
mTimeDiff = 1
|
mTimeDiff = 1
|
||||||
end
|
end
|
||||||
mLastTime = mTimeNow
|
mLastTime = mTimeNow
|
||||||
e:run(currentStatus, lastStatus, mTimeDiff)
|
e:run(currentStatus, lastStatus, mTimeDiff, mTimeNow)
|
||||||
end
|
end
|
||||||
|
|
||||||
local modulesStatus = {}
|
local modulesStatus = {}
|
||||||
|
|||||||
@@ -100,7 +100,7 @@ function Module:getCurrentState()
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Module:run(currentStatus, lastStatus, timeDiff)
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
if not self._enabled then
|
if not self._enabled then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -76,7 +76,7 @@ function Module:init(t)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Module:run(currentStatus, lastStatus, timeDiff)
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
if currentStatus == 1 then
|
if currentStatus == 1 then
|
||||||
if 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._deadCounter >= self.deadPeriod then
|
||||||
|
|||||||
@@ -359,7 +359,7 @@ function Module:init(t)
|
|||||||
self._enabled = true
|
self._enabled = true
|
||||||
end
|
end
|
||||||
|
|
||||||
function Module:run(currentStatus, lastStatus, timeDiff)
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
if not self._enabled then
|
if not self._enabled then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ function Module:init(t)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Module:run(currentStatus, lastStatus, timeDiff)
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
if currentStatus == 1 then
|
if currentStatus == 1 then
|
||||||
if self._deadCounter >= self.deadPeriod then
|
if self._deadCounter >= self.deadPeriod then
|
||||||
self:rebootDevice()
|
self:rebootDevice()
|
||||||
|
|||||||
@@ -0,0 +1,55 @@
|
|||||||
|
|
||||||
|
local stdlib = require("posix.stdlib")
|
||||||
|
local unistd = require("posix.unistd")
|
||||||
|
|
||||||
|
local Module = {
|
||||||
|
name = "mod_regular_script",
|
||||||
|
runPrio = 90,
|
||||||
|
config = {},
|
||||||
|
syslog = function(level, msg) return true end,
|
||||||
|
writeValue = function(filePath, str) return false end,
|
||||||
|
readValue = function(filePath) return nil end,
|
||||||
|
inetState = 2, -- 0: connected, 1: disconnected, 2: both
|
||||||
|
interval = 3600,
|
||||||
|
script = "",
|
||||||
|
status = nil,
|
||||||
|
_nextTime = nil,
|
||||||
|
}
|
||||||
|
|
||||||
|
function Module:runExternalScript(scriptPath, currentStatus)
|
||||||
|
if unistd.access(scriptPath, "r") then
|
||||||
|
stdlib.setenv("INET_STATE", currentStatus)
|
||||||
|
os.execute(string.format('/bin/sh "%s" &', scriptPath))
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Module:init(t)
|
||||||
|
if t.inet_state ~= nil then
|
||||||
|
self.inetState = tonumber(t.inet_state)
|
||||||
|
end
|
||||||
|
if t.interval ~= nil then
|
||||||
|
self.interval = tonumber(t.interval)
|
||||||
|
end
|
||||||
|
if self.config.configDir then
|
||||||
|
self.script = string.format(
|
||||||
|
"%s/regular-script.%s", self.config.configDir, self.config.serviceConfig.instance)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
|
if not self._nextTime then
|
||||||
|
if timeNow < self.interval then
|
||||||
|
self._nextTime = self.interval
|
||||||
|
else
|
||||||
|
self._nextTime = timeNow - (timeNow % self.interval) + self.interval
|
||||||
|
end
|
||||||
|
end
|
||||||
|
if timeNow >= self._nextTime then
|
||||||
|
if self.inetState == 2 or (self.inetState == 0 and currentStatus == 0) or (self.inetState == 1 and currentStatus == 1) then
|
||||||
|
self:runExternalScript(self.script, currentStatus)
|
||||||
|
end
|
||||||
|
self._nextTime = self._nextTime + self.interval
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
return Module
|
||||||
@@ -40,7 +40,7 @@ function Module:init(t)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
function Module:run(currentStatus, lastStatus, timeDiff)
|
function Module:run(currentStatus, lastStatus, timeDiff, timeNow)
|
||||||
if currentStatus == 1 then
|
if currentStatus == 1 then
|
||||||
self._aliveCounter = 0
|
self._aliveCounter = 0
|
||||||
self._downScriptExecuted = false
|
self._downScriptExecuted = false
|
||||||
|
|||||||
@@ -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.3.3
|
PKG_VERSION:=1.4.0
|
||||||
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
|
||||||
|
|||||||
@@ -68,7 +68,10 @@ var Timefield = ui.Textfield.extend({
|
|||||||
let string = '0';
|
let string = '0';
|
||||||
if(/^\d+$/.test(value)) {
|
if(/^\d+$/.test(value)) {
|
||||||
value = Number(value);
|
value = Number(value);
|
||||||
if(value >= 3600 && (value % 3600) === 0) {
|
if(value >= 86400 && (value % 86400) === 0) {
|
||||||
|
string = String(value / 86400) + 'd';
|
||||||
|
}
|
||||||
|
else if(value >= 3600 && (value % 3600) === 0) {
|
||||||
string = String(value / 3600) + 'h';
|
string = String(value / 3600) + 'h';
|
||||||
}
|
}
|
||||||
else if(value >= 60 && (value % 60) === 0) {
|
else if(value >= 60 && (value % 60) === 0) {
|
||||||
@@ -101,9 +104,12 @@ var Timefield = ui.Textfield.extend({
|
|||||||
getValue() {
|
getValue() {
|
||||||
let rawValue = this.node.querySelector('input').value,
|
let rawValue = this.node.querySelector('input').value,
|
||||||
value = 0,
|
value = 0,
|
||||||
res = rawValue.match(/^(\d+)([hms]?)$/);
|
res = rawValue.match(/^(\d+)([dhms]?)$/);
|
||||||
if(res) {
|
if(res) {
|
||||||
if(res[2] === 'h') {
|
if(res[2] === 'd') {
|
||||||
|
value = Number(res[1]) * 86400;
|
||||||
|
}
|
||||||
|
else if(res[2] === 'h') {
|
||||||
value = Number(res[1]) * 3600;
|
value = Number(res[1]) * 3600;
|
||||||
}
|
}
|
||||||
else if(res[2] === 'm') {
|
else if(res[2] === 'm') {
|
||||||
@@ -321,8 +327,8 @@ return view.extend({
|
|||||||
placeholder: _('Type a time string'),
|
placeholder: _('Type a time string'),
|
||||||
validate : L.bind(
|
validate : L.bind(
|
||||||
function(section, value) {
|
function(section, value) {
|
||||||
return (/^$|^\d+[hms]?$/.test(value)) ? true : _('Expecting:') +
|
return (/^$|^\d+[dhms]?$/.test(value)) ? true : _('Expecting:') +
|
||||||
` ${_('One of the following:')}\n - ${_('hours')}: 2h\n - ${_('minutes')}: 10m\n - ${_('seconds')}: 30s\n`;
|
` ${_('One of the following:')}\n - ${_('days')}: 1d\n - ${_('hours')}: 2h\n - ${_('minutes')}: 10m\n - ${_('seconds')}: 30s\n`;
|
||||||
},
|
},
|
||||||
this,
|
this,
|
||||||
section_id
|
section_id
|
||||||
@@ -560,6 +566,7 @@ return view.extend({
|
|||||||
/* Main settings */
|
/* Main settings */
|
||||||
|
|
||||||
// mode
|
// mode
|
||||||
|
|
||||||
let mode = s.option(form.ListValue, 'mode',
|
let mode = s.option(form.ListValue, 'mode',
|
||||||
_('Internet detector mode'));
|
_('Internet detector mode'));
|
||||||
mode.value('0', _('Disabled'));
|
mode.value('0', _('Disabled'));
|
||||||
@@ -572,7 +579,6 @@ return view.extend({
|
|||||||
);
|
);
|
||||||
mode.default = '0';
|
mode.default = '0';
|
||||||
|
|
||||||
|
|
||||||
/* Service instances configuration */
|
/* Service instances configuration */
|
||||||
|
|
||||||
if(this.currentAppMode !== '2') {
|
if(this.currentAppMode !== '2') {
|
||||||
@@ -736,6 +742,7 @@ return view.extend({
|
|||||||
s.tab('email', _('Email notification'));
|
s.tab('email', _('Email notification'));
|
||||||
};
|
};
|
||||||
s.tab('user_scripts', _('User scripts'));
|
s.tab('user_scripts', _('User scripts'));
|
||||||
|
s.tab('regular_script', _('Regular script'));
|
||||||
};
|
};
|
||||||
|
|
||||||
s.addModalOptions = (s, section_id, ev) => {
|
s.addModalOptions = (s, section_id, ev) => {
|
||||||
@@ -1160,7 +1167,7 @@ return view.extend({
|
|||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
o.modalonly = true;
|
o.modalonly = true;
|
||||||
|
|
||||||
// up_script edit dialog
|
// up_script edit
|
||||||
o = s.taboption('user_scripts', this.CBIBlockFileEdit, this,
|
o = s.taboption('user_scripts', this.CBIBlockFileEdit, this,
|
||||||
'up_script',
|
'up_script',
|
||||||
this.configDir + '/up-script.' + s.section,
|
this.configDir + '/up-script.' + s.section,
|
||||||
@@ -1178,7 +1185,7 @@ return view.extend({
|
|||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
o.modalonly = true;
|
o.modalonly = true;
|
||||||
|
|
||||||
// down_script edit dialog
|
// down_script edit
|
||||||
o = s.taboption('user_scripts', this.CBIBlockFileEdit, this,
|
o = s.taboption('user_scripts', this.CBIBlockFileEdit, this,
|
||||||
'down_script',
|
'down_script',
|
||||||
this.configDir + '/down-script.' + s.section,
|
this.configDir + '/down-script.' + s.section,
|
||||||
@@ -1195,6 +1202,48 @@ return view.extend({
|
|||||||
o.default = '0';
|
o.default = '0';
|
||||||
o.rmempty = false;
|
o.rmempty = false;
|
||||||
o.modalonly = true;
|
o.modalonly = true;
|
||||||
|
|
||||||
|
// Regular script
|
||||||
|
|
||||||
|
o = s.taboption('regular_script', form.DummyValue, '_dummy');
|
||||||
|
o.rawhtml = true;
|
||||||
|
o.default = '<div class="cbi-section-descr">' +
|
||||||
|
_('Shell commands that are run regularly.') +
|
||||||
|
'</div>';
|
||||||
|
o.modalonly = true;
|
||||||
|
|
||||||
|
// enabled
|
||||||
|
o = s.taboption('regular_script', form.Flag, 'mod_regular_script_enabled',
|
||||||
|
_('Enabled'));
|
||||||
|
o.rmempty = false;
|
||||||
|
o.modalonly = true;
|
||||||
|
|
||||||
|
// inet_state
|
||||||
|
o = s.taboption('regular_script', form.ListValue,
|
||||||
|
'mod_regular_script_inet_state', _('Run if Internet state is')
|
||||||
|
);
|
||||||
|
o.modalonly = true;
|
||||||
|
o.value(0, _('connected'));
|
||||||
|
o.value(1, _('disconnected'));
|
||||||
|
o.value(2, _('connected or disconnected'));
|
||||||
|
o.default = '2';
|
||||||
|
|
||||||
|
// regular_script edit
|
||||||
|
o = s.taboption('regular_script', this.CBIBlockFileEdit, this,
|
||||||
|
'regular_script',
|
||||||
|
this.configDir + '/regular-script.' + s.section,
|
||||||
|
_('Edit regular-script'),
|
||||||
|
_('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;
|
||||||
|
|
||||||
|
// interval
|
||||||
|
o = s.taboption('regular_script', this.CBITimeInput,
|
||||||
|
'mod_regular_script_interval', _('Run interval')
|
||||||
|
);
|
||||||
|
o.default = '3600';
|
||||||
|
o.rmempty = false;
|
||||||
|
o.modalonly = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -113,6 +113,9 @@ msgstr "Изменить"
|
|||||||
msgid "Edit down-script"
|
msgid "Edit down-script"
|
||||||
msgstr "Изменить down-script"
|
msgstr "Изменить down-script"
|
||||||
|
|
||||||
|
msgid "Edit regular-script"
|
||||||
|
msgstr "Изменить regular-script"
|
||||||
|
|
||||||
msgid "Edit public-ip-script"
|
msgid "Edit public-ip-script"
|
||||||
msgstr "Изменить public-ip-script"
|
msgstr "Изменить public-ip-script"
|
||||||
|
|
||||||
@@ -314,6 +317,9 @@ msgid ""
|
|||||||
msgstr ""
|
msgstr ""
|
||||||
"Период времени отсутствия доступа в Интренет перед перезагрузкой устройства."
|
"Период времени отсутствия доступа в Интренет перед перезагрузкой устройства."
|
||||||
|
|
||||||
|
msgid "Regular script"
|
||||||
|
msgstr "Регулярный скрипт"
|
||||||
|
|
||||||
msgid "Polling interval"
|
msgid "Polling interval"
|
||||||
msgstr "Интервал опроса"
|
msgstr "Интервал опроса"
|
||||||
|
|
||||||
@@ -341,6 +347,12 @@ msgstr "Перезапуск службы"
|
|||||||
msgid "Restart timeout"
|
msgid "Restart timeout"
|
||||||
msgstr "Таймаут перезапуска"
|
msgstr "Таймаут перезапуска"
|
||||||
|
|
||||||
|
msgid "Run interval"
|
||||||
|
msgstr "Интервал запуска"
|
||||||
|
|
||||||
|
msgid "Run if Internet state is"
|
||||||
|
msgstr "Выполнять если статус Интернет"
|
||||||
|
|
||||||
msgid "Run service at startup"
|
msgid "Run service at startup"
|
||||||
msgstr "Запуск службы при старте"
|
msgstr "Запуск службы при старте"
|
||||||
|
|
||||||
@@ -389,9 +401,15 @@ 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 "Разрешить модему использование любой частоты."
|
||||||
|
|
||||||
|
msgid "Shell commands that are run regularly."
|
||||||
|
msgstr "Команды shell выполняемые регулярно."
|
||||||
|
|
||||||
msgid "Shell commands that run when connected to the Internet."
|
msgid "Shell commands that run when connected to the Internet."
|
||||||
msgstr "Команды shell выполняемые при подключении к Интернет."
|
msgstr "Команды shell выполняемые при подключении к Интернет."
|
||||||
|
|
||||||
|
msgid "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)."
|
||||||
|
msgstr "Команды shell выполняемые регулярно с заданным интервалом. Текущее состояние Интернет доступно как значение переменной <code>$INET_STATE</code> (<code>0</code> - подключен, <code>1</code> - отключен)."
|
||||||
|
|
||||||
msgid "Shell commands that run when the public IP address changes. New IP is available as value of the <code>$PUBLIC_IP</code> variable (empty string if undefined)."
|
msgid "Shell commands that run when the public IP address changes. New IP is available as value of the <code>$PUBLIC_IP</code> variable (empty string if undefined)."
|
||||||
msgstr "Команды shell выполняемые при изменении публичного IP адреса. Новый IP доступен как значение переменной <code>$PUBLIC_IP</code> (пустая строка если не определён)."
|
msgstr "Команды shell выполняемые при изменении публичного IP адреса. Новый IP доступен как значение переменной <code>$PUBLIC_IP</code> (пустая строка если не определён)."
|
||||||
|
|
||||||
@@ -474,11 +492,23 @@ msgstr "Записывать сообщения в системный журна
|
|||||||
msgid "after connection"
|
msgid "after connection"
|
||||||
msgstr "после подключения"
|
msgstr "после подключения"
|
||||||
|
|
||||||
|
msgid "after connection or disconnection"
|
||||||
|
msgstr "после подключения или отключения"
|
||||||
|
|
||||||
msgid "after disconnection"
|
msgid "after disconnection"
|
||||||
msgstr "после отключения"
|
msgstr "после отключения"
|
||||||
|
|
||||||
msgid "after connection or disconnection"
|
msgid "connected"
|
||||||
msgstr "после подключения или отключения"
|
msgstr "подключен"
|
||||||
|
|
||||||
|
msgid "connected or disconnected"
|
||||||
|
msgstr "подключен или отключен"
|
||||||
|
|
||||||
|
msgid "days"
|
||||||
|
msgstr "дни"
|
||||||
|
|
||||||
|
msgid "disconnected"
|
||||||
|
msgstr "отключен"
|
||||||
|
|
||||||
msgid "down-script"
|
msgid "down-script"
|
||||||
msgstr "down-script"
|
msgstr "down-script"
|
||||||
|
|||||||
@@ -101,6 +101,9 @@ msgstr ""
|
|||||||
msgid "Edit down-script"
|
msgid "Edit down-script"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Edit regular-script"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Edit public-ip-script"
|
msgid "Edit public-ip-script"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -289,6 +292,9 @@ msgid ""
|
|||||||
"Period of time without Internet access until the device is rebooted."
|
"Period of time without Internet access until the device is rebooted."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Regular script"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Polling interval"
|
msgid "Polling interval"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -316,6 +322,12 @@ msgstr ""
|
|||||||
msgid "Restart timeout"
|
msgid "Restart timeout"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Run interval"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "Run if Internet state is"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Run service at startup"
|
msgid "Run service at startup"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -364,9 +376,15 @@ 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 ""
|
||||||
|
|
||||||
|
msgid "Shell commands that are run regularly."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shell commands that run when connected to the Internet."
|
msgid "Shell commands that run when connected to the Internet."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "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)."
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
msgid "Shell commands that run when the public IP address changes. New IP is available as value of the <code>$PUBLIC_IP</code> variable (empty string if undefined)."
|
msgid "Shell commands that run when the public IP address changes. New IP is available as value of the <code>$PUBLIC_IP</code> variable (empty string if undefined)."
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
@@ -448,7 +466,16 @@ msgstr ""
|
|||||||
msgid "after disconnection"
|
msgid "after disconnection"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "both"
|
msgid "connected"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "connected or disconnected"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "days"
|
||||||
|
msgstr ""
|
||||||
|
|
||||||
|
msgid "disconnected"
|
||||||
msgstr ""
|
msgstr ""
|
||||||
|
|
||||||
msgid "down-script"
|
msgid "down-script"
|
||||||
|
|||||||
@@ -6,7 +6,8 @@
|
|||||||
"/sys/class/leds": [ "list" ],
|
"/sys/class/leds": [ "list" ],
|
||||||
"/etc/internet-detector/up-script*": [ "read" ],
|
"/etc/internet-detector/up-script*": [ "read" ],
|
||||||
"/etc/internet-detector/down-script*": [ "read" ],
|
"/etc/internet-detector/down-script*": [ "read" ],
|
||||||
"/etc/internet-detector/public-ip-script*": [ "read" ]
|
"/etc/internet-detector/public-ip-script*": [ "read" ],
|
||||||
|
"/etc/internet-detector/regular-script*": [ "read" ]
|
||||||
},
|
},
|
||||||
"uci": [ "internet-detector" ],
|
"uci": [ "internet-detector" ],
|
||||||
"ubus": {
|
"ubus": {
|
||||||
@@ -18,7 +19,8 @@
|
|||||||
"file": {
|
"file": {
|
||||||
"/etc/internet-detector/up-script*": [ "write" ],
|
"/etc/internet-detector/up-script*": [ "write" ],
|
||||||
"/etc/internet-detector/down-script*": [ "write" ],
|
"/etc/internet-detector/down-script*": [ "write" ],
|
||||||
"/etc/internet-detector/public-ip-script*": [ "write" ]
|
"/etc/internet-detector/public-ip-script*": [ "write" ],
|
||||||
|
"/etc/internet-detector/regular-script*": [ "write" ]
|
||||||
},
|
},
|
||||||
"uci": [ "internet-detector" ]
|
"uci": [ "internet-detector" ]
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user