Refactoring. Added respawn option to init-script.

This commit is contained in:
gSpot
2025-09-25 22:38:53 +03:00
parent cb7dbba054
commit 1720662f73
12 changed files with 198 additions and 152 deletions

View File

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

View File

@@ -120,15 +120,22 @@ end
function Module:httpRequest(url)
local retCode = 1, data
local fh = io.popen(string.format(
'%s --connect-timeout %s %s "%s"; printf "\n$?";', self.curlExec, self.connectTimeout, self.curlParams, url), "r")
'%s --connect-timeout %s %s "%s"; printf "\n$?";',
self.curlExec,
self.connectTimeout,
self.curlParams,
url
), "r")
if fh then
data = fh:read("*a")
data = fh:read("*a")
fh:close()
local s, e = data:find("[0-9]+\n?$")
retCode = tonumber(data:sub(s))
data = data:sub(0, s - 2)
if not data or data == "" then
data = nil
if data ~= nil then
local s, e = data:find("[0-9]+\n?$")
retCode = tonumber(data:sub(s))
data = data:sub(0, s - 2)
if not data or data == "" then
data = nil
end
end
else
retCode = 1