9 L
.resolveDefault(fs
.stat('/etc/banip/banip.blocklist'), {}),
10 L
.resolveDefault(fs
.read_direct('/etc/banip/banip.blocklist'), '')
13 handleSave: function (ev
) {
14 let value
= ((document
.querySelector('textarea').value
|| '').trim().toLowerCase().replace(/\r\n/g, '\n')) + '\n';
15 return fs
.write('/etc/banip/banip.blocklist', value
)
17 document
.querySelector('textarea').value
= value
;
18 document
.body
.scrollTop
= document
.documentElement
.scrollTop
= 0;
19 ui
.addNotification(null, E('p', _('Blocklist modifications have been saved, start the Domain Lookup or restart banIP that changes take effect.')), 'info');
20 }).catch(function (e
) {
21 document
.body
.scrollTop
= document
.documentElement
.scrollTop
= 0;
22 ui
.addNotification(null, E('p', _('Unable to save modifications: %s').format(e
.message
)), 'error');
25 render: function (blocklist
) {
26 if (blocklist
[0].size
>= 100000) {
27 document
.body
.scrollTop
= document
.documentElement
.scrollTop
= 0;
28 ui
.addNotification(null, E('p', _('The blocklist is too big, unable to save modifications.')), 'error');
32 _('This is the local banIP blocklist that will prevent certain MAC/IP/CIDR addresses.<br /> \
33 <em><b>Please note:</b></em> add only exactly one MAC/IPv4/IPv6 address or domain name per line.')),
36 'style': 'width: 100% !important; padding: 5px; font-family: monospace',
37 'spellcheck': 'false',
40 }, [blocklist
[1] != null ? blocklist
[1] : ''])
44 handleSaveApply
: null,