aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStan Grishin <stangri@melmac.ca>2022-11-04 00:53:26 +0000
committerStan Grishin <stangri@melmac.ca>2022-11-04 00:58:40 +0000
commit7393b744574a72430f491183853729d941c634ea (patch)
tree98cc45d7f88903af7afeb58686f6310336bb78c0
parent45e03782f555b3cf85fd4596b95850352aeb1901 (diff)
simple-adblock: update to 1.9.2-4
* update default config file to list options alphabetically * rearrange some of the init script code to support transition of WebUI to javascript * rename wan6_trigger to procd_trigger_wan6 for readability Signed-off-by: Stan Grishin <stangri@melmac.ca>
-rw-r--r--net/simple-adblock/Makefile2
-rw-r--r--net/simple-adblock/files/simple-adblock.conf19
-rw-r--r--net/simple-adblock/files/simple-adblock.init147
3 files changed, 86 insertions, 82 deletions
diff --git a/net/simple-adblock/Makefile b/net/simple-adblock/Makefile
index d4ac46522..540a105f4 100644
--- a/net/simple-adblock/Makefile
+++ b/net/simple-adblock/Makefile
@@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=simple-adblock
PKG_VERSION:=1.9.2
-PKG_RELEASE:=3
+PKG_RELEASE:=4
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
PKG_LICENSE:=GPL-3.0-or-later
diff --git a/net/simple-adblock/files/simple-adblock.conf b/net/simple-adblock/files/simple-adblock.conf
index 2346801c5..e15e7e864 100644
--- a/net/simple-adblock/files/simple-adblock.conf
+++ b/net/simple-adblock/files/simple-adblock.conf
@@ -1,10 +1,17 @@
config simple-adblock 'config'
option enabled '0'
+ list allowed_domain 'cdn.jsdelivr.net'
+ option allow_non_ascii '0'
+ option canary_domains_icloud '0'
+ option canary_domains_mozilla '0'
+ option compressed_cache '0'
option config_update_enabled '0'
option config_update_url 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/simple-adblock/files/simple-adblock.conf.update'
+ option curl_retry '3'
+ option download_timeout '10'
+ option debug '0'
option dns 'dnsmasq.servers'
option dns_instance '0'
- option verbosity '2'
option force_dns '1'
list force_dns_port '53'
list force_dns_port '853'
@@ -16,16 +23,10 @@ config simple-adblock 'config'
# list force_dns_port '4434'
# list force_dns_port '5443'
# list force_dns_port '8443'
- option canary_domains_icloud '0'
- option canary_domains_mozilla '0'
option led 'none'
- option boot_delay '120'
- option download_timeout '10'
- option curl_retry '3'
option parallel_downloads '1'
- option debug '0'
- option compressed_cache '0'
- list allowed_domain 'cdn.jsdelivr.net'
+ option procd_trigger_wan6 '0'
+ option verbosity '2'
# File size: 16.0K
list blocked_hosts_url 'https://adaway.org/hosts.txt'
diff --git a/net/simple-adblock/files/simple-adblock.init b/net/simple-adblock/files/simple-adblock.init
index bae0cd667..2f10eb0d7 100644
--- a/net/simple-adblock/files/simple-adblock.init
+++ b/net/simple-adblock/files/simple-adblock.init
@@ -1098,11 +1098,82 @@ adb_start() {
json del all
json set triggers
+ if [ "$action" = 'restore' ]; then
+ output 0 "Starting $serviceName... "
+ output 3 "Starting $serviceName...\\n"
+ json set status "statusStarting"
+ if cache 'test_gzip' && ! cache 'test' && [ ! -s "$outputFile" ]; then
+ output 3 'Found compressed cache file, unpacking it '
+ json set message 'found compressed cache file, unpacking it.'
+ if cache 'unpack_gzip'; then
+ output_okn
+ else
+ output_failn
+ json add error "errorRestoreCompressedCache"
+ output "$_ERROR_: $(get_error_text 'errorRestoreCompressedCache')!\\n"
+ action='download'
+ fi
+ fi
+ if cache 'test' && [ ! -s "$outputFile" ]; then
+ output 3 'Found cache file, reusing it '
+ json set message 'found cache file, reusing it.'
+ if cache 'restore'; then
+ output_okn
+ dns 'on_start'
+ else
+ output_failn
+ json add error "errorRestoreCache"
+ output "$_ERROR_: $(get_error_text 'errorRestoreCache')!\\n"
+ action='download'
+ fi
+ fi
+ fi
+ if [ "$action" = 'download' ]; then
+ if [ -s "$outputFile" ] || cache 'test' || cache 'test_gzip'; then
+ output 0 "Force-reloading $serviceName... "
+ output 3 "Force-reloading $serviceName...\\n"
+ json set status "statusForceReloading"
+ else
+ output 0 "Starting $serviceName... "
+ output 3 "Starting $serviceName...\\n"
+ json set status "statusStarting"
+ fi
+ download_lists
+ dns 'on_start'
+ fi
+ if [ "$action" = 'restart' ]; then
+ output 0 "Restarting $serviceName... "
+ output 3 "Restarting $serviceName...\\n"
+ json set status "statusRestarting"
+ dns 'on_start'
+ fi
+ if [ "$action" = 'start' ]; then
+ output 0 "Starting $serviceName... "
+ output 3 "Starting $serviceName...\\n"
+ json set status "statusStarting"
+ dns 'on_start'
+ fi
+ if [ -s "$outputFile" ] && [ "$(json get status)" != "statusFail" ]; then
+ output 0 "$__OK__\\n";
+ json del message
+ json set status "statusSuccess"
+ json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
+ status_service
+ else
+ output 0 "$__FAIL__\\n";
+ json set status "statusFail"
+ json add error "errorOhSnap"
+ status_service
+ fi
+
procd_open_instance 'main'
procd_set_param command /bin/true
procd_set_param stdout 1
procd_set_param stderr 1
procd_open_data
+ json_add_string 'status' "$(json get status)"
+ json_add_string 'errors' "$(json get errors)"
+ json_add_int 'entries' "$(wc -l < "$outputFile")"
json_add_array firewall
if [ "$force_dns" -ne 0 ]; then
for c in $force_dns_port; do
@@ -1181,74 +1252,6 @@ adb_start() {
json_close_array
procd_close_data
procd_close_instance
-
- if [ "$action" = 'restore' ]; then
- output 0 "Starting $serviceName... "
- output 3 "Starting $serviceName...\\n"
- json set status "statusStarting"
- if cache 'test_gzip' && ! cache 'test' && [ ! -s "$outputFile" ]; then
- output 3 'Found compressed cache file, unpacking it '
- json set message 'found compressed cache file, unpacking it.'
- if cache 'unpack_gzip'; then
- output_okn
- else
- output_failn
- json add error "errorRestoreCompressedCache"
- output "$_ERROR_: $(get_error_text 'errorRestoreCompressedCache')!\\n"
- action='download'
- fi
- fi
- if cache 'test' && [ ! -s "$outputFile" ]; then
- output 3 'Found cache file, reusing it '
- json set message 'found cache file, reusing it.'
- if cache 'restore'; then
- output_okn
- dns 'on_start'
- else
- output_failn
- json add error "errorRestoreCache"
- output "$_ERROR_: $(get_error_text 'errorRestoreCache')!\\n"
- action='download'
- fi
- fi
- fi
- if [ "$action" = 'download' ]; then
- if [ -s "$outputFile" ] || cache 'test' || cache 'test_gzip'; then
- output 0 "Force-reloading $serviceName... "
- output 3 "Force-reloading $serviceName...\\n"
- json set status "statusForceReloading"
- else
- output 0 "Starting $serviceName... "
- output 3 "Starting $serviceName...\\n"
- json set status "statusStarting"
- fi
- download_lists
- dns 'on_start'
- fi
- if [ "$action" = 'restart' ]; then
- output 0 "Restarting $serviceName... "
- output 3 "Restarting $serviceName...\\n"
- json set status "statusRestarting"
- dns 'on_start'
- fi
- if [ "$action" = 'start' ]; then
- output 0 "Starting $serviceName... "
- output 3 "Starting $serviceName...\\n"
- json set status "statusStarting"
- dns 'on_start'
- fi
- if [ -s "$outputFile" ] && [ "$(json get status)" != "statusFail" ]; then
- output 0 "$__OK__\\n";
- json del message
- json set status "statusSuccess"
- json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
- status_service
- else
- output 0 "$__FAIL__\\n";
- json set status "statusFail"
- json add error "errorOhSnap"
- status_service
- fi
}
adb_status() {
@@ -1319,14 +1322,14 @@ stop_service() { load_validate_config 'config' adb_stop "'$*'"; }
status_service() { load_validate_config 'config' adb_status "''"; }
service_triggers() {
local wan wan6 i
- local wan6_trigger
+ local procd_trigger_wan6
config_load "$packageName"
- config_get_bool wan6_trigger 'config' 'wan6_trigger' '0'
+ config_get_bool procd_trigger_wan6 'config' 'procd_trigger_wan6' '0'
. /lib/functions/network.sh
network_flush_cache
network_find_wan wan
wan="${wan:-wan}"
- if [ "$wan6_trigger" -ne 0 ]; then
+ if [ "$procd_trigger_wan6" -ne 0 ]; then
network_find_wan6 wan6
wan6="${wan6:-wan6}"
fi
@@ -1404,7 +1407,7 @@ load_validate_config() {
'download_timeout:range(1,40):20' \
'curl_retry:range(1,5):3' \
'verbosity:range(0,2):2' \
- 'wan6_trigger:bool:0' \
+ 'procd_trigger_wan6:bool:0' \
'led:or("", "none", file, device, string)' \
'dns:or("dnsmasq.addnhosts", "dnsmasq.conf", "dnsmasq.ipset", "dnsmasq.servers", "unbound.adb_list"):dnsmasq.servers' \
'dns_instance:or(list(integer, string)):0' \