luci-app-adblock: update 4.5.3-3
authorDirk Brenken <redacted>
Sun, 22 Mar 2026 19:01:12 +0000 (20:01 +0100)
committerDirk Brenken <redacted>
Sun, 22 Mar 2026 19:01:12 +0000 (20:01 +0100)
* sync with base package

Signed-off-by: Dirk Brenken <redacted>
applications/luci-app-adblock/Makefile
applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/dnsreport.js
applications/luci-app-adblock/htdocs/luci-static/resources/view/adblock/logtemplate.js
applications/luci-app-adblock/root/usr/share/rpcd/acl.d/luci-app-adblock.json

index 6d56148f87419bb06171deb84cf898d316e8e385..6ea51a30751307af9afb682693be06a8af49022e 100644 (file)
@@ -7,7 +7,7 @@ LUCI_TITLE:=LuCI support for Adblock
 LUCI_DEPENDS:=+luci-base +luci-lib-uqr +adblock
 
 PKG_VERSION:=4.5.3
-PKG_RELEASE:=2
+PKG_RELEASE:=3
 PKG_LICENSE:=Apache-2.0
 PKG_MAINTAINER:=Dirk Brenken <dev@brenken.org>
 
index 4bd71a8f5e79233a9095b9e4eb9ec2ac8d9dbaa1..8615229a3ff3ef7bbbd28fa99d94eae822dfc489 100644 (file)
@@ -88,9 +88,9 @@ function handleAction(ev) {
                document.getElementById('allowlist').focus();
        }
 
-       if (ev === 'query') {
-               ui.showModal(_('Blocklist Query'), [
-                       E('p', _('Query active blocklists and backups for a specific domain.')),
+       if (ev === 'search') {
+               ui.showModal(_('Blocklist Search'), [
+                       E('p', _('Search active blocklists and backups for a specific domain.')),
                        E('div', { 'class': 'left', 'style': 'display:flex; flex-direction:column' }, [
                                E('label', { 'style': 'padding-top:.5em', 'id': 'run' }, [
                                        E('input', {
@@ -126,21 +126,37 @@ function handleAction(ev) {
                                                if (domain) {
                                                        document.getElementById('run').classList.add("spinning");
                                                        document.getElementById('search').value = domain;
-                                                       document.getElementById('result').textContent = 'The query is running, please wait...';
-                                                       L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['query', domain])).then(function (res) {
-                                                               const result = document.getElementById('result');
-                                                               if (res) {
-                                                                       result.textContent = res.trim();
-                                                               } else {
-                                                                       result.textContent = _('No Query results!');
-                                                               }
-                                                               document.getElementById('run').classList.remove("spinning");
-                                                               document.getElementById('search').value = '';
+                                                       document.getElementById('result').textContent = _('The search is running, please wait...');
+
+                                                       if (window._adbSearchPoller) {
+                                                               clearInterval(window._adbSearchPoller);
+                                                               window._adbSearchPoller = null;
+                                                       }
+                                                       L.resolveDefault(fs.write('/var/run/adblock.search', ''), '').then(function () {
+                                                               L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['search', domain]), '');
+                                                               let attempts = 0;
+                                                               window._adbSearchPoller = setInterval(function () {
+                                                                       attempts++;
+                                                                       L.resolveDefault(fs.read('/var/run/adblock.search'), '').then(function (res) {
+                                                                               if (res && res.trim()) {
+                                                                                       clearInterval(window._adbSearchPoller);
+                                                                                       window._adbSearchPoller = null;
+                                                                                       document.getElementById('result').textContent = res.trim();
+                                                                                       document.getElementById('run').classList.remove("spinning");
+                                                                                       document.getElementById('search').value = '';
+                                                                               } else if (attempts >= 40) {
+                                                                                       clearInterval(window._adbSearchPoller);
+                                                                                       window._adbSearchPoller = null;
+                                                                                       document.getElementById('result').textContent = _('No Search results!');
+                                                                                       document.getElementById('run').classList.remove("spinning");
+                                                                               }
+                                                                       });
+                                                               }, 3000);
                                                        });
                                                }
                                                document.getElementById('search').focus();
                                        })
-                               }, _('Query'))
+                               }, _('Search'))
                        ])
                ]);
                document.getElementById('search').focus();
@@ -197,10 +213,27 @@ function handleAction(ev) {
                                                const top_count = document.getElementById('top_count').value;
                                                const res_count = document.getElementById('res_count').value;
                                                const search = document.getElementById('search').value.trim().replace(/[^\w.\-:]/g, '') || '+';
-                                               L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['report', 'gen', top_count, res_count, search]), '')
-                                                       .then(function () {
-                                                               location.reload();
-                                                       });
+                                               L.resolveDefault(fs.write('/var/run/adblock.report', ''), '').then(function () {
+                                                       L.resolveDefault(fs.exec_direct('/etc/init.d/adblock', ['report', 'gen', top_count, res_count, search]), '');
+                                                       let attempts = 0;
+                                                       let poller = setInterval(function () {
+                                                               attempts++;
+                                                               L.resolveDefault(fs.read('/var/run/adblock.report'), '').then(function (res) {
+                                                                       if (res && res.trim()) {
+                                                                               clearInterval(poller);
+                                                                               ui.hideModal();
+                                                                               location.reload();
+                                                                       } else if (attempts >= 40) {
+                                                                               clearInterval(poller);
+                                                                               document.querySelectorAll('.cbi-page-actions button').forEach(function (btn) {
+                                                                                       btn.disabled = false;
+                                                                               });
+                                                                               document.getElementById('refresh').classList.remove('spinning');
+                                                                               ui.addNotification(null, E('p', _('Failed to generate adblock report!')), 'error');
+                                                                       }
+                                                               });
+                                                       }, 3000);
+                                               });
                                        }
                                }, _('Refresh'))
                        ])
@@ -420,11 +453,11 @@ return view.extend({
                                E('button', {
                                        'class': 'btn cbi-button cbi-button-apply',
                                        'style': 'float:none;margin-right:.4em;',
-                                       'title': 'Blocklist Query',
+                                       'title': 'Blocklist Search',
                                        'click': ui.createHandlerFn(this, function () {
-                                               return handleAction('query');
+                                               return handleAction('search');
                                        })
-                               }, [_('Blocklist Query...')]),
+                               }, [_('Blocklist Search...')]),
                                E('button', {
                                        'class': 'btn cbi-button cbi-button-positive important',
                                        'style': 'float:none;margin-right:.4em;',
index 22160d1d5d6b4548a039fa2e1e12c497796033bd..2026fffe8ffefd0f04accd3d04748fccb2cb40bf 100644 (file)
@@ -17,25 +17,15 @@ function Logview(logtag, name) {
                                return callLogRead(1000, false, true).then(res => {
                                        const logEl = document.getElementById('logfile');
                                        if (!logEl) return;
-
                                        const filtered = (res?.log ?? [])
                                                .filter(entry => !logtag || entry.msg.includes(logtag))
                                                .map(entry => {
-                                                       const d = new Date(entry.time * 1000);
-                                                       const date = d.toLocaleDateString([], {
-                                                               year: 'numeric',
-                                                               month: '2-digit',
-                                                               day: '2-digit'
-                                                       });
-                                                       const time = d.toLocaleTimeString([], {
-                                                               hour: '2-digit',
-                                                               minute: '2-digit',
-                                                               second: '2-digit',
-                                                               hour12: false
-                                                       });
+                                                       const d = new Date(entry.time);
+                                                       const pad = n => String(n).padStart(2, '0');
+                                                       const date = `${pad(d.getDate())}/${pad(d.getMonth() + 1)}/${d.getFullYear()}`;
+                                                       const time = `${pad(d.getHours())}:${pad(d.getMinutes())}:${pad(d.getSeconds())}`;
                                                        return `[${date}-${time}] ${entry.msg}`;
                                                });
-
                                        logEl.value = filtered.length > 0
                                                ? filtered.join('\n')
                                                : _('No %s related logs yet!').format(name);
index 4016b2420bb77bf6b2c6296b2a5549122886b97f..a1aa6c436d30d6a9c34b7f6be8463410f5832eed 100644 (file)
@@ -2,29 +2,74 @@
        "luci-app-adblock": {
                "description": "Grant access to LuCI app adblock",
                "write": {
-                       "uci": [ "adblock" ],
+                       "uci": [
+                               "adblock"
+                       ],
                        "file": {
-                               "/etc/adblock/*": [ "read", "write" ],
-                               "/etc/adblock/adblock.allowlist": [ "write" ],
-                               "/etc/adblock/adblock.blocklist": [ "write" ],
-                               "/etc/adblock/adblock.custom.feeds": [ "read", "write" ]
+                               "/etc/adblock/*": [
+                                       "read"
+                               ],
+                               "/etc/adblock/adblock.allowlist": [
+                                       "read",
+                                       "write"
+                               ],
+                               "/etc/adblock/adblock.blocklist": [
+                                       "read",
+                                       "write"
+                               ],
+                               "/etc/adblock/adblock.custom.feeds": [
+                                       "read",
+                                       "write"
+                               ],
+                               "/var/run/adblock.search": [
+                                       "read",
+                                       "write"
+                               ],
+                               "/var/run/adblock.report": [
+                                       "read",
+                                       "write"
+                               ]
                        }
                },
                "read": {
-                       "cgi-io": [ "exec" ],
+                       "cgi-io": [
+                               "exec"
+                       ],
                        "file": {
-                               "/var/run/adblock.pid": [ "read" ],
-                               "/var/run/adb_runtime.json": [ "read" ],
-                               "/etc/init.d/adblock reload": [ "exec" ],
-                               "/etc/init.d/adblock restart": [ "exec" ],
-                               "/etc/init.d/adblock suspend": [ "exec" ],
-                               "/etc/init.d/adblock resume": [ "exec" ],
-                               "/etc/init.d/adblock stop": [ "exec" ],
-                               "/etc/init.d/adblock report [a-z]* [0-9]* [0-9]* *": [ "exec" ],
-                               "/etc/init.d/adblock query *": [ "exec" ]
+                               "/var/run/adblock.pid": [
+                                       "read"
+                               ],
+                               "/var/run/adb_runtime.json": [
+                                       "read"
+                               ],
+                               "/etc/init.d/adblock reload": [
+                                       "exec"
+                               ],
+                               "/etc/init.d/adblock restart": [
+                                       "exec"
+                               ],
+                               "/etc/init.d/adblock suspend": [
+                                       "exec"
+                               ],
+                               "/etc/init.d/adblock resume": [
+                                       "exec"
+                               ],
+                               "/etc/init.d/adblock stop": [
+                                       "exec"
+                               ],
+                               "/etc/init.d/adblock report *": [
+                                       "exec"
+                               ],
+                               "/etc/init.d/adblock search *": [
+                                       "exec"
+                               ]
                        },
-                       "uci": [ "adblock" ],
-                       "log": [ "read" ]
+                       "uci": [
+                               "adblock"
+                       ],
+                       "log": [
+                               "read"
+                       ]
                }
        }
 }
\ No newline at end of file
git clone https://git.99rst.org/PROJECT