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
@@ -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' ],