simple-adblock: config update file fix

Signed-off-by: Stan Grishin <stangri@melmac.net>
This commit is contained in:
Stan Grishin
2020-10-08 02:39:04 +00:00
committed by Paul Spooren
parent b564c07a5b
commit 418e3b2948
6 changed files with 23 additions and 220 deletions
+12 -9
View File
@@ -10,7 +10,7 @@ USE_PROCD=1
LC_ALL=C
# shellcheck disable=SC2034
EXTRA_COMMANDS='check dl killcache sizes show'
EXTRA_COMMANDS='check dl killcache sizes show version'
# shellcheck disable=SC2034
EXTRA_HELP=' check Checks if specified domain is found in current block-list
dl Force-downloads all enabled block-list
@@ -53,7 +53,8 @@ readonly _FAIL_='\033[0;31m\xe2\x9c\x97\033[0m'
readonly __OK__='\033[0;32m[\xe2\x9c\x93]\033[0m'
readonly __FAIL__='\033[0;31m[\xe2\x9c\x97]\033[0m'
readonly _ERROR_='\033[0;31mERROR\033[0m'
readonly configUpdateURL='https://cdn.jsdelivr.net/gh/openwrt/packages/net/simple-adblock/files/simple-adblock.conf.update'
version() { echo "$PKG_VERSION"; }
getStatusText() {
local _ret
@@ -143,6 +144,7 @@ debug=0
compressedCache=0
ipv6Enabled=0
configUpdateEnabled=0
configUpdateURL=''
bootDelay=120
dlTimeout=20
curlRetry=3
@@ -186,6 +188,7 @@ load_package_config() {
config_get blocked_domains 'config' 'blocked_domain'
config_get blocked_domains_urls 'config' 'blocked_domains_url'
config_get blocked_hosts_urls 'config' 'blocked_hosts_url'
config_get configUpdateURL 'config' 'config_update_url' 'https://cdn.jsdelivr.net/gh/openwrt/packages/net/simple-adblock/files/simple-adblock.conf.update'
if [ "$targetDNS" != 'dnsmasq.addnhosts' ] && [ "$targetDNS" != 'dnsmasq.conf' ] && \
[ "$targetDNS" != 'dnsmasq.servers' ] && [ "$targetDNS" != 'unbound.adb_list' ] && \
@@ -1161,11 +1164,11 @@ killcache() {
show() { showstatus; }
status_service() { showstatus; }
showstatus() {
local status="$(tmpfs get status)"
local message="$(tmpfs get message)"
local error="$(tmpfs get error)"
local stats="$(tmpfs get stats)"
local c url
local c url status message error stats
status="$(tmpfs get status)"
message="$(tmpfs get message)"
error="$(tmpfs get error)"
stats="$(tmpfs get stats)"
if [ "$status" = "statusSuccess" ]; then
output "$stats "; output_okn;
else
@@ -1216,8 +1219,8 @@ service_triggers() {
check() {
load_package_config
local string="$1"
local c="$(grep -c "$string" "$outputFile")"
local c string="$1"
c="$(grep -c "$string" "$outputFile")"
if [ ! -s "$outputFile" ]; then
echo "No block-list ('$outputFile') found."
elif [ -z "$string" ]; then