mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-13 14:10:59 +00:00
Changes for OpenWrt 21.02
This commit is contained in:
@@ -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"
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
+29
-29
@@ -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(
|
||||
/</g, '<').replace(
|
||||
@@ -198,8 +199,8 @@ return L.Class.extend({
|
||||
null,
|
||||
this.logHosts,
|
||||
{
|
||||
id: 'logHostsDropdown',
|
||||
multiple: true,
|
||||
id : 'logHostsDropdown',
|
||||
multiple : true,
|
||||
select_placeholder: _('All'),
|
||||
}
|
||||
);
|
||||
@@ -207,7 +208,7 @@ return L.Class.extend({
|
||||
'div', { 'class': 'cbi-value' }, [
|
||||
E('label', {
|
||||
'class': 'cbi-value-title',
|
||||
'for': 'logHostsDropdown',
|
||||
'for' : 'logHostsDropdown',
|
||||
}, _('Hosts')),
|
||||
E('div', { 'class': 'cbi-value-field' },
|
||||
this.logHostsDropdown.render()
|
||||
@@ -221,9 +222,9 @@ return L.Class.extend({
|
||||
null,
|
||||
this.logLevels,
|
||||
{
|
||||
id: 'logLevelsDropdown',
|
||||
sort: Object.keys(this.logLevels),
|
||||
multiple: true,
|
||||
id : 'logLevelsDropdown',
|
||||
sort : Object.keys(this.logLevels),
|
||||
multiple : true,
|
||||
select_placeholder: _('All'),
|
||||
}
|
||||
);
|
||||
@@ -231,7 +232,7 @@ return L.Class.extend({
|
||||
'div', { 'class': 'cbi-value' }, [
|
||||
E('label', {
|
||||
'class': 'cbi-value-title',
|
||||
'for': 'logLevelsDropdown',
|
||||
'for' : 'logLevelsDropdown',
|
||||
}, _('Logging levels')),
|
||||
E('div', { 'class': 'cbi-value-field' },
|
||||
this.logLevelsDropdown.render()
|
||||
@@ -324,7 +325,7 @@ return L.Class.extend({
|
||||
},
|
||||
|
||||
makeLogArea: function(logdataArray) {
|
||||
let lines = `<div class="tr"><div class="td center log-entry-empty">${_('No entries available...')}</div></div>`;
|
||||
let lines = `<div class="tr"><div class="td center log-entry-empty">${_('No entries available...')}</div></div>`;
|
||||
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,
|
||||
}),
|
||||
})
|
||||
|
||||
@@ -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'),
|
||||
|
||||
|
||||
@@ -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'));
|
||||
};
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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')),
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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
|
||||
@@ -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 <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
||||
@@ -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 <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
||||
@@ -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 <https://github.com/gSpotx2f/ruantiblock_openwrt>
|
||||
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user