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>
This commit is contained in:
parent
bfb980f18e
commit
42cc50eec8
3 changed files with 8 additions and 6 deletions
|
@ -6,7 +6,7 @@ include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=adblock-fast
|
PKG_NAME:=adblock-fast
|
||||||
PKG_VERSION:=1.0.0
|
PKG_VERSION:=1.0.0
|
||||||
PKG_RELEASE:=6
|
PKG_RELEASE:=7
|
||||||
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
PKG_MAINTAINER:=Stan Grishin <stangri@melmac.ca>
|
||||||
PKG_LICENSE:=GPL-3.0-or-later
|
PKG_LICENSE:=GPL-3.0-or-later
|
||||||
|
|
||||||
|
|
|
@ -29,6 +29,7 @@ config adblock-fast 'config'
|
||||||
# list force_dns_port '8443'
|
# list force_dns_port '8443'
|
||||||
option led 'none'
|
option led 'none'
|
||||||
option parallel_downloads '1'
|
option parallel_downloads '1'
|
||||||
|
option pause_timeout '20'
|
||||||
option procd_trigger_wan6 '0'
|
option procd_trigger_wan6 '0'
|
||||||
option procd_boot_wan_timeout '60'
|
option procd_boot_wan_timeout '60'
|
||||||
option verbosity '2'
|
option verbosity '2'
|
||||||
|
|
|
@ -1155,7 +1155,7 @@ adb_allow() {
|
||||||
for c in $string; do
|
for c in $string; do
|
||||||
output 2 " $c "
|
output 2 " $c "
|
||||||
hf="$(echo "$c" | sed 's/\./\\./g')"
|
hf="$(echo "$c" | sed 's/\./\\./g')"
|
||||||
if sed -i "/\(^\|\.\)${hf}$/d;" "$outputFile" && \
|
if sed -i "\:\(/\|\.\)${hf}/:d" "$outputFile" && \
|
||||||
uci_add_list_if_new "${packageName}" 'config' 'allowed_domain' "$c"; then
|
uci_add_list_if_new "${packageName}" 'config' 'allowed_domain' "$c"; then
|
||||||
output_ok
|
output_ok
|
||||||
else
|
else
|
||||||
|
@ -1171,7 +1171,7 @@ adb_allow() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
output 2 "Committing changes to config "
|
output 2 "Committing changes to config "
|
||||||
if [ -n "$(uci_changes "$packageName")" ] && uci_commit "$packageName"; then
|
if uci_commit "$packageName"; then
|
||||||
allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
|
allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
|
||||||
json set triggers
|
json set triggers
|
||||||
json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
|
json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
|
||||||
|
@ -1196,7 +1196,8 @@ adb_allow() {
|
||||||
output 2 "Allowing domain(s) \\n"
|
output 2 "Allowing domain(s) \\n"
|
||||||
for c in $string; do
|
for c in $string; do
|
||||||
output 2 " $c "
|
output 2 " $c "
|
||||||
if sed -i "/${string}/d" "$outputFile" && \
|
hf="$(echo "$c" | sed 's/\./\\./g')"
|
||||||
|
if sed -i "\:\(\"\|\.\)${hf}\":d" "$outputFile" && \
|
||||||
uci_add_list_if_new "$packageName" 'config' 'allowed_domain' "$string"; then
|
uci_add_list_if_new "$packageName" 'config' 'allowed_domain' "$string"; then
|
||||||
output_ok
|
output_ok
|
||||||
else
|
else
|
||||||
|
@ -1212,7 +1213,7 @@ adb_allow() {
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
output 2 "Committing changes to config "
|
output 2 "Committing changes to config "
|
||||||
if [ -n "$(uci_changes "$packageName")" ] && uci_commit "$packageName"; then
|
if uci_commit "$packageName"; then
|
||||||
allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
|
allowed_domain="$(uci_get "$packageName" 'config' 'allowed_domain')"
|
||||||
json set triggers
|
json set triggers
|
||||||
json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
|
json set stats "$serviceName is blocking $(wc -l < "$outputFile") domains (with ${dns})"
|
||||||
|
@ -1725,7 +1726,7 @@ load_validate_config() {
|
||||||
'config_update_enabled:bool:0' \
|
'config_update_enabled:bool:0' \
|
||||||
'config_update_url:string:https://cdn.jsdelivr.net/gh/openwrt/packages/net/adblock-fast/files/adblock-fast.conf.update' \
|
'config_update_url:string:https://cdn.jsdelivr.net/gh/openwrt/packages/net/adblock-fast/files/adblock-fast.conf.update' \
|
||||||
'download_timeout:range(1,60):20' \
|
'download_timeout:range(1,60):20' \
|
||||||
'pause_timeout:range(10,120):60' \
|
'pause_timeout:range(1,60):20' \
|
||||||
'curl_additional_param:or("", string)' \
|
'curl_additional_param:or("", string)' \
|
||||||
'curl_max_file_size:or("", uinteger)' \
|
'curl_max_file_size:or("", uinteger)' \
|
||||||
'curl_retry:range(0,30):3' \
|
'curl_retry:range(0,30):3' \
|
||||||
|
|
Loading…
Reference in a new issue