diff --git a/autoinstall/autoinstall.sh b/autoinstall/autoinstall.sh index edc77f4..dce07b6 100755 --- a/autoinstall/autoinstall.sh +++ b/autoinstall/autoinstall.sh @@ -8,10 +8,10 @@ RAM_CONFIG=0 LUA_MODULE=1 LUCI_APP=1 -OWRT_VERSION="19.07" -RUAB_VERSION="0.9.0-2" -RUAB_MOD_LUA_VERSION="0.9.0-2" -RUAB_LUCI_APP_VERSION="0.9.0-7" +OWRT_VERSION="current" +RUAB_VERSION="0.9.0-3" +RUAB_MOD_LUA_VERSION="0.9.0-3" +RUAB_LUCI_APP_VERSION="0.9.0-8" BASE_URL="https://github.com/gSpotx2f/packages-openwrt/raw/master" PKG_DIR="/tmp" diff --git a/luci-app-ruantiblock/Makefile b/luci-app-ruantiblock/Makefile index 527dd81..b71b624 100644 --- a/luci-app-ruantiblock/Makefile +++ b/luci-app-ruantiblock/Makefile @@ -4,8 +4,7 @@ include $(TOPDIR)/rules.mk -PKG_VERSION:=0.9.0 -PKG_RELEASE:=7 +PKG_VERSION:=0.9.0-8 LUCI_TITLE:=LuCI support for ruantiblock LUCI_DEPENDS:=+ruantiblock LUCI_PKGARCH:=all diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js index cf2fb8f..406b06b 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/abstract-log.js @@ -1,5 +1,7 @@ 'use strict'; +'require baseclass'; 'require ui'; +'require view'; document.head.append(E('style', {'type': 'text/css'}, ` @@ -132,9 +134,8 @@ log-emerg td { } `)); -return L.Class.extend({ - view: L.view.extend({ - +return baseclass.extend({ + view: view.extend({ /** * View name (for local storage and downloads). * Must be overridden by a subclass! @@ -148,14 +149,14 @@ return L.Class.extend({ title : null, logLevels : { - 'emerg': E('span', { 'class': 'zonebadge log-emerg' }, E('strong', _('Emergency'))), - 'alert': E('span', { 'class': 'zonebadge log-alert' }, E('strong', _('Alert'))), - 'crit': E('span', { 'class': 'zonebadge log-crit' }, E('strong', _('Critical'))), - 'err': E('span', { 'class': 'zonebadge log-err' }, E('strong', _('Error'))), - 'warn': E('span', { 'class': 'zonebadge log-warn' }, E('strong', _('Warning'))), - 'notice': E('span', { 'class': 'zonebadge log-notice' }, E('strong', _('Notice'))), - 'info': E('span', { 'class': 'zonebadge log-info' }, E('strong', _('Info'))), - 'debug': E('span', { 'class': 'zonebadge log-debug' }, E('strong', _('Debug'))), + 'emerg' : E('span', { 'class': 'zonebadge log-emerg' }, E('strong', _('Emergency'))), + 'alert' : E('span', { 'class': 'zonebadge log-alert' }, E('strong', _('Alert'))), + 'crit' : E('span', { 'class': 'zonebadge log-crit' }, E('strong', _('Critical'))), + 'err' : E('span', { 'class': 'zonebadge log-err' }, E('strong', _('Error'))), + 'warn' : E('span', { 'class': 'zonebadge log-warn' }, E('strong', _('Warning'))), + 'notice': E('span', { 'class': 'zonebadge log-notice' }, E('strong', _('Notice'))), + 'info' : E('span', { 'class': 'zonebadge log-info' }, E('strong', _('Info'))), + 'debug' : E('span', { 'class': 'zonebadge log-debug' }, E('strong', _('Debug'))), }, tailValue : 25, @@ -176,7 +177,7 @@ return L.Class.extend({ totalLogLines : 0, - htmlEntities : function(str) { + htmlEntities: function(str) { return String(str).replace( /&/g, '&').replace( /
${_('No entries available...')}
`; + let lines = `
${_('No entries available...')}
`; let logTable = E('div', { 'id': 'logTable', 'class': 'table' }); for(let level of Object.keys(this.logLevels)) { @@ -420,7 +421,6 @@ return L.Class.extend({ if(logSortingLocal) { this.logSortingValue = logSortingLocal; }; - return this.getLogData(this.tailValue); }, @@ -431,12 +431,12 @@ return L.Class.extend({ }, this.makeLogArea(this.parseLogData(logdata, this.tailValue))); let tailInput = E('input', { - 'id' : 'tailInput', - 'name' : 'tailInput', - 'type' : 'text', - 'form' : 'logForm', - 'class': 'cbi-input-text', - 'style': 'width:4em !important; min-width:4em !important', + 'id' : 'tailInput', + 'name' : 'tailInput', + 'type' : 'text', + 'form' : 'logForm', + 'class' : 'cbi-input-text', + 'style' : 'width:4em !important; min-width:4em !important', 'maxlength': 5, }); tailInput.value = (this.tailValue === 0) ? null : this.tailValue; @@ -461,7 +461,7 @@ return L.Class.extend({ logLevelsDropdownElem = this.makeLogLevelsDropdownSection(); }; if(this.isHosts) { - logHostsDropdownElem = this.makeLogHostsDropdownSection(); + logHostsDropdownElem = this.makeLogHostsDropdownSection(); }; let logFilter = E('input', { @@ -633,8 +633,8 @@ return L.Class.extend({ ]); }, - handleSave : null, handleSaveApply: null, + handleSave : null, handleReset : null, }), }) diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/cron.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/cron.js index 7484db6..9045b55 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/cron.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/cron.js @@ -1,9 +1,10 @@ 'use strict'; 'require fs'; 'require ui'; +'require view'; 'require view.ruantiblock.tools as tools'; -return L.view.extend({ +return view.extend({ crontabRegexp: new RegExp( `^(\\*?\\/?(\\d){0,2}\\s){5}${tools.execPath} update(\n)?`, 'gm'), diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/info.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/info.js index f209831..6bf002e 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/info.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/info.js @@ -1,15 +1,17 @@ 'use strict'; 'require fs'; +'require poll'; 'require ui'; +'require view'; 'require view.ruantiblock.tools as tools'; -return L.view.extend({ +return view.extend({ infoPoll: function() { return fs.exec_direct(tools.execPath, [ 'html-info' ], 'json').catch(e => { ui.addNotification(null, E('p', _('Unable to execute or read contents') + ': %s [ %s ]'.format(e.message, tools.execPath) )); - L.Poll.stop(); + poll.stop(); }).then(data => { if(!data) { return; @@ -71,8 +73,8 @@ return L.view.extend({ }; }; } else { - if(L.Poll.active()) { - L.Poll.stop(); + if(poll.active()) { + poll.stop(); }; }; }); @@ -151,6 +153,7 @@ return L.view.extend({ for(let [k, v] of Object.entries(data.iptables)) { if(k === '_dummy') continue; + table_iptables.append( E('div', { 'class': 'tr' }, [ E('div', { @@ -190,7 +193,7 @@ return L.view.extend({ table_ipset.append( E('div', { 'class': 'tr' }, [ E('div', { - 'class' : 'td left', + 'class': 'td left', 'data-title': _('Name'), }, k), E('div', { @@ -213,7 +216,7 @@ return L.view.extend({ ]); }; - L.Poll.add(this.infoPoll); + poll.add(this.infoPoll); } else { update_status = E('em', {}, _('Status') + ' : ' + _('disabled')); }; diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log.js index cc592d0..c3feb72 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/log.js @@ -4,9 +4,9 @@ 'require view.ruantiblock.tools as tools'; return abc.view.extend({ - viewName: 'ruantiblock', + viewName : 'ruantiblock', - title: _('Ruantiblock') + ' - ' + _('Log'), + title : _('Ruantiblock') + ' - ' + _('Log'), appRegexp : new RegExp(`^.*${tools.appName}\[[0-9]+\].*$`, 'gm'), @@ -20,12 +20,12 @@ return abc.view.extend({ logdHandler: function(strArray, lineNum) { let logLevel = strArray[5].split('.'); return [ - lineNum, // # (Number) - strArray.slice(0, 5).join(' '), // Timestamp (String) - null, // Host (String) - logLevel[1], // Level (String) - logLevel[0], // Facility (String) - this.htmlEntities(strArray.slice(6).join(' ')), // Message (String) + lineNum, // # (Number) + strArray.slice(0, 5).join(' '), // Timestamp (String) + null, // Host (String) + logLevel[1], // Level (String) + logLevel[0], // Facility (String) + this.htmlEntities(strArray.slice(6).join(' ')), // Message (String) ]; }, @@ -36,12 +36,12 @@ return abc.view.extend({ }; return [ - lineNum, // # (Number) - strArray.slice(0, 3).join(' '), // Timestamp (String) - strArray[3], // Host (String) - null, // Level (String) - null, // Facility (String) - this.htmlEntities(strArray.slice(4).join(' ')), // Message (String) + lineNum, // # (Number) + strArray.slice(0, 3).join(' '), // Timestamp (String) + strArray[3], // Host (String) + null, // Level (String) + null, // Facility (String) + this.htmlEntities(strArray.slice(4).join(' ')), // Message (String) ]; }, @@ -84,11 +84,11 @@ return abc.view.extend({ * If it contains time then syslog-ng. */ if(this.testRegexp.test(strArray[2])) { - this.isHosts = true; - this.logLevels = {}; + this.isHosts = true; + this.logLevels = {}; this.entriesHandler = this.syslog_ngHandler; } else { - this.isLevels = true; + this.isLevels = true; this.entriesHandler = this.logdHandler; }; this.isLoggerChecked = true; diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js index 08866df..12078f3 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/service.js @@ -1,7 +1,9 @@ 'use strict'; 'require fs'; +'require poll'; 'require uci'; 'require ui'; +'require view'; 'require view.ruantiblock.tools as tools'; const btn_style_neutral = 'btn' @@ -10,7 +12,7 @@ const btn_style_positive = 'btn cbi-button-save important'; const btn_style_negative = 'btn cbi-button-reset important'; const btn_style_warning = 'btn cbi-button-negative important' -return L.view.extend({ +return view.extend({ statusTokenValue: null, disableButtons: function(bool, btn, elems=[]) { @@ -155,8 +157,8 @@ return L.view.extend({ tp_status_code, vpn_route_status_code); - if(!L.Poll.active()) { - L.Poll.start(); + if(!poll.active()) { + poll.start(); }; }, @@ -166,7 +168,7 @@ return L.view.extend({ this.disableButtons(true, elem); }; - L.Poll.stop(); + poll.stop(); return tools.handleServiceAction(tools.appName, action).then(() => { return this.getAppStatus().then( @@ -183,7 +185,7 @@ return L.view.extend({ this.disableButtons(true, elem); }; - L.Poll.stop(); + poll.stop(); if(action === 'update') { this.getAppStatus().then(status_array => { @@ -326,7 +328,7 @@ return L.view.extend({ btn_destroy, ]); - L.Poll.add(L.bind(this.statusPoll, this)); + poll.add(L.bind(this.statusPoll, this)); return E([ E('h2', { 'class': 'fade-in' }, _('Ruantiblock')), diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/settings.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/settings.js index 3ffd645..e7a060f 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/settings.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/settings.js @@ -4,9 +4,10 @@ 'require form'; 'require ui'; 'require tools.widgets as widgets'; +'require view'; 'require view.ruantiblock.tools as tools'; -return L.view.extend({ +return view.extend({ availableParsers: {}, appStatusCode : null, diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js index bc5896c..dffd269 100644 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js +++ b/luci-app-ruantiblock/htdocs/luci-static/resources/view/ruantiblock/tools.js @@ -1,4 +1,5 @@ 'use strict'; +'require baseclass'; 'require fs'; 'require rpc'; 'require ui'; @@ -35,7 +36,7 @@ document.head.append(E('style', {'type': 'text/css'}, } `)); -return L.Class.extend({ +return baseclass.extend({ appName : 'ruantiblock', execPath : '/usr/bin/ruantiblock', tokenFile : '/var/run/ruantiblock.token', @@ -191,7 +192,7 @@ return L.Class.extend({ ); }, - fileEditDialog: L.Class.extend({ + fileEditDialog: baseclass.extend({ __init__: function(file, title, description, callback, file_exists=false) { this.file = file; this.title = title; diff --git a/luci-app-ruantiblock/luasrc/controller/ruantiblock.lua b/luci-app-ruantiblock/luasrc/controller/ruantiblock.lua deleted file mode 100644 index de6cbf9..0000000 --- a/luci-app-ruantiblock/luasrc/controller/ruantiblock.lua +++ /dev/null @@ -1,13 +0,0 @@ - -module('luci.controller.ruantiblock', package.seeall) - -function index() - if nixio.fs.access('/etc/config/ruantiblock') and nixio.fs.access('/usr/bin/ruantiblock') then - entry({'admin', 'services', 'ruantiblock'}, firstchild(), _('Ruantiblock'), 60).acl_depends = { 'luci-app-ruantiblock' } - entry({'admin', 'services', 'ruantiblock', 'service'}, view('ruantiblock/service'), _('Service'), 10) - entry({'admin', 'services', 'ruantiblock', 'settings'}, view('ruantiblock/settings'), _('Settings'), 20) - entry({'admin', 'services', 'ruantiblock', 'cron'}, view('ruantiblock/cron'), _('Blacklist updates'), 30) - entry({'admin', 'services', 'ruantiblock', 'info'}, view('ruantiblock/info'), _('Statistics'), 40) - entry({'admin', 'services', 'ruantiblock', 'log'}, view('ruantiblock/log'), _('Log'), 50) - end -end diff --git a/ruantiblock-mod-lua/Makefile b/ruantiblock-mod-lua/Makefile index 8452161..d15a6a2 100644 --- a/ruantiblock-mod-lua/Makefile +++ b/ruantiblock-mod-lua/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ruantiblock-mod-lua PKG_VERSION:=0.9.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=gSpot PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/ruantiblock-mod-py/Makefile b/ruantiblock-mod-py/Makefile index 5e16a74..22c4245 100644 --- a/ruantiblock-mod-py/Makefile +++ b/ruantiblock-mod-py/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ruantiblock-mod-py PKG_VERSION:=0.9.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=gSpot PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME) diff --git a/ruantiblock/Makefile b/ruantiblock/Makefile index f30ff58..47fa219 100644 --- a/ruantiblock/Makefile +++ b/ruantiblock/Makefile @@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=ruantiblock PKG_VERSION:=0.9.0 -PKG_RELEASE:=2 +PKG_RELEASE:=3 PKG_MAINTAINER:=gSpot PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)