adblock-fast: update to 1.2.2-r12
authorStan Grishin <redacted>
Thu, 19 Mar 2026 02:28:30 +0000 (02:28 +0000)
committerStan Grishin <redacted>
Thu, 19 Mar 2026 18:44:32 +0000 (11:44 -0700)
Config:
* update pause_timeout default value to 60
* add config option rpcd_token

Init script:
* add validation for rpcd_token

Ucode script:
* fix: always reload config options on RPCD calls to prevent stale values
* fix: shell_quote curl params
* fix: do not reload is_tty on each call

Signed-off-by: Stan Grishin <redacted>
net/adblock-fast/Makefile
net/adblock-fast/files/etc/config/adblock-fast
net/adblock-fast/files/etc/init.d/adblock-fast
net/adblock-fast/files/lib/adblock-fast/adblock-fast.uc
net/adblock-fast/tests/01_pipeline/01_all_dns_modes

index 4f993852edd11f03e98335dac717ec9b15372c50..532703870f7a21eb5dfc5a3a4cd6344310375d96 100644 (file)
@@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk
 
 PKG_NAME:=adblock-fast
 PKG_VERSION:=1.2.2
-PKG_RELEASE:=10
+PKG_RELEASE:=12
 PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
 PKG_LICENSE:=AGPL-3.0-or-later
 
index 431d7bd11660bb7ce5afa50fbc1b2ea265d7c67d..361d84d962b4300e83a56a4481a464bcab2f9bf9 100644 (file)
@@ -29,7 +29,8 @@ config adblock-fast 'config'
 #      list force_dns_port '5443'
 #      list force_dns_port '8443'
        option parallel_downloads '1'
-       option pause_timeout '20'
+       option pause_timeout '60'
+       option rpcd_token ''
        option procd_trigger_wan6 '0'
        option procd_boot_wan_timeout '60'
        option verbosity '2'
index c6dc049fa2a71a7b78eb6407c8912008ac3ca9cb..115295a4b7b1c28253e1c2cb521084a3a1375689 100644 (file)
@@ -109,6 +109,7 @@ load_validate_config() {
                'config_update_url:string:https://cdn.jsdelivr.net/gh/openwrt/packages/net/adblock-fast/files/adblock-fast.config.update' \
                'download_timeout:range(1,60):20' \
                'pause_timeout:range(1,600):20' \
+               'rpcd_token:string' \
                'curl_additional_param:or("", string)' \
                'curl_max_file_size:or("", uinteger)' \
                'curl_retry:range(0,30):3' \
index f5fe4068cd29a4d30470fbd888aebf70dc56071f..7f7498a186f2ab8b2acb828c4625848b1c6134f0 100644 (file)
@@ -14,7 +14,7 @@ import { connect } from 'ubus';
 const pkg = {
        name: 'adblock-fast',
        version: 'dev-test',
-       compat: '13',
+       compat: '14',
        memory_threshold: 33554432,
        config_file: '/etc/config/adblock-fast',
        dnsmasq_file: '/var/run/adblock-fast/adblock-fast.dnsmasq',
@@ -182,7 +182,6 @@ let env = {
 
        // Guard flags
        _detected: false,
-       _config_loaded: false,
        _loaded: false,
 };
 
@@ -312,7 +311,7 @@ env.get_downloader = function() {
        let command, flag, ssl_supported;
        if (is_present('curl')) {
                command = 'curl -f --silent --insecure';
-               if (cfg.curl_additional_param) command += ' ' + cfg.curl_additional_param;
+               if (cfg.curl_additional_param) command += ' ' + shell_quote(cfg.curl_additional_param);
                if (cfg.curl_max_file_size) command += ' --max-filesize ' + cfg.curl_max_file_size;
                if (cfg.curl_retry) command += ' --retry ' + cfg.curl_retry;
                if (cfg.download_timeout) command += ' --connect-timeout ' + cfg.download_timeout;
@@ -847,6 +846,7 @@ const config_schema = { // ucode-lsp disable
        heartbeat_sleep_timeout: ['string', '10'],
        led:                     ['string'],
        pause_timeout:           ['string', '20'],
+       rpcd_token:              ['string'],
        procd_boot_wan_timeout:  ['string', '60'],
        // Integers
        verbosity:               ['int', 2],
@@ -900,15 +900,11 @@ function parse_options(raw, schema) { // ucode-lsp disable
 // ── env.load_config ─────────────────────────────────────────────────
 
 env.load_config = function() {
-       if (env._config_loaded) return;
-       state.is_tty = system('[ -t 2 ]') == 0 ? true : false;
+       if (state.is_tty == null)
+               state.is_tty = system('[ -t 2 ]') == 0 ? true : false;
        let raw = uci(pkg.name, true).get_all(pkg.name, 'config') || {};
        cfg = parse_options(raw, config_schema);
        env.dns_set_output_values(cfg.dns);
-       env._loaded = false;
-       env._detected = false;
-       env._dl_cache = null;
-       env._config_loaded = true;
 };
 
 // ── load_dl_command ─────────────────────────────────────────────────
@@ -2717,7 +2713,7 @@ function get_network_trigger_info() {
 
 function get_init_status(name) {
        name = name || pkg.name;
-       env.load('rpcd');
+       env.load_config();
 
        // Read pre-computed data from procd service (like PBR)
        let conn = connect();
@@ -2736,7 +2732,7 @@ function get_init_status(name) {
                packageCompat: int(pkg.compat),
 
                // Live-computed (cheap stat/uci checks)
-               enabled: service_enabled(pkg.name) && !!cfg.enabled,
+               enabled: service_enabled(pkg.name) && uci(pkg.name, true).get(pkg.name, 'config', 'enabled') == '1',
                running: (stat(pkg.run_file)?.size > 0),
                outputFileExists: (stat(svc_data?.outputFile || dns_output.file)?.size > 0) || false,
                outputCacheExists: (stat(svc_data?.outputCache || dns_output.cache)?.size > 0) || false,
@@ -2780,7 +2776,7 @@ function get_init_status(name) {
 function get_init_list(name) {
        name = name || pkg.name;
        let result = {};
-       let enabled_val = (uci(pkg.name).get(pkg.name, 'config', 'enabled') ?? '0');
+       let enabled_val = (uci(pkg.name, true).get(pkg.name, 'config', 'enabled') ?? '0');
        result[name] = { enabled: (enabled_val == '1') };
        return result;
 }
@@ -2806,7 +2802,7 @@ function get_platform_support(name) {
 
 function get_file_url_filesizes(name) {
        name = name || pkg.name;
-       env.load('rpcd');
+       env.load_config();
 
        let files = [];
        uci(pkg.name).foreach(pkg.name, 'file_url', (s) => {
index 66de03b00d7d087fae10224dc432f540128e076c..4f8a415156e3a579599867e262db721199424333 100644 (file)
@@ -42,7 +42,6 @@ let results = [];
 
 for (let mode in modes) {
        // Reset module state for each mode
-       ti.env._config_loaded = false;
        ti.env._loaded = false;
        ti.env.dnsmasq_features = '';
        ti.env._detected = false;
git clone https://git.99rst.org/PROJECT