44 Commits

Author SHA1 Message Date
Stan Grishin
cb37034add adblock-fast: bugfixes
* bugfix: remove IPKG_INSTROOT check
* bugfix: do not attempt to download config update if package is disabled

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-10-10 17:41:35 -07:00
Stan Grishin
3b9bbcf40a adblock-fast: update to 1.2.0-r20
Config file:
* add debug_init_script and debug_performance options
* remove led (default should be empty) option
* remove procd_boot_delay (obsolete) option

Init Script:
* reinstate IPKG_INSTROOT check
* change capitalization in status messages
* unset default value for led option on load_package_config
* bugfix: unset bool options which are later checked for non-empty
* bugfix: create compressed cache only if block-file exists
* adjust errors output/storing errors for later display in multuple cases
* produce information about cache/compressed cache files in service
  status output when service is stopped
* attempt to create compressed cache in service_started only if block-
  file exists
* bugfix: run service_started from the dl command (to create compressed
  cache file)
* rename StripToDomains variables for readability
* improve open port detection

Uci-Defaults:
* improve readability of debug options migration

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-10-08 12:09:55 -07:00
Stan Grishin
17ca12ae5a adblock-fast: update to 1.2.0
Makefile:
* update version/release
Init Script:
* boot up reliability improvements:
  - change START from 50 to 20 to ensure procd_add_raw_trigger works on boot
  - better logic of checking/using the cache/compressed cache on boot
* new dnsmasq handling/integration logic:
  - new logic for checking dnsmasq functionality (similar to dnsmasq init script)
  - instead of copying/duplicating adblock-fast files per specified dnsmasq instance, create one file
    and add softlinks to it for specified dnsmasq instances and make sure it's in the instance's addnmounts
  - update dnsmasqConfFile, dnsmasqIpsetFile and dnsmasqNftsetFile to point to the same filename as the
    logic for integrating with dnsmasq is the same for those options
  - get the confdir for specified dnsmasq instances via ubus info/config file since the config_get is broken
    between releases by https://github.com/openwrt/openwrt/pull/14975
  - update clean-up procedures for other dns backend settings to properly clean up when switching away from
    dnsmasq.conf, dnsmasq.ipset, dnsmasq.nftset where the new logic is used
  - remove obsolete outputDnsmasqFileList variable and logic of building and using it
  - only create compressed cache in service_started after successful resolver restart with the block-file
* new package config / environment loading logic
  - switch away from using `load_validate_config` to start functions to loading package config "manually"
  - unset boolean variables which are non-true on package config load
  - switch checking values of such variables from `-eq 0` to empty/non-empty
* debugging improvements:
  - rename debug option to debug_init_script and proc_debug to debug_performance
  - output performance debug info to log only when debug_performance is set
* miscellaneous changes:
  - move best dl tool detection into its own function for reuse in adb_config_update
  - change uci_changes function to return 0/1 instead of the text of changes
  - improve mktemp calls reliability by creating the file and not using `-u` anymore
  - add remove_cache/remove_gzip calls to adb_file function
  - better readability of the start_serice logic determining the action
  - change flock value from 207 to 209 to avoid collisions with pbr
  - temporarily switch namespaces when using jshn functions to avoid collisions with PROCD
  - move from using spaces to tabs in indentation in code
  - prevent Command Not Found message on uninstall
  - remove unneeded IPKG_INSTROOT check in the init script
  - update all sourcing instructions to include IPKG_INSTROOT in the path
Uci-defaults script:
* transition old debug and proc_debug options to debug_init_script/debug_performance

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-09-28 11:37:23 -07:00
Stan Grishin
02644ad1e4 adblock-fast: bugfix: dl command
* only test gzip existence and reset action/param on boot

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-09-17 15:06:08 -07:00
Stan Grishin
9022d3f53f adblock-fast: update to 1.1.4-r12
README:
* update header

Init-script:
* set an earlier start to get triggers to work
* better str_contains
* improve readability of json() by getting rid of cascading case statements
* add new errors/status messages to get_text()
* prepare get_text() for localization by switching to inline printf
* adjust shellcheck disable comments where needed
* parse unbound config for DNS hijack ports
* test if the archived cache exists on boot and proceed to use it if it does
* add trigger waiting status so that luci app can display correct status
* do not run adb_config_update on boot, speeding up trigger setup

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-08-27 17:33:30 -07:00
Stan Grishin
b8fa681098 adblock-fast: bugfixes: status & TLD check with unbound
fixes: https://github.com/openwrt/packages/issues/27146
supercedes: https://github.com/openwrt/packages/pull/27159

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-08-05 09:16:33 -07:00
Stan Grishin
a94c5fac4b adblock-fast: update to 1.1.4-4
Makefile:
  - bugfix: change references to melmac.net to melmac.ca

README:
  - add basic README with the link to full documentation

Config:
  - add heartbeat_domain
  - add heartbeat_sleep_timeout
  - add sanity_check
  - add update_config_sizes

Init Script:
  - a lot of visual output improvements, especially with verbosity=2
  - better output separation for different verbosity levels
  - removed unneeded runningErrorFile
  - bugfix: updated runningConfigFile
  - updated runningStatusFile and added runningStatusFileLock
  - moved append_url() higher up for better visibility
  - refactor force-redownload/restart on some config changes functionality
  - improve count_blocked_domains
  - add internal debug_log() for debugging functions where output is captured
  - unified all json add/get calls in the same formatting
  - major rework on json() to allow storing of error/warning messages as json objects
  - added some error/warning messages
  - renamed `cache()` function to `adb_file()` to better reflect functionality
  - added functionality to test the dnsmasq config before restarting dnsmasq with ad-blocking
  - added functionality to throw warnings if TLDs or leading-dot domains are discovered
    in the final block-list file (can be disabled by `sanity_check` option)
  - added functionality to test DNS resolution after resolver restart with `heartbeat_domain`
    for `heartbeat_sleep_timeout` seconds
  - added functionality to revert the resolver's config/ad-blocking if heartbeat domain cannot
    be resolved after resolver restart
  - added `ALLOWED_TMP` variable/file for better processing of external allow-lists
  - added debug output to log with the elapsed time for each step of processing
  - drastically improved final block-list optimization with the new awk script
  - minor other performance improvements
  - added check_tld/check_leading_dot CLI commands to show domains breaking sanity checks
  - added validate functions to triggers

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-08-01 13:31:40 -05:00
Stan Grishin
73821b26e5 adblock-fast: update to 1.1.3-13
* update to SPDX license identified in Makefile
* bugfix: correct HELP line description for sizes command (thanks @justops1337)
* performance fix: updated domains filter (thanks @justops1337)
* bugfix/improvement: more reliable get_url_filesize code with fall-back to
  uclient-fetch (thanks @justops1337)

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-06-02 20:56:47 -07:00
Nikolay Manev
34c02108ce adblock-fast: improve the processing of combined list
Signed-off-by: Nikolay Manev <just.ops@proton.me>

adblock-fast: modify gawk statement

Signed-off-by: Nikolay Manev <just.ops@proton.me>
2025-05-13 09:42:43 -07:00
Nikolay Manev
3d9eb08f8e adblock-fast: Fixed non-printable characters and bump PKG_VERSION
Signed-off-by: Nikolay Manev <just.ops@proton.me>
2025-05-11 10:04:26 -07:00
Stan Grishin
71f596840b adblock-fast: bugfixes: empty allow-lists, support for swap
* do not produce an error on empty allow-lists, fixes https://github.com/openwrt/packages/issues/26228
* do not produce an error when swap is available, fixes https://github.com/openwrt/packages/issues/26313

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-04-15 21:35:58 -07:00
Stan Grishin
f19bf22b3c adblock-fast: bugfix: detect_file_type()
* Properly detect domain lists, fixes https://github.com/openwrt/packages/issues/25973
  Thanks @timfeierabend
* Better output when setting triggers
* No wait for ubus network.interface on boot

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-03-01 09:57:10 -08:00
Stan Grishin
2e764368cc adblock-fast: bugfixes: boot-up, StevenBlack list, new CERT.pl source
* bugfix: more robust boot-up start
* bugfix: processing of StevenBlack lists
* new remote block-list: CERT.pl

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-01-29 11:07:14 -08:00
Stan Grishin
92a37ebdf1 adblock-fast: Makefile bugfixes and hijack rework
* remove indentation in postinst/prerm/postrm scripts to fix issues with APK
* rework hijack logic to redirect port 53 to the port of active/selected dnsmasq instances

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2025-01-04 12:12:19 -08:00
Stan Grishin
beebdba29e adblock-fast: bugfix: dnsmasq instances confdir hack
* temporary hack until https://github.com/openwrt/openwrt/pull/16806 is merged

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-12-06 17:50:38 -08:00
Stan Grishin
87edf8cb19 adblock-fast: bugfixes
* properly process dnsmasq instances' confdirs
* working str_replace()
* updated output()
* bugfixes and updates for error messages
* sanitize StevenBlack's hosts file

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-11-23 10:05:14 -08:00
Stan Grishin
0cb1b9d12e adblock-fast: update to 1.1.2-10
* bump compat version to accommodate new strings
* improve the output() function (thanks @bigsmile74)
* implement support for user-configurable per-instance dnsmasq confdirs
  for dnsmasq.conf|dnsmasq.ipset|dnsmasq.nftset options

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-11-01 17:46:58 -07:00
Stan Grishin
d1e8694625 adblock-fast: bugfix: fix allowed domains for dnsmasq.servers
Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-10-28 17:11:47 -07:00
Stan Grishin
02ab49c33f adblock-fast: explicitly allowing domains for dnsmasq.servers
New features:
* explicitly add allowed domains on download/allow to the dnsmasq.servers
  config file

Cleanup:
* remove unneeded EXTRA_COMMANDS
* remove unneeded EXTRA_HELP
* remove unnecessary `\n` escapes
* remove unnecessary line breaks from output on download

Optimization:
* simplify is_integer()
* replace long if with case
* more verbose output on download

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-10-24 09:29:23 -07:00
Stan Grishin
4d3155d1ed adblock-fast: bugfixes and shellcheck update
* BUGFIX: correctly identify available RAM
* BUGFIX: properly store remote list filesize in config
* shellcheck updates

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-09-20 13:22:14 -07:00
Stan Grishin
50e85ed27f adblock-fast: update to 1.1.2-3
This version brings two significant updates:
* support for text labels/names for the external lists
* better processing of the config update files, which cleans up
  entries with missing URLs

Also:
* new config file contains names for all lists
* it tries to match existing URLs with the names from the new config file
  and update user config as part of uci-defaults script
* contains minor updates to copyright/license/upstream URL/README
* updates the config update script to remove sysctl.org list as it's outdated
* adds two new remote lists: Hagezi and 1Hosts

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-08-03 23:26:26 +00:00
Stan Grishin
fb151d5b82 adblock-fast: update to 1.1.2-1
* move extra_command and EXTRA_HELP to the top of the init file
* add packageCompat variable for compatibility check with WebUI
* add OutputFilter variables for supported resolvers
* simplify adb_check with the use of OutputFilter variables
* add show_blocklist command to display currently blocked domains

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-05-13 04:33:42 +00:00
Stan Grishin
474587a1f4 adblock-fast: bugfix: unbound-related fixes
* include `server:` directive at the top of unbound file
* update unbound-related outputGzip variable to include full path
* return always_nxdomain for blocked domains
* also update copyright stamp/license

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-04-21 14:06:58 +00:00
Stan Grishin
706592edcc adblock-fast: prepare migration to APK
Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-03-23 01:02:05 +00:00
Stan Grishin
eafdd63d67 adblock-fast: add force_dns_interface setting
* allow users to specify list of interfaces/networks to force the
  DNS Hijacking on

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-02-14 04:41:10 +00:00
Stan Grishin
0f059b6523 adblock-fast: update to 1.1.1-3
* allow top-level domains in the blocked-domains options fixes
  https://github.com/openwrt/packages/issues/23125

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-01-19 00:05:18 +00:00
Stan Grishin
dfeeabbebf adblock-fast: bugfix: pause command
* the pause command used to incorrectly cause block-lists reload, this
  has been fixed in this version

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2024-01-07 23:07:42 +00:00
Stan Grishin
bab17f480c adblock-fast: update to 1.1.1-1
* move reload/restart logic from json() to config_cache()
* improve fw4 restart decision logic
* no longer store reload/restart info in ubus/status json file
* rename variables pointing to run-time information
* create dns_set_output_values to reuse code in principal all and luci app
* improve append_url to store collected URLs in an alternative variable

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-12-15 02:42:13 +00:00
Stan Grishin
693287e961 adblock-fast: better allow-listing
* improve allow-listing reliability by running sed from the script-file
  instead of the command-line
* fix user for smartdns files ownership

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-12-11 00:55:46 +00:00
Stan Grishin
1914114ed3 adblock-fast: bugfix: block domains from config when not using block-lists
* remove empty lines from the combined list to allo optimization code
  to work properly

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-12-10 02:50:03 +00:00
Stan Grishin
496d9b71ab adblock-fast: bugfixes: getsize/resolver
* do not use standalone grep-package dependent syntax to get the remote
  file size
* various bugfixes to prevent attempts to change/commit if dnsmasq/smartdns
  are not installed

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-12-08 02:41:53 +00:00
Stan Grishin
28cd5ecf6e adblock-fast: add smartdns ipset/nftset support
* bugfix: correct URL to config-update file
* bugfix: check if uci configs exist before chacking for changes
* add support for smartdns ipset-based blocking
* add support for smartfns nftset-based blocking
* disallow non-ascii symbols for smartdns blocking
* add check wherever fw4 restart is needed before calling
  procd_set_config_changed firewall
* improve clean-up code in resolver()
* improve case code for different resolver settings
* modify load_validate_config to allow smartdns.ipset and smartdns.nftset

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-12-06 10:22:18 +00:00
Stan Grishin
575af322b5 adblock-fast: add support for smartdns
* add support for smartdns
* switch from using `uci` commands to `uci_` functions
* rename `_resolver_config` to `_dnsmasq_instance_config`
* introduce `_smartdns_instance_config`
* improve resolvers restart code on changes
* update load_validate_config to allow for smartdns option

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-12-05 08:16:35 +00:00
Stan Grishin
ffb396bca9 adblock-fast: bugfix: call to missing function
* fix call to is_number to is_integer
* improve boot()

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-11-25 20:54:17 +00:00
Stan Grishin
96ad0ab6fd adblock-fast: bufgix: fix boot()
* fix boot()
* reintroduce procd_boot_delay variable to control delay of service
  start on boot
* introduce `check_lists` command to check enabled block-lists for
  domain(s)
* use config_get_bool instead of config_get for boolean options

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-11-23 22:44:52 +00:00
Stan Grishin
3787b41355 adblock-fast: bugfix: ensure downloaded block-lists end with newline
* ensure downloaded block-lists end with newline
* turn free/total RAM checks into functions calls

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-11-13 10:08:54 +00:00
Stan Grishin
11df396a18 adblock-fast: update to 1.0.1-1
* update Makefile copyright info
* organize functions shared between the init script, uci-defaults and
  luci app in alphabetical order
* update error, warning and status messaging
* use single quotes instead double quotes for static text labels
* better warning for missing recommended packages
* rename dns function to resolver to better reflect its purpose
* improve resolver cleanup code
* move _resolver_config function inside resolver function to improve code readlibity
* rename _process_file_url to process_file_url_wrapper to better reflect its purpose
* add preflight check for available RAM vs total size of block lists
* move _config_add_url_size function inside adb_sizes function to improve code readlibity
* remove uci validation from status_service function to improve performance
* source init script from uci-defaults to include shared functions

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-11-08 09:57:32 +00:00
Stan Grishin
42cc50eec8 adblock-fast: bugfix: allow command
* fix sed to properly purge allowed domains from block-lists
* ensure resolver is restarted on allow command
* reduce pause default/max in attempt to make it work with luci

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-10-21 02:27:54 +00:00
Stan Grishin
13a88d0b79 adblock-fast: bugfix: properly identify hosts-files
* escape dots in grep command to properly identify hosts files

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-10-05 14:52:28 +00:00
Stan Grishin
f3b8e569a5 adblock-fast: update to 1.0.0-5
* improve processing of dnsmasq config files
* do not run sed/show error if allow_filter is empty

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-10-02 18:09:00 +00:00
Stan Grishin
ed6729c251 adblock-fast: better error reporting when nothing to do
* also nicer file type output in high verbosity

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-09-28 21:31:35 +00:00
Stan Grishin
cfe85fbde3 adblock-fast: bugfix: better detect ABP lists
* bugfix: better detect ABP lists
* update Makefile with BUSYBOX features dependencies
* update the type of dnsmasq_instance setting
* add error message when file type can't be detected
* add reporting when file type can't be detected
* bugfix: include URL on errors related to URL processing/parsing
* rename resolver function to resolver_config to better reflect its use

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-09-26 22:48:37 +00:00
Stan Grishin
bce310bfcd adblock-fast: bugfix: remove domains on allow
* fix sed command to properly remove allowed domains from block-file

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-09-16 13:13:49 +00:00
Stan Grishin
be69e34ce3 adblock-fast: initial commit
* this package replaces simple-adblock package
* it was impossible to keep existing config structure and continue
  improving the simple-adblock the way I wanted, hence the new
  package name
* the migration script for existing simple-adblock config is included in
  the uci-defaults file

Signed-off-by: Stan Grishin <stangri@melmac.ca>
2023-08-28 21:17:03 +00:00