Skip to content

Commit

Permalink
luci-app-banip: sync with 0.9.6-2
Browse files Browse the repository at this point in the history
small fixes & improvements

Signed-off-by: Dirk Brenken <[email protected]>
  • Loading branch information
dibdot committed May 30, 2024
1 parent c27c0b2 commit b4fc61a
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
'require fs';
'require ui';

let notMsg, errMsg;

return view.extend({
load: function () {
return Promise.all([
Expand All @@ -16,10 +18,16 @@ return view.extend({
.then(function () {
document.querySelector('textarea').value = value;
document.body.scrollTop = document.documentElement.scrollTop = 0;
ui.addNotification(null, E('p', _('Allowlist modifications have been saved, start the Domain Lookup or restart banIP that changes take effect.')), 'info');
if (!notMsg) {
ui.addNotification(null, E('p', _('Allowlist modifications have been saved, reload banIP that changes take effect.')), 'info');
notMsg = true;
}
}).catch(function (e) {
document.body.scrollTop = document.documentElement.scrollTop = 0;
ui.addNotification(null, E('p', _('Unable to save modifications: %s').format(e.message)), 'error');
if (!errMsg) {
ui.addNotification(null, E('p', _('Unable to save modifications: %s').format(e.message)), 'error');
errMsg = true;
}
});
},
render: function (allowlist) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@
'require fs';
'require ui';

let notMsg, errMsg;

return view.extend({
load: function () {
return Promise.all([
Expand All @@ -16,10 +18,16 @@ return view.extend({
.then(function () {
document.querySelector('textarea').value = value;
document.body.scrollTop = document.documentElement.scrollTop = 0;
ui.addNotification(null, E('p', _('Blocklist modifications have been saved, start the Domain Lookup or restart banIP that changes take effect.')), 'info');
if (!notMsg) {
ui.addNotification(null, E('p', _('Blocklist modifications have been saved, reload banIP that changes take effect.')), 'info');
notMsg = true;
}
}).catch(function (e) {
document.body.scrollTop = document.documentElement.scrollTop = 0;
ui.addNotification(null, E('p', _('Unable to save modifications: %s').format(e.message)), 'error');
if (!errMsg) {
ui.addNotification(null, E('p', _('Unable to save modifications: %s').format(e.message)), 'error');
errMsg = true;
}
});
},
render: function (blocklist) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ return view.extend({

m = new form.JSONMap(data, _('Custom Feed Editor'), _('With this editor you can upload your local custom feed file or fill up an initial one (a 1:1 copy of the version shipped with the package). \
The file is located at \'/etc/banip/banip.custom.feeds\'. \
Then you can edit this file, delete entries, add new ones or make a local backup. To go back to the maintainers version just empty the custom feed file again (do not delete it!).'));
Then you can edit this file, delete entries, add new ones or make a local backup. To go back to the maintainers version just clear the custom feed file.'));
for (let i = 0; i < Object.keys(m.data.data).length; i++) {
feed = Object.keys(m.data.data)[i];
url_4 = m.data.data[feed].url_4;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@
function handleAction(ev) {
if (ev === 'restart' || ev === 'reload') {
let map = document.querySelector('.cbi-map');
return dom.callClassMethod(map, 'save')
.then(L.bind(ui.changes.apply, ui.changes))
.then(function() {
return fs.exec_direct('/etc/init.d/banip', [ev]);
});
dom.callClassMethod(map, 'save')
.then(L.bind(ui.changes.apply, ui.changes))
.then(function () {
return fs.exec_direct('/etc/init.d/banip', [ev]);
});
} else {
return fs.exec_direct('/etc/init.d/banip', [ev]);
}
Expand Down
27 changes: 13 additions & 14 deletions applications/luci-app-banip/po/templates/banip.pot
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,10 @@ msgstr ""
msgid "Allowlist Only"
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:19
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:22
msgid ""
"Allowlist modifications have been saved, start the Domain Lookup or restart "
"banIP that changes take effect."
"Allowlist modifications have been saved, reload banIP that changes take "
"effect."
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/overview.js:424
Expand Down Expand Up @@ -158,10 +158,10 @@ msgstr ""
msgid "Blocklist Set Expiry"
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:19
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:22
msgid ""
"Blocklist modifications have been saved, start the Domain Lookup or restart "
"banIP that changes take effect."
"Blocklist modifications have been saved, reload banIP that changes take "
"effect."
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/overview.js:507
Expand Down Expand Up @@ -855,11 +855,11 @@ msgstr ""
msgid "Target directory for compressed feed backups."
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:28
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:36
msgid "The allowlist is too big, unable to save modifications."
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:28
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:36
msgid "The blocklist is too big, unable to save modifications."
msgstr ""

Expand All @@ -873,15 +873,15 @@ msgstr ""
msgid "The selected priority will be used for banIP background processing."
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:32
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:40
msgid ""
"This is the local banIP allowlist that will permit certain MAC-, IP-"
"addresses or domain names.<br /> <em><b>Please note:</b></em> add only "
"exactly one MAC/IPv4/IPv6 address or domain name per line. Ranges in CIDR "
"notation and MAC/IP-bindings are allowed."
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:32
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:40
msgid ""
"This is the local banIP blocklist that will prevent certain MAC-, IP-"
"addresses or domain names.<br /> <em><b>Please note:</b></em> add only "
Expand Down Expand Up @@ -955,8 +955,8 @@ msgstr ""
msgid "Unable to parse the ruleset file!"
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:22
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:22
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js:28
#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js:28
msgid "Unable to save modifications: %s"
msgstr ""

Expand Down Expand Up @@ -1002,8 +1002,7 @@ msgid ""
"initial one (a 1:1 copy of the version shipped with the package). The file "
"is located at '/etc/banip/banip.custom.feeds'. Then you can edit this file, "
"delete entries, add new ones or make a local backup. To go back to the "
"maintainers version just empty the custom feed file again (do not delete "
"it!)."
"maintainers version just clear the custom feed file."
msgstr ""

#: applications/luci-app-banip/htdocs/luci-static/resources/view/banip/overview.js:571
Expand Down

0 comments on commit b4fc61a

Please sign in to comment.