mirror of
https://github.com/gSpotx2f/ruantiblock_openwrt.git
synced 2026-05-14 06:30:59 +00:00
v1.5. New options: USER_ENTRIES_REMOTE, ENABLE_TMP_DOWNLOADS. Fixes & improvements.
This commit is contained in:
@@ -219,6 +219,7 @@ return view.extend({
|
||||
} catch(e) {};
|
||||
|
||||
let update_status = null,
|
||||
user_entries = null,
|
||||
rules = null,
|
||||
dnsmasq = null,
|
||||
dnsmasqBypass = null;
|
||||
@@ -265,6 +266,21 @@ return view.extend({
|
||||
);
|
||||
};
|
||||
|
||||
if(data.user_entries && data.user_entries.length > 0) {
|
||||
user_entries = E('table', { 'class': 'table' });
|
||||
for(let i of data.user_entries) {
|
||||
user_entries.append(
|
||||
E('tr', { 'class': 'tr' }, [
|
||||
E('td', { 'class': 'td left', 'style': 'min-width:33%' },
|
||||
i.id),
|
||||
E('td', { 'class': 'td left',
|
||||
'id' : 'user_entries_' + i },
|
||||
`CIDR: ${i.cidr}, IP: ${i.ip}, FQDN: ${i.fqdn}`),
|
||||
])
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
let nft_data = this.formatNftJson(data);
|
||||
|
||||
if(nft_data.rules) {
|
||||
@@ -346,8 +362,17 @@ return view.extend({
|
||||
),
|
||||
];
|
||||
|
||||
if(user_entries) {
|
||||
layout.splice(3, 0,
|
||||
E('div', { 'class': 'cbi-section fade-in' }, [
|
||||
E('h3', {}, _('User entries')),
|
||||
E('div', { 'class': 'cbi-section-node' }, user_entries),
|
||||
])
|
||||
);
|
||||
}
|
||||
|
||||
if(dnsmasqBypass) {
|
||||
layout.splice(4, 0,
|
||||
layout.splice(5, 0,
|
||||
E('div', { 'class': 'cbi-section fade-in' },
|
||||
E('div', { 'class': 'cbi-section-node' }, dnsmasqBypass)
|
||||
)
|
||||
@@ -355,7 +380,7 @@ return view.extend({
|
||||
};
|
||||
|
||||
if(dnsmasq) {
|
||||
layout.splice(5, 0,
|
||||
layout.splice(6, 0,
|
||||
E('div', { 'class': 'cbi-section fade-in' },
|
||||
E('div', { 'class': 'cbi-section-node' }, dnsmasq)
|
||||
)
|
||||
|
||||
@@ -25,6 +25,11 @@ return view.extend({
|
||||
+ ` ${_('One of the following:')}\n - ${_('valid IP address')}\n - ${_('valid address#port')}\n`;
|
||||
},
|
||||
|
||||
validateUrl: function(section, value) {
|
||||
return (/^$|^https?:\/\/[\w.-]+(:[0-9]{2,5})?[\w\/~.&?+=-]*$/.test(value)) ? true : _('Expecting:')
|
||||
+ ` ${_('valid URL')}\n`;
|
||||
},
|
||||
|
||||
load: function() {
|
||||
return Promise.all([
|
||||
L.resolveDefault(fs.exec(tools.execPath, [ 'raw-status' ]), 1),
|
||||
@@ -287,6 +292,13 @@ return view.extend({
|
||||
o.default = 0;
|
||||
o.depends({ bllist_preset: '', '!reverse': true });
|
||||
|
||||
// ENABLE_TMP_DOWNLOADS
|
||||
o = s.taboption('blacklist_tab', form.Flag, 'enable_tmp_downloads',
|
||||
_('Safe blacklist update'),
|
||||
_('If update fails, the old blacklist configuration will be retained. Temporary files are used, when updating the blacklist (increases memory consumption).'));
|
||||
o.rmempty = false;
|
||||
o.default = 0;
|
||||
|
||||
// ADD_USER_ENTRIES
|
||||
o = s.taboption('blacklist_tab', form.Flag, 'add_user_entries',
|
||||
_('Enable user entries'), _('Add user entries to the blacklist when updating'));
|
||||
@@ -301,6 +313,11 @@ return view.extend({
|
||||
o.inputtitle = _('Edit');
|
||||
o.inputstyle = 'edit btn';
|
||||
|
||||
// USER_ENTRIES_REMOTE
|
||||
o = s.taboption('blacklist_tab', form.DynamicList, 'user_entries_remote',
|
||||
_('URLs of remote user entries file'));
|
||||
o.validate = this.validateUrl;
|
||||
|
||||
// USER_ENTRIES_DNS
|
||||
o = s.taboption('blacklist_tab', form.Value, 'user_entries_dns',
|
||||
_("DNS server that is used for the user's FQDN entries"), '<code>ipaddress[#port]</code>');
|
||||
|
||||
Reference in New Issue
Block a user