luci-app-banip: sync with 0.9.6-2 openwrt-23.05
authorDirk Brenken <dev@brenken.org>
Thu, 30 May 2024 20:13:17 +0000 (22:13 +0200)
committerDirk Brenken <dev@brenken.org>
Fri, 31 May 2024 04:45:51 +0000 (06:45 +0200)
small fixes & improvements

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit b4fc61a0c5dc6d613ffd659114fa073b31b02230)

applications/luci-app-banip/htdocs/luci-static/resources/view/banip/allowlist.js
applications/luci-app-banip/htdocs/luci-static/resources/view/banip/blocklist.js
applications/luci-app-banip/htdocs/luci-static/resources/view/banip/feeds.js
applications/luci-app-banip/htdocs/luci-static/resources/view/banip/overview.js
applications/luci-app-banip/po/templates/banip.pot

index 6b54f2946eba7f724edd5c3c63755dc62c4d5b90..4610eb56a93f6e5a160a39c310bbcb4c824c60be 100644 (file)
@@ -3,6 +3,8 @@
 'require fs';
 'require ui';
 
+let notMsg, errMsg;
+
 return view.extend({
        load: function () {
                return Promise.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) {
index 8dede44e525756dee5c457a5efb2c7f910f6320b..1ebdd381676a148e4a7a12dfe940abb106bbb19c 100644 (file)
@@ -3,6 +3,8 @@
 'require fs';
 'require ui';
 
+let notMsg, errMsg;
+
 return view.extend({
        load: function () {
                return Promise.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) {
index e6704efdcaafafc6169f8c0704848cbe021df2df..2dc085932d3fc49fe76cab689a48ef09558f1211 100644 (file)
@@ -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;
index c57f5f633f720f879c9f0759e48451e1d7a7d96e..81543ca73295920c545ddcbff64dc0c120f98a69 100644 (file)
 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]);
        }
index 8e8f8cfce7bf9cd6e494983488e05e52de3ce63d..feb0066e89937b29667e927830b8861b6e3ece11 100644 (file)
@@ -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
@@ -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
@@ -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 ""
 
@@ -873,7 +873,7 @@ 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 "
@@ -881,7 +881,7 @@ msgid ""
 "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 "
@@ -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 ""
 
@@ -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