diff --git a/README.md b/README.md index de617ce..74cbb7b 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,28 @@ OpenWrt >= 19.07. Dependences: lua, luci-lib-nixio, libuci-lua -**Installation notes:** +## Installation notes + +**OpenWrt >= 21.02:** + + wget --no-check-certificate -O /tmp/internet-detector_0.3.0-2_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/internet-detector_0.3.0-2_all.ipk + opkg install /tmp/internet-detector_0.3.0-2_all.ipk + rm /tmp/internet-detector_0.3.0-2_all.ipk + /etc/init.d/internet-detector start + /etc/init.d/internet-detector enable + + wget --no-check-certificate -O /tmp/luci-app-internet-detector_0.3.0-3_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-app-internet-detector_0.3.0-3_all.ipk + opkg install /tmp/luci-app-internet-detector_0.3.0-3_all.ipk + rm /tmp/luci-app-internet-detector_0.3.0-3_all.ipk + /etc/init.d/rpcd restart + +i18n-ru: + + wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_0.3.0-3_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/current/luci-i18n-internet-detector-ru_0.3.0-3_all.ipk + opkg install /tmp/luci-i18n-internet-detector-ru_0.3.0-3_all.ipk + rm /tmp/luci-i18n-internet-detector-ru_0.3.0-3_all.ipk + +**OpenWrt 19.07:** wget --no-check-certificate -O /tmp/internet-detector_0.3.0-1_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/19.07/internet-detector_0.3.0-1_all.ipk opkg install /tmp/internet-detector_0.3.0-1_all.ipk @@ -16,15 +37,15 @@ Dependences: lua, luci-lib-nixio, libuci-lua wget --no-check-certificate -O /tmp/luci-app-internet-detector_0.3.0-2_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/19.07/luci-app-internet-detector_0.3.0-2_all.ipk opkg install /tmp/luci-app-internet-detector_0.3.0-2_all.ipk rm /tmp/luci-app-internet-detector_0.3.0-2_all.ipk - /etc/init.d/rpcd reload + /etc/init.d/rpcd restart -**i18n-ru:** +i18n-ru: wget --no-check-certificate -O /tmp/luci-i18n-internet-detector-ru_0.3.0-2_all.ipk https://github.com/gSpotx2f/packages-openwrt/raw/master/19.07/luci-i18n-internet-detector-ru_0.3.0-2_all.ipk opkg install /tmp/luci-i18n-internet-detector-ru_0.3.0-2_all.ipk rm /tmp/luci-i18n-internet-detector-ru_0.3.0-2_all.ipk -**Script for LED control:** +## Script for LED control: ![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/internet-led.jpg) @@ -38,7 +59,7 @@ LED is on when Internet is available. A specific LED can be set in `/etc/interne uci commit /etc/init.d/internet-detector restart -### Screenshots: +## Screenshots: ![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/01.jpg) ![](https://github.com/gSpotx2f/luci-app-internet-detector/blob/master/screenshots/03.jpg) diff --git a/internet-detector/Makefile b/internet-detector/Makefile index 39bf151..66eb264 100644 --- a/internet-detector/Makefile +++ b/internet-detector/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=internet-detector PKG_VERSION:=0.3.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 PKG_MAINTAINER:=gSpot PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/luci-app-internet-detector/Makefile b/luci-app-internet-detector/Makefile index 0f5458d..24f8cbd 100644 --- a/luci-app-internet-detector/Makefile +++ b/luci-app-internet-detector/Makefile @@ -4,8 +4,7 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=0.3.0 -PKG_RELEASE:=2 +PKG_VERSION:=0.3.0-3 LUCI_TITLE:=LuCI support for internet-detector LUCI_DEPENDS:=+internet-detector LUCI_PKGARCH:=all 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 faa000f..7667844 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 @@ -1,15 +1,18 @@ 'use strict'; +'require baseclass'; 'require form'; 'require fs'; +'require poll'; 'require rpc'; 'require uci'; 'require ui'; +'require view'; const btnStyleEnabled = 'btn cbi-button-save'; const btnStyleDisabled = 'btn cbi-button-reset'; const btnStyleApply = 'btn cbi-button-apply'; -return L.view.extend({ +return view.extend({ execPath : '/usr/bin/internet-detector', upScriptPath : '/etc/internet-detector/up-script', downScriptPath : '/etc/internet-detector/down-script', @@ -69,14 +72,14 @@ return L.view.extend({ }, serviceRestart: function(ev) { - L.Poll.stop(); + poll.stop(); return this.handleServiceAction('restart').then(() => { this.servicePoll(); - L.Poll.start(); + poll.start(); }); }, - fileEditDialog: L.Class.extend({ + fileEditDialog: baseclass.extend({ __init__: function(file, title, description, callback, fileExists=false) { this.file = file; this.title = title; @@ -553,7 +556,7 @@ return L.view.extend({ o.value(10, "10 " + _('sec')); if(this.currentAppMode !== '0') { - L.Poll.add( + poll.add( L.bind((this.currentAppMode === '2') ? this.servicePoll : this.uiPoll, this), this.pollInterval ); diff --git a/luci-app-internet-detector/htdocs/luci-static/resources/view/status/include/00_internet.js b/luci-app-internet-detector/htdocs/luci-static/resources/view/status/include/00_internet.js index 4073cde..a4ecfee 100644 --- a/luci-app-internet-detector/htdocs/luci-static/resources/view/status/include/00_internet.js +++ b/luci-app-internet-detector/htdocs/luci-static/resources/view/status/include/00_internet.js @@ -1,8 +1,9 @@ 'use strict'; +'require baseclass'; 'require fs'; 'require uci'; -return L.Class.extend({ +return baseclass.extend({ title : _('Internet'), execPath : '/usr/bin/internet-detector', inetStatus : null, @@ -36,7 +37,6 @@ return L.Class.extend({ }; window.internetDetectorCounter = 0; - return L.resolveDefault(fs.exec(this.execPath, [ 'inet-status' ]), null); } else { diff --git a/luci-app-internet-detector/luasrc/controller/internet-detector.lua b/luci-app-internet-detector/luasrc/controller/internet-detector.lua deleted file mode 100644 index a01dc91..0000000 --- a/luci-app-internet-detector/luasrc/controller/internet-detector.lua +++ /dev/null @@ -1,8 +0,0 @@ - -module('luci.controller.internet-detector', package.seeall) - -function index() - if nixio.fs.access('/usr/bin/internet-detector', 'x') then - entry({'admin', 'services', 'internet-detector'}, view('internet-detector'), _('Internet detector'), 10).acl_depends = { 'luci-app-internet-detector' } - end -end