diff --git a/autoinstall/autoinstall.sh b/autoinstall/autoinstall.sh index 85fede1..b8862c4 100755 --- a/autoinstall/autoinstall.sh +++ b/autoinstall/autoinstall.sh @@ -10,6 +10,8 @@ LUCI_APP=1 OWRT_VERSION="19.07" RUAB_VERSION="0.9.0-1" +RUAB_MOD_LUA_VERSION="0.9.0-1" +RUAB_LUCI_APP_VERSION="0.9.0-2" BASE_URL="https://raw.githubusercontent.com/gSpotx2f/ruantiblock_openwrt/master" PKG_DIR="/tmp" @@ -21,9 +23,9 @@ fi ### packages URL_RUAB_PKG="${BASE_URL}/packages/${OWRT_VERSION}/ruantiblock_${RUAB_VERSION}_all.ipk" -URL_MOD_LUA_PKG="${BASE_URL}/packages/${OWRT_VERSION}/ruantiblock-mod-lua_${RUAB_VERSION}_all.ipk" -URL_LUCI_APP_PKG="${BASE_URL}/packages/${OWRT_VERSION}/luci-app-ruantiblock_${RUAB_VERSION}_all.ipk" -URL_LUCI_APP_RU_PKG="${BASE_URL}/packages/${OWRT_VERSION}/luci-i18n-ruantiblock-ru_${RUAB_VERSION}_all.ipk" +URL_MOD_LUA_PKG="${BASE_URL}/packages/${OWRT_VERSION}/ruantiblock-mod-lua_${RUAB_MOD_LUA_VERSION}_all.ipk" +URL_LUCI_APP_PKG="${BASE_URL}/packages/${OWRT_VERSION}/luci-app-ruantiblock_${RUAB_LUCI_APP_VERSION}_all.ipk" +URL_LUCI_APP_RU_PKG="${BASE_URL}/packages/${OWRT_VERSION}/luci-i18n-ruantiblock-ru_${RUAB_LUCI_APP_VERSION}_all.ipk" ### tor URL_TORRC="${BASE_URL}/tor/etc/tor/torrc" ### ruantiblock-mod-lua @@ -40,9 +42,9 @@ DATA_DIR_RAM="/var/ruantiblock" RC_LOCAL="/etc/rc.local" ### packages FILE_RUAB_PKG="${PKG_DIR}/ruantiblock_${RUAB_VERSION}_all.ipk" -FILE_MOD_LUA_PKG="${PKG_DIR}/ruantiblock-mod-lua_${RUAB_VERSION}_all.ipk" -FILE_LUCI_APP_PKG="${PKG_DIR}/luci-app-ruantiblock_${RUAB_VERSION}_all.ipk" -FILE_LUCI_APP_RU_PKG="${PKG_DIR}/luci-i18n-ruantiblock-ru_${RUAB_VERSION}_all.ipk" +FILE_MOD_LUA_PKG="${PKG_DIR}/ruantiblock-mod-lua_${RUAB_MOD_LUA_VERSION}_all.ipk" +FILE_LUCI_APP_PKG="${PKG_DIR}/luci-app-ruantiblock_${RUAB_LUCI_APP_VERSION}_all.ipk" +FILE_LUCI_APP_RU_PKG="${PKG_DIR}/luci-i18n-ruantiblock-ru_${RUAB_LUCI_APP_VERSION}_all.ipk" ### ruantiblock FILE_CONFIG="${RUAB_CFG_DIR}/ruantiblock.conf" FILE_FQDN_FILTER="${RUAB_CFG_DIR}/fqdn_filter" diff --git a/luci-app-ruantiblock/Makefile b/luci-app-ruantiblock/Makefile index 1821eec..eaa1ef4 100644 --- a/luci-app-ruantiblock/Makefile +++ b/luci-app-ruantiblock/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_VERSION:=0.9.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 LUCI_TITLE:=LuCI support for ruantiblock LUCI_DEPENDS:=+ruantiblock +luci-mod-admin-full LUCI_PKGARCH:=all 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 db4b56e..7652f8f 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 @@ -94,7 +94,6 @@ function onchange_hour_interval(e) { cron_hour.disabled = bool; cron_day_interval.disabled = bool; - // For luci-theme-material if(bool) { cron_hour.style.opacity = '50%'; cron_day_interval.style.opacity = '50%'; @@ -121,7 +120,7 @@ return L.view.extend({ let cron_status = E('textarea', { 'id': 'cron_status', 'name': 'cron_status', - 'style': 'width:30em; padding:5px 10px 5px 10px !important; vertical-align:middle; resize:none !important;', + 'style': 'width:100% !important; padding:5px 10px 5px 10px !important; resize:none !important;', 'readonly': 'readonly', 'wrap': 'off', 'rows': 2, @@ -139,7 +138,11 @@ return L.view.extend({ E('div', { 'class': 'cbi-value' }, [ E('label', { 'class': 'cbi-value-title', 'for': 'cron_status' }, _('Current schedule')), - E('div', { 'class': 'cbi-value-field' }, [ cron_status, ' ', btn_cron_del ]), + E('div', { 'class': 'cbi-value-field' }, cron_status), + ]), + E('div', { 'class': 'cbi-value' }, [ + E('label', { 'class': 'cbi-value-title', 'for': 'btn_cron_del' }), + E('div', { 'class': 'cbi-value-field' }, btn_cron_del), ]) ]); 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 4b9b03d..2e3b047 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 @@ -105,23 +105,23 @@ return L.view.extend({ if(data.last_blacklist_update.status) { update_status.append( E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left', 'width': '33%' }, - _('Last blacklist update')), + E('div', { 'class': 'td left', 'style': 'min-width:33%' }, + _('Last blacklist update') + ':'), E('div', { 'class': 'td left', 'id': 'last_blacklist_update.date' }, data.last_blacklist_update.date), ]), E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left', 'width': '33%' }, 'IP'), + E('div', { 'class': 'td left' }, 'IP:'), E('div', { 'class': 'td left', 'id': 'last_blacklist_update.ip' }, data.last_blacklist_update.ip), ]), E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left', 'width': '33%' }, 'CIDR'), + E('div', { 'class': 'td left' }, 'CIDR:'), E('div', { 'class': 'td left', 'id': 'last_blacklist_update.cidr' }, data.last_blacklist_update.cidr), ]), E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left', 'width': '33%' }, 'FQDN'), + E('div', { 'class': 'td left' }, 'FQDN:'), E('div', { 'class': 'td left', 'id': 'last_blacklist_update.fqdn' }, data.last_blacklist_update.fqdn), ]) @@ -129,7 +129,7 @@ return L.view.extend({ } else { update_status.append( E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left', 'width': '33%' }, + E('div', { 'class': 'td left' }, _('Last blacklist update')), E('div', { 'class': 'td left' }, _('No data')), ]) @@ -139,7 +139,7 @@ return L.view.extend({ if(data.iptables) { let table_iptables = E('div', { 'class': 'table' }, [ E('div', { 'class': 'tr table-titles' }, [ - E('div', { 'class': 'th left', 'width': '33%' }, + E('div', { 'class': 'th left', 'style': 'min-width:33%' }, _('Match-set')), E('div', { 'class': 'th left' }, _('Bytes')), ]), @@ -150,10 +150,15 @@ return L.view.extend({ table_iptables.append( E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left', 'width': '33%' }, - k), - E('div', { 'class': 'td left', 'id': 'iptables.' + k }, - v), + E('div', { + 'class': 'td left', + 'data-title': _('Match-set'), + }, k), + E('div', { + 'class': 'td left', + 'id': 'iptables.' + k, + 'data-title': _('Bytes'), + }, v), ]) ); }; @@ -167,7 +172,7 @@ return L.view.extend({ if(data.ipset) { let table_ipset = E('div', { 'class': 'table' }, E('div', { 'class': 'tr table-titles' }, [ - E('div', { 'class': 'th left', 'width': '33%' }, _('Name')), + E('div', { 'class': 'th left', 'style': 'min-width:33%' }, _('Name')), E('div', { 'class': 'th left' }, _('Size in memory')), E('div', { 'class': 'th left' }, _('Number of entries')), ]) @@ -178,11 +183,20 @@ return L.view.extend({ table_ipset.append( E('div', { 'class': 'tr' }, [ - E('div', { 'class': 'td left', 'width': '33%' }, k), - E('div', { 'class': 'td left', 'id': 'ipset.' + k + '.' + '0' }, - v[0]), - E('div', { 'class': 'td left', 'id': 'ipset.' + k + '.' + '1' }, - v[1]), + E('div', { + 'class': 'td left', + 'data-title': _('Name'), + }, k), + E('div', { + 'class': 'td left', + 'id': 'ipset.' + k + '.' + '0', + 'data-title': _('Size in memory'), + }, v[0]), + E('div', { + 'class': 'td left', + 'id': 'ipset.' + k + '.' + '1', + 'data-title': _('Number of entries'), + }, v[1]), ]) ); }; 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 b6786a5..438cde2 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 @@ -31,13 +31,13 @@ return L.view.extend({ }, render: function(logdata) { - let nav_btns_top = '120px'; + let nav_btns_top = '1px'; let loglines = this.parse_log_data(logdata); let log_textarea = E('textarea', { 'id': 'syslog', 'class': 'cbi-input-textarea', - 'style': 'width:100% !important; padding: 0 0 0 45px; font-size:12px', + 'style': 'width:100% !important; resize:horizontal; padding: 0 0 0 45px; font-size:12px', 'readonly': 'readonly', 'wrap': 'off', 'rows': this.tail_default, @@ -50,7 +50,7 @@ return L.view.extend({ 'type': 'text', 'form': 'log_form', 'class': 'cbi-input-text', - 'style': 'width:4em !important; min-width:4em !important', + 'style': 'width:4em !important; min-width:4em !important; margin-bottom:0.3em !important', 'maxlength': 5, }); tail_value.value = this.tail_default; @@ -62,7 +62,7 @@ return L.view.extend({ 'type': 'text', 'form': 'log_form', 'class': 'cbi-input-text', - 'style': 'margin-left:1em !important; width:16em !important; min-width:16em !important', + 'style': 'min-width:16em !important; margin-right:1em !important; margin-bottom:0.3em !important', 'placeholder': _('Message filter'), 'data-tooltip': _('Filter messages with a regexp'), }); @@ -70,8 +70,8 @@ return L.view.extend({ let log_form_submit_btn = E('input', { 'type': 'submit', 'form': 'log_form', - 'class': 'cbi-button btn', - 'style': 'margin-left:1em !important; vertical-align:middle', + 'class': 'cbi-button btn cbi-button-action', + 'style': 'margin-right:1em !important; margin-bottom:0.3em !important;', 'value': _('Apply'), 'click': ev => ev.target.blur(), }); @@ -113,8 +113,11 @@ return L.view.extend({ E('div', { 'class': 'cbi-section fade-in' }, E('div', { 'class': 'cbi-section-node' }, E('div', { 'class': 'cbi-value' }, [ - E('label', { 'class': 'cbi-value-title', 'for': 'tail_value' }, - _('Show only the last messages')), + E('label', { + 'class': 'cbi-value-title', + 'for': 'tailValue', + 'style': 'margin-bottom:0.3em !important', + }, _('Show only the last messages')), E('div', { 'class': 'cbi-value-field' }, [ tail_value, E('input', { @@ -127,25 +130,14 @@ return L.view.extend({ log_form_submit_btn.click(); ev.target.blur(); }, - + 'style': 'margin-right:1em !important; margin-bottom:0.3em !important; max-width:4em !important', }), log_filter, - E('input', { - 'type': 'button', - 'form': 'log_form', - 'class': 'cbi-button btn cbi-button-reset', - 'value': 'Χ', - 'click': ev => { - log_filter.value = null; - log_form_submit_btn.click(); - ev.target.blur(); - }, - }), log_form_submit_btn, E('form', { 'id': 'log_form', 'name': 'log_form', - 'style': 'display:inline-block; margin-left:1em !important', + 'style': 'display:inline-block; margin-bottom:0.3em !important', 'submit': ui.createHandlerFn(this, function(ev) { ev.preventDefault(); let form_elems = Array.from(document.forms.log_form.elements); @@ -154,6 +146,8 @@ return L.view.extend({ return this.load().then(logdata => { let loglines = set_log_filter(set_log_tail( this.parse_log_data(logdata))); + log_textarea.rows = (loglines.length < this.tail_default) ? + this.tail_default : loglines.length; log_textarea.value = loglines.join('\n'); }).finally(() => { form_elems.forEach(e => e.disabled = false); @@ -173,7 +167,7 @@ return L.view.extend({ 'style': 'position:relative; display:block; margin:0 !important; left:1px; top:' + nav_btns_top, 'click': ev => { - log_textarea.scrollTop = 0; + document.getElementById('log_title').scrollIntoView(true); ev.target.blur(); }, }, '↑'), @@ -182,7 +176,7 @@ return L.view.extend({ 'style': 'position:relative; display:block; margin:0 !important; margin-top:1px !important; left:1px; top:' + nav_btns_top, 'click': ev => { - log_textarea.scrollTop = log_textarea.scrollHeight; + log_textarea.scrollIntoView(false); ev.target.blur(); }, }, '↓'), 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 c33de5c..c278fe3 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 @@ -247,6 +247,7 @@ return L.view.extend({ o.description = _('e.g:') + ' 192.168.1.'; o.placeholder = _('e.g:') + ' 192.168.1.'; o.default = ''; + depends_bllist_module(o); // SUMMARIZE_IP 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 b30a301..671498a 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 @@ -89,8 +89,8 @@ return L.Class.extend({ app_status_label = this.info_label_error; return `
-
- ${_('Status')} +
+ ${_('Status')}:
${app_status_label} @@ -101,24 +101,24 @@ return L.Class.extend({ return `
-
- ${_('Status')} +
+ ${_('Status')}:
%s %s %s
-
- ${_('Proxy mode')} +
+ ${_('Proxy mode')}:
%s
-
- ${_('Blacklist update mode')} +
+ ${_('Blacklist update mode')}:
%s @@ -136,16 +136,17 @@ return L.Class.extend({ + _('VPN routing error! Need restart') + '' : '', (proxy_mode == 1) ? 'Tor' : 'VPN', (!bllist_module || bllist_module === '') ? _('user entries only') : bllist_mode, - (!bllist_module || bllist_module === '') ? '' : `
-
- ${_('Blacklist source')} -
-
- - ${bllist_source} - -
-
` + (!bllist_module || bllist_module === '') ? '' : + `
+
+ ${_('Blacklist source')}: +
+
+ + ${bllist_source} + +
+
` ); }, diff --git a/luci-app-ruantiblock/htdocs/luci-static/resources/view/status/include/80_ruantiblock.js b/luci-app-ruantiblock/htdocs/luci-static/resources/view/status/include/80_ruantiblock.js deleted file mode 100644 index fed3e8d..0000000 --- a/luci-app-ruantiblock/htdocs/luci-static/resources/view/status/include/80_ruantiblock.js +++ /dev/null @@ -1,51 +0,0 @@ -'use strict'; -'require fs'; -'require uci'; -'require view.ruantiblock.tools as tools'; - -return L.Class.extend({ - title: _('Ruantiblock'), - - load: function() { - return Promise.all([ - fs.exec(tools.exec_path, [ 'raw-status' ]), - fs.exec(tools.exec_path, [ 'total-proxy-status' ]), - fs.exec(tools.exec_path, [ 'vpn-route-status' ]), - uci.load('ruantiblock'), - ]).catch(e => {}); - }, - - render: function(status_array) { - if(!status_array) { - return E('em', _('Error') + ': ' + _('Unable to execute or read contents')); - }; - - let app_status_code = status_array[0].code; - let tp_status_code = status_array[1].code; - let vpn_route_status_code = status_array[2].code; - - let section = uci.get('ruantiblock', 'config'); - let proxy_local_clients, proxy_mode, bllist_mode, bllist_module, bllist_source; - - if(typeof(section) === 'object') { - proxy_local_clients = section.proxy_local_clients; - proxy_mode = section.proxy_mode; - bllist_mode = section.bllist_mode; - bllist_module = section.bllist_module; - bllist_source = section.bllist_source; - } else { - return _('Error'); - }; - - document.head.append(E('style', { 'type': 'text/css' }, tools.css)); - - return E('div', { 'class': 'cbi-section' }).innerHTML = tools.make_status_string( - app_status_code, - proxy_mode, - bllist_mode, - bllist_module, - bllist_source, - tp_status_code, - vpn_route_status_code); - }, -}); diff --git a/luci-i18n-ruantiblock-ru/Makefile b/luci-i18n-ruantiblock-ru/Makefile index d8e334c..fc37880 100644 --- a/luci-i18n-ruantiblock-ru/Makefile +++ b/luci-i18n-ruantiblock-ru/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_VERSION:=0.9.0 -PKG_RELEASE:=1 +PKG_RELEASE:=2 LUCI_TITLE:=Translation for luci-app-ruantiblock - Русский (Russian) LUCI_DEPENDS:=+luci-app-ruantiblock LUCI_PKGARCH:=all diff --git a/packages/19.07/luci-app-ruantiblock_0.9.0-1_all.ipk b/packages/19.07/luci-app-ruantiblock_0.9.0-1_all.ipk deleted file mode 100644 index 6114c2d..0000000 Binary files a/packages/19.07/luci-app-ruantiblock_0.9.0-1_all.ipk and /dev/null differ diff --git a/packages/19.07/luci-app-ruantiblock_0.9.0-2_all.ipk b/packages/19.07/luci-app-ruantiblock_0.9.0-2_all.ipk new file mode 100644 index 0000000..348ce3a Binary files /dev/null and b/packages/19.07/luci-app-ruantiblock_0.9.0-2_all.ipk differ diff --git a/packages/19.07/luci-i18n-ruantiblock-ru_0.9.0-1_all.ipk b/packages/19.07/luci-i18n-ruantiblock-ru_0.9.0-1_all.ipk deleted file mode 100644 index abad7f2..0000000 Binary files a/packages/19.07/luci-i18n-ruantiblock-ru_0.9.0-1_all.ipk and /dev/null differ diff --git a/packages/19.07/luci-i18n-ruantiblock-ru_0.9.0-2_all.ipk b/packages/19.07/luci-i18n-ruantiblock-ru_0.9.0-2_all.ipk new file mode 100644 index 0000000..29b8dee Binary files /dev/null and b/packages/19.07/luci-i18n-ruantiblock-ru_0.9.0-2_all.ipk differ