Fixed a crash on startup.

This commit is contained in:
gSpot
2025-10-04 23:35:11 +03:00
parent 663ac6c90b
commit 87d28fb618
11 changed files with 54 additions and 52 deletions

View File

@@ -20,22 +20,22 @@ Internet-detector is an application for checking the availability of the Interne
## Installation notes:
opkg update
wget --no-check-certificate -O /tmp/internet-detector_1.6.6-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.6.6-r1_all.ipk
opkg install /tmp/internet-detector_1.6.6-r1_all.ipk
rm /tmp/internet-detector_1.6.6-r1_all.ipk
wget --no-check-certificate -O /tmp/internet-detector_1.6.7-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.6.7-r1_all.ipk
opkg install /tmp/internet-detector_1.6.7-r1_all.ipk
rm /tmp/internet-detector_1.6.7-r1_all.ipk
service internet-detector start
service internet-detector enable
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.6.6-r2_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.6.6-r2_all.ipk
opkg install /tmp/luci-app-internet-detector_1.6.6-r2_all.ipk
rm /tmp/luci-app-internet-detector_1.6.6-r2_all.ipk
wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.6.7-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.6.7-r1_all.ipk
opkg install /tmp/luci-app-internet-detector_1.6.7-r1_all.ipk
rm /tmp/luci-app-internet-detector_1.6.7-r1_all.ipk
service rpcd restart
i18n-ru:
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.6.6-r2_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.6.6-r2_all.ipk
opkg install /tmp/luci-i18n-internet-detector-ru_1.6.6-r2_all.ipk
rm /tmp/luci-i18n-internet-detector-ru_1.6.6-r2_all.ipk
wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.6.7-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.6.7-r1_all.ipk
opkg install /tmp/luci-i18n-internet-detector-ru_1.6.7-r1_all.ipk
rm /tmp/luci-i18n-internet-detector-ru_1.6.7-r1_all.ipk
## Screenshots:
@@ -47,9 +47,9 @@ i18n-ru:
**Dependences:** modemmanager.
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.6.6-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.6.6-r1_all.ipk
opkg install /tmp/internet-detector-mod-modem-restart_1.6.6-r1_all.ipk
rm /tmp/internet-detector-mod-modem-restart_1.6.6-r1_all.ipk
wget --no-check-certificate -O /tmp/internet-detector-mod-modem-restart_1.6.7-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.6.7-r1_all.ipk
opkg install /tmp/internet-detector-mod-modem-restart_1.6.7-r1_all.ipk
rm /tmp/internet-detector-mod-modem-restart_1.6.7-r1_all.ipk
service internet-detector restart
![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/04.jpg)
@@ -58,9 +58,9 @@ i18n-ru:
**Dependences:** mailsend.
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.6.6-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.6.6-r1_all.ipk
opkg install /tmp/internet-detector-mod-email_1.6.6-r1_all.ipk
rm /tmp/internet-detector-mod-email_1.6.6-r1_all.ipk
wget --no-check-certificate -O /tmp/internet-detector-mod-email_1.6.7-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.6.7-r1_all.ipk
opkg install /tmp/internet-detector-mod-email_1.6.7-r1_all.ipk
rm /tmp/internet-detector-mod-email_1.6.7-r1_all.ipk
service internet-detector restart
![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/05.jpg)
@@ -69,9 +69,9 @@ i18n-ru:
**Dependences:** curl.
wget --no-check-certificate -O /tmp/internet-detector-mod-telegram_1.6.6-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-telegram_1.6.6-r1_all.ipk
opkg install /tmp/internet-detector-mod-telegram_1.6.6-r1_all.ipk
rm /tmp/internet-detector-mod-telegram_1.6.6-r1_all.ipk
wget --no-check-certificate -O /tmp/internet-detector-mod-telegram_1.6.7-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-telegram_1.6.7-r1_all.ipk
opkg install /tmp/internet-detector-mod-telegram_1.6.7-r1_all.ipk
rm /tmp/internet-detector-mod-telegram_1.6.7-r1_all.ipk
service internet-detector restart
![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/06.jpg)

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector-mod-email
PKG_VERSION:=1.6.6
PKG_VERSION:=1.6.7
PKG_RELEASE:=1
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>

View File

@@ -180,7 +180,7 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
end
end
self._connected = false
else
elseif currentStatus == 0 then
self._deadCounter = 0
self._msgSentDisconnect = false

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector-mod-modem-restart
PKG_VERSION:=1.6.6
PKG_VERSION:=1.6.7
PKG_RELEASE:=1
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector-mod-telegram
PKG_VERSION:=1.6.6
PKG_VERSION:=1.6.7
PKG_RELEASE:=1
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>

View File

@@ -225,7 +225,7 @@ function Module:run(currentStatus, lastStatus, timeDiff, timeNow, inetChecked)
end
end
self._connected = false
else
elseif currentStatus == 0 then
self._deadCounter = 0
self._msgSentDisconnect = false

View File

@@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=internet-detector
PKG_VERSION:=1.6.6
PKG_VERSION:=1.6.7
PKG_RELEASE:=1
PKG_MAINTAINER:=gSpot <https://github.com/gSpotx2f/luci-app-internet-detector>

View File

@@ -240,7 +240,6 @@ function InternetDetector:TCPConnectionToHost(host, port)
"GETADDRINFO ERROR: %s, %s", errMsg, errNum))
else
local family = saTable[1].family
if family then
local sock, errMsg, errNum = socket.socket(family, socket.SOCK_STREAM, 0)
@@ -330,7 +329,9 @@ function InternetDetector:mainLoop()
signal.signal(signal.SIGQUIT, function(signo) self:exit(signo) end)
signal.signal(signal.SIGUSR1, function(signo) self:resetUiCounter(signo) end)
local lastStatus, currentStatus, mTimeNow, mTimeDiff, mLastTime, uiTimeNow, uiLastTime
local mTimeNow, mTimeDiff, mLastTime, uiTimeNow, uiLastTime
local lastStatus = -1
local currentStatus = -1
local interval = self.serviceConfig.interval_up
local modulesStatus = {}
local counter = 0
@@ -340,14 +341,18 @@ function InternetDetector:mainLoop()
local attempt = 1
local checkFunc = (self.serviceConfig.check_type == 1) and self.pingHost or self.TCPConnectionToHost
self:writeValueToFile(
self.statusFile, self:statusJson(currentStatus, self.serviceConfig.instance))
while true do
if counter == 0 or counter >= interval then
checking = true
end
inetChecked = false
if checking then
local newStatus = 1
local checkCompleted = false
if hostNum <= #self.parsedHosts then
if attempt <= self.serviceConfig.connection_attempts then
local addr = self.parsedHosts[hostNum].addr
@@ -373,7 +378,7 @@ function InternetDetector:mainLoop()
checking = false
newStatus = 0
counter = 0
checkCompleted = true
inetChecked = true
else
attempt = attempt + 1
if attempt > self.serviceConfig.connection_attempts then
@@ -389,16 +394,16 @@ function InternetDetector:mainLoop()
hostNum = 1
checking = false
counter = 0
checkCompleted = true
inetChecked = true
end
else
hostNum = 1
checking = false
counter = 0
checkCompleted = true
inetChecked = true
end
if checkCompleted then
if inetChecked then
currentStatus = newStatus
if not stat.stat(self.statusFile) then
self:writeValueToFile(self.statusFile, self:statusJson(
@@ -411,7 +416,7 @@ function InternetDetector:mainLoop()
currentStatus, self.serviceConfig.instance))
self:writeLogMessage("notice", "Connected")
end
else
elseif currentStatus == 1 then
interval = self.serviceConfig.interval_down
if currentStatus ~= lastStatus then
self:writeValueToFile(self.statusFile, self:statusJson(
@@ -423,7 +428,6 @@ function InternetDetector:mainLoop()
end
mTimeDiff = 0
inetChecked = (counter == 0)
for _, e in ipairs(self.modules) do
mTimeNow = time.clock_gettime(time.CLOCK_MONOTONIC).tv_sec
if mLastTime then
@@ -432,6 +436,7 @@ function InternetDetector:mainLoop()
mTimeDiff = 1
end
mLastTime = mTimeNow
if self.debug then
e:run(currentStatus, lastStatus, mTimeDiff, mTimeNow, inetChecked)
else
@@ -651,9 +656,6 @@ function InternetDetector:run()
inspectTable()(self, "self.")
end
self:writeValueToFile(
self.statusFile, self:statusJson(-1, self.serviceConfig.instance))
self:mainLoop()
self:exit()
end

View File

@@ -269,7 +269,7 @@ function Module:ledRunFunc(t, currentStatus)
)
end
end
else
elseif currentStatus == 1 then
if t.ledAction2 == 1 then
if self:getCurrentState(t) or self:getCurrentTrigger(t) then
self:off(t)

View File

@@ -5,8 +5,8 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=luci-app-internet-detector
PKG_VERSION:=1.6.6
PKG_RELEASE:=2
PKG_VERSION:=1.6.7
PKG_RELEASE:=1
LUCI_TITLE:=LuCI support for internet-detector
LUCI_DEPENDS:=+internet-detector
LUCI_PKGARCH:=all

View File

@@ -915,7 +915,7 @@ return view.extend({
o.modalonly = true;
if(this.leds.length > 0) {
this.leds.sort((a, b) => a.name > b.name ? 1 : -1);
this.leds.sort((a, b) => (a.name > b.name) ? 1 : (a.name < b.name) ? -1 : 0);
// enabled
o = s.taboption('led_control', form.Flag,