From 10fedfded1a52504fe5edf2cf72f8d086373dd06 Mon Sep 17 00:00:00 2001 From: gSpot Date: Thu, 2 Oct 2025 18:23:46 +0300 Subject: [PATCH] Minor fixes. --- README.md | 36 +++++++++---------- internet-detector-mod-email/Makefile | 2 +- internet-detector-mod-modem-restart/Makefile | 2 +- internet-detector-mod-telegram/Makefile | 2 +- internet-detector/Makefile | 2 +- .../files/etc/init.d/internet-detector | 2 +- .../usr/lib/lua/internet-detector/main.lua | 35 ++++++++---------- .../modules/mod_regular_script.lua | 2 +- luci-app-internet-detector/Makefile | 2 +- .../resources/view/internet-detector.js | 10 +++++- .../po/ru/internet-detector.po | 6 ++++ .../po/templates/internet-detector.pot | 6 ++++ 12 files changed, 60 insertions(+), 47 deletions(-) diff --git a/README.md b/README.md index d9548fa..61f8b5d 100644 --- a/README.md +++ b/README.md @@ -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.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_1.6.5-r1_all.ipk - opkg install /tmp/internet-detector_1.6.5-r1_all.ipk - rm /tmp/internet-detector_1.6.5-r1_all.ipk + 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 service internet-detector start service internet-detector enable - wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.6.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.6.5-r1_all.ipk - opkg install /tmp/luci-app-internet-detector_1.6.5-r1_all.ipk - rm /tmp/luci-app-internet-detector_1.6.5-r1_all.ipk + wget --no-check-certificate -O /tmp/luci-app-internet-detector_1.6.6-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_1.6.6-r1_all.ipk + opkg install /tmp/luci-app-internet-detector_1.6.6-r1_all.ipk + rm /tmp/luci-app-internet-detector_1.6.6-r1_all.ipk service rpcd restart i18n-ru: - wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.6.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.6.5-r1_all.ipk - opkg install /tmp/luci-i18n-internet-detector-ru_1.6.5-r1_all.ipk - rm /tmp/luci-i18n-internet-detector-ru_1.6.5-r1_all.ipk + wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_1.6.6-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_1.6.6-r1_all.ipk + opkg install /tmp/luci-i18n-internet-detector-ru_1.6.6-r1_all.ipk + rm /tmp/luci-i18n-internet-detector-ru_1.6.6-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.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-modem-restart_1.6.5-r1_all.ipk - opkg install /tmp/internet-detector-mod-modem-restart_1.6.5-r1_all.ipk - rm /tmp/internet-detector-mod-modem-restart_1.6.5-r1_all.ipk + 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 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.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-email_1.6.5-r1_all.ipk - opkg install /tmp/internet-detector-mod-email_1.6.5-r1_all.ipk - rm /tmp/internet-detector-mod-email_1.6.5-r1_all.ipk + 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 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.5-r1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector-mod-telegram_1.6.5-r1_all.ipk - opkg install /tmp/internet-detector-mod-telegram_1.6.5-r1_all.ipk - rm /tmp/internet-detector-mod-telegram_1.6.5-r1_all.ipk + 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 service internet-detector restart ![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/06.jpg) diff --git a/internet-detector-mod-email/Makefile b/internet-detector-mod-email/Makefile index aa8ea6b..8399da7 100644 --- a/internet-detector-mod-email/Makefile +++ b/internet-detector-mod-email/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector-mod-email -PKG_VERSION:=1.6.5 +PKG_VERSION:=1.6.6 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector-mod-modem-restart/Makefile b/internet-detector-mod-modem-restart/Makefile index 7ae2d45..f1074a6 100644 --- a/internet-detector-mod-modem-restart/Makefile +++ b/internet-detector-mod-modem-restart/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector-mod-modem-restart -PKG_VERSION:=1.6.5 +PKG_VERSION:=1.6.6 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector-mod-telegram/Makefile b/internet-detector-mod-telegram/Makefile index bbcb175..78a1dad 100644 --- a/internet-detector-mod-telegram/Makefile +++ b/internet-detector-mod-telegram/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector-mod-telegram -PKG_VERSION:=1.6.5 +PKG_VERSION:=1.6.6 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector/Makefile b/internet-detector/Makefile index b76570f..a9f75db 100644 --- a/internet-detector/Makefile +++ b/internet-detector/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector -PKG_VERSION:=1.6.5 +PKG_VERSION:=1.6.6 PKG_RELEASE:=1 PKG_MAINTAINER:=gSpot diff --git a/internet-detector/files/etc/init.d/internet-detector b/internet-detector/files/etc/init.d/internet-detector index 85e605f..5b5ffd1 100755 --- a/internet-detector/files/etc/init.d/internet-detector +++ b/internet-detector/files/etc/init.d/internet-detector @@ -18,7 +18,7 @@ run_instance() { } start_service() { - config_load internet-detector + config_load "internet-detector" config_get mode "config" mode "0" if [ $mode = "1" ]; then config_foreach run_instance "instance" diff --git a/internet-detector/files/usr/lib/lua/internet-detector/main.lua b/internet-detector/files/usr/lib/lua/internet-detector/main.lua index 023fdb6..4961bb8 100644 --- a/internet-detector/files/usr/lib/lua/internet-detector/main.lua +++ b/internet-detector/files/usr/lib/lua/internet-detector/main.lua @@ -88,28 +88,21 @@ function InternetDetector:prequire(package) return ok and pkg end -function InternetDetector:loadUCIConfig(sType, instance) - local success - local num = 0 - uciCursor:foreach( - self.appName, - sType, - function(s) - if s[".name"] == instance then - for k, v in pairs(s) do - if type(v) == "string" and v:match("^[%d]+$") then - v = tonumber(v) - end - self.serviceConfig[k] = v - end - success = true - self.serviceConfig.instanceNum = num +function InternetDetector:loadInstanceConfig(instance) + local sections = uciCursor:get_all(self.appName) + local t = sections[instance] + if t then + for k, v in pairs(t) do + if type(v) == "string" and v:match("^[%d]+$") then + v = tonumber(v) end - num = num + 1 + self.serviceConfig[k] = v end - ) - self.serviceConfig.instance = instance - return success + self.serviceConfig.instance = instance + self.serviceConfig.instanceNum = t[".index"] + return true + end + return false end function InternetDetector:writeValueToFile(filePath, str) @@ -693,7 +686,7 @@ function InternetDetector:daemon() end function InternetDetector:setServiceConfig(instance) - if self:loadUCIConfig("instance", instance) then + if self:loadInstanceConfig(instance) then self:parseHosts() if self.mode == 2 then self.loggingLevel = 0 diff --git a/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_regular_script.lua b/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_regular_script.lua index 3aa7515..d0332d9 100644 --- a/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_regular_script.lua +++ b/internet-detector/files/usr/lib/lua/internet-detector/modules/mod_regular_script.lua @@ -1,7 +1,7 @@ local stdlib = require("posix.stdlib") -local unistd = require("posix.unistd") local time = require("posix.time") +local unistd = require("posix.unistd") local Module = { name = "mod_regular_script", diff --git a/luci-app-internet-detector/Makefile b/luci-app-internet-detector/Makefile index a4a55f1..f087cd4 100644 --- a/luci-app-internet-detector/Makefile +++ b/luci-app-internet-detector/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-internet-detector -PKG_VERSION:=1.6.5 +PKG_VERSION:=1.6.6 PKG_RELEASE:=1 LUCI_TITLE:=LuCI support for internet-detector LUCI_DEPENDS:=+internet-detector diff --git a/luci-app-internet-detector/htdocs/luci-static/resources/view/internet-detector.js b/luci-app-internet-detector/htdocs/luci-static/resources/view/internet-detector.js index 2cec361..0fb9995 100644 --- a/luci-app-internet-detector/htdocs/luci-static/resources/view/internet-detector.js +++ b/luci-app-internet-detector/htdocs/luci-static/resources/view/internet-detector.js @@ -773,7 +773,7 @@ return view.extend({ 'hosts', _('Hosts'), _('Hosts to check Internet availability. Hosts are polled (in list order) until at least one of them responds.') ); - o.datatype = 'or(or(host,hostport),ipaddrport(1))'; + o.datatype = 'or(host,hostport,ipaddrport(1))'; o.default = this.defaultHosts; o.rmempty = false; @@ -895,6 +895,14 @@ return view.extend({ s.addModalOptions = (s, section_id, ev) => { + if(section_id == 'config') { + s.map.children = []; + s.map.readonly = true; + s.map.children.push(new form.NamedSection(s.map, '_dummy', '_dummy', + _('Error!'), _('Invalid instance name...'))); + return; + }; + if(this.currentAppMode !== '2') { // LED control diff --git a/luci-app-internet-detector/po/ru/internet-detector.po b/luci-app-internet-detector/po/ru/internet-detector.po index 614da4d..791dfa7 100644 --- a/luci-app-internet-detector/po/ru/internet-detector.po +++ b/luci-app-internet-detector/po/ru/internet-detector.po @@ -175,6 +175,9 @@ msgstr "Включен" msgid "Error" msgstr "Ошибка" +msgid "Error!" +msgstr "Ошибка!" + msgid "Expecting:" msgstr "Ожидается:" @@ -272,6 +275,9 @@ msgstr "Интервал между запусками down-script." msgid "Interval between up-script runs." msgstr "Интервал между запусками up-script." +msgid "Invalid instance name..." +msgstr "Недопустимое имя экземпляра..." + msgid "Jumbo: 9000 bytes" msgstr "Гигантский: 9000 байт" diff --git a/luci-app-internet-detector/po/templates/internet-detector.pot b/luci-app-internet-detector/po/templates/internet-detector.pot index 9c6749c..ee56956 100644 --- a/luci-app-internet-detector/po/templates/internet-detector.pot +++ b/luci-app-internet-detector/po/templates/internet-detector.pot @@ -162,6 +162,9 @@ msgstr "" msgid "Error" msgstr "" +msgid "Error!" +msgstr "" + msgid "Expecting:" msgstr "" @@ -257,6 +260,9 @@ msgstr "" msgid "Interval between up-script runs." msgstr "" +msgid "Invalid instance name..." +msgstr "" + msgid "Jumbo: 9000 bytes" msgstr ""