v1.6. Refactoring. Some improvements.

This commit is contained in:
gSpot
2024-09-23 00:52:58 +03:00
parent fd2dd3d165
commit 8184a68fe8
21 changed files with 432 additions and 303 deletions
+1 -1
View File
@@ -4,7 +4,7 @@
include $(TOPDIR)/rules.mk
PKG_VERSION:=1.5.0-r2
PKG_VERSION:=1.6.0-r1
LUCI_TITLE:=LuCI support for ruantiblock
LUCI_DEPENDS:=+ruantiblock
LUCI_PKGARCH:=all
@@ -115,6 +115,20 @@ return view.extend({
}
);
let gr_excluded_nets_edit = new tools.fileEditDialog(
tools.grExcludedNetsFile,
_('IP subnet patterns (/24) that are excluded from optimization'),
_('One IP subnet pattern (/24) per line. You can also comment on lines (<code>#</code> is the first character of a line).<br />Examples:') +
'<br /><code>#comment<br />74.125.131.<br />74.125.0.</code>'
);
let gr_excluded_sld_edit = new tools.fileEditDialog(
tools.grExcludedSldFile,
_('2nd level domains that are excluded from optimization'),
_('One FQDN entry per line. You can also comment on lines (<code>#</code> is the first character of a line).<br />Examples:') +
'<br /><code>#comment<br />domain.net<br />anotherdomain.com</code>'
);
let m, s, o;
m = new form.Map(tools.appName, _('Ruantiblock') + ' - ' + _('Settings'));
@@ -381,12 +395,13 @@ return view.extend({
o.rmempty = false;
o.datatype = 'uinteger';
// BLLIST_GR_EXCLUDED_SLD
o = s.taboption('parser_settings_tab', form.DynamicList, 'bllist_gr_excluded_sld',
// BLLIST_GR_EXCLUDED_SLD_FILE edit dialog
o = s.taboption('parser_settings_tab', form.Button, '_gr_excluded_sld_btn',
_('2nd level domains that are excluded from optimization'));
o.description = _('e.g:') + ' <code>livejournal.com</code>';
o.placeholder = _('e.g:') + ' livejournal.com';
o.datatype = 'hostname';
o.onclick = () => gr_excluded_sld_edit.show();
o.inputtitle = _('Edit');
o.inputstyle = 'edit btn';
//o.description = _('e.g:') + ' <code>livejournal.com</code>';
// BLLIST_ENABLE_IDN
o = s.taboption('parser_settings_tab', form.Flag, 'bllist_enable_idn',
@@ -429,15 +444,13 @@ return view.extend({
o.rmempty = false;
o.datatype = 'uinteger';
// BLLIST_GR_EXCLUDED_NETS
o = s.taboption('parser_settings_tab', form.DynamicList, 'bllist_gr_excluded_nets');
o.title = _('IP subnet patterns (/24) that are excluded from optimization');
o.description = _('e.g:') + ' <code>192.168.1.</code>';
o.placeholder = _('e.g:') + ' 192.168.1.';
o.validate = (section, value) => {
return (/^$|^([0-9]{1,3}[.]){3}$/.test(value)) ? true : _('Expecting:')
+ ' ' + _('net pattern') + ' (' + _('e.g:') + ' 192.168.3.)\n';
};
// BLLIST_GR_EXCLUDED_NETS_FILE edit dialog
o = s.taboption('parser_settings_tab', form.Button, '_gr_excluded_nets_btn',
_('IP subnet patterns (/24) that are excluded from optimization'));
o.onclick = () => gr_excluded_nets_edit.show();
o.inputtitle = _('Edit');
o.inputstyle = 'edit btn';
//o.description = _('e.g:') + ' <code>192.168.1.</code>';
// BLLIST_SUMMARIZE_IP
o = s.taboption('parser_settings_tab', form.Flag, 'bllist_summarize_ip',
@@ -34,21 +34,23 @@ document.head.append(E('style', {'type': 'text/css'},
`));
return baseclass.extend({
appName : 'ruantiblock',
execPath : '/usr/bin/ruantiblock',
tokenFile : '/var/run/ruantiblock.token',
parsersDir : '/usr/libexec/ruantiblock',
torrcFile : '/etc/tor/torrc',
userEntriesFile : '/etc/ruantiblock/user_entries',
bypassEntriesFile: '/etc/ruantiblock/bypass_entries',
fqdnFilterFile : '/etc/ruantiblock/fqdn_filter',
ipFilterFile : '/etc/ruantiblock/ip_filter',
crontabFile : '/etc/crontabs/root',
infoLabelStarting: '<span class="label-status starting">' + _('Starting') + '</span>',
infoLabelRunning : '<span class="label-status running">' + _('Enabled') + '</span>',
infoLabelUpdating: '<span class="label-status updating">' + _('Updating') + '</span>',
infoLabelStopped : '<span class="label-status stopped">' + _('Disabled') + '</span>',
infoLabelError : '<span class="label-status error">' + _('Error') + '</span>',
appName : 'ruantiblock',
execPath : '/usr/bin/ruantiblock',
tokenFile : '/var/run/ruantiblock.token',
parsersDir : '/usr/libexec/ruantiblock',
torrcFile : '/etc/tor/torrc',
userEntriesFile : '/etc/ruantiblock/user_entries',
bypassEntriesFile : '/etc/ruantiblock/bypass_entries',
fqdnFilterFile : '/etc/ruantiblock/fqdn_filter',
ipFilterFile : '/etc/ruantiblock/ip_filter',
grExcludedNetsFile: '/etc/ruantiblock/gr_excluded_nets',
grExcludedSldFile : '/etc/ruantiblock/gr_excluded_sld',
crontabFile : '/etc/crontabs/root',
infoLabelStarting : '<span class="label-status starting">' + _('Starting') + '</span>',
infoLabelRunning : '<span class="label-status running">' + _('Enabled') + '</span>',
infoLabelUpdating : '<span class="label-status updating">' + _('Updating') + '</span>',
infoLabelStopped : '<span class="label-status stopped">' + _('Disabled') + '</span>',
infoLabelError : '<span class="label-status error">' + _('Error') + '</span>',
blacklistPresets: {
'ruantiblock-fqdn': [ 'ruantiblock', 'fqdn', 'https://github.com/gSpotx2f/ruantiblock_blacklist' ],
+13
View File
@@ -321,6 +321,19 @@ msgstr ""
"сервер для разрешения данного домена (через пробел). Также, можно "
"комментировать строки (<code>#</code> - первый символ строки).<br />Примеры:"
msgid ""
"One FQDN entry per line. You can also comment on lines "
"(<code>#</code> is the first character of a line).<br />Examples:"
msgstr "Одна запись FQDN на строку. Также, можно "
"комментировать строки (<code>#</code> - первый символ строки).<br />Примеры:"
msgid ""
"One IP subnet pattern (/24) per line. You can also comment on lines "
"(<code>#</code> is the first character of a line).<br />Examples:"
msgstr ""
"Один шаблон IP подсети (/24) на строку Также, можно комментировать "
"строки (<code>#</code> - первый символ строки).<br />Примеры:"
msgid "One of the following:"
msgstr "Одно из следующих значений:"
@@ -299,6 +299,16 @@ msgid ""
">Examples:"
msgstr ""
msgid ""
"One FQDN entry per line. You can also comment on lines "
"(<code>#</code> is the first character of a line).<br />Examples:"
msgstr ""
msgid
"One IP subnet pattern (/24) per line. You can also comment on lines "
"(<code>#</code> is the first character of a line).<br />Examples:"
msgstr ""
msgid "One of the following:"
msgstr ""
@@ -9,6 +9,8 @@
"/etc/ruantiblock/ip_filter": [ "read" ],
"/etc/ruantiblock/user_entries": [ "read" ],
"/etc/ruantiblock/bypass_entries": [ "read" ],
"/etc/ruantiblock/gr_excluded_nets": [ "read" ],
"/etc/ruantiblock/gr_excluded_sld": [ "read" ],
"/var/run/ruantiblock.token": [ "read" ],
"/etc/tor/torrc": [ "read" ],
"/etc/crontabs/root": [ "read" ],
@@ -27,6 +29,8 @@
"/etc/ruantiblock/ip_filter": [ "write" ],
"/etc/ruantiblock/user_entries": [ "write" ],
"/etc/ruantiblock/bypass_entries": [ "write" ],
"/etc/ruantiblock/gr_excluded_nets": [ "write" ],
"/etc/ruantiblock/gr_excluded_sld": [ "write" ],
"/etc/tor/torrc": [ "write" ],
"/etc/crontabs/root": [ "write" ]
},