adblock: update 3.5.5

* accept only ascii aka punycode chars in blocklists to prevent possible
dns backend warnings
* fix cornercase issues in json parsing (backend & frontend)
* slightly optimize tld compression performance
* refine logging
* use uci wrapper where possible
* change indentation from spaces to tabs (saves 8kb)
* add experimental youtube blocklist source

Signed-off-by: Dirk Brenken <dev@brenken.org>
(cherry picked from commit 4987f066f9)
This commit is contained in:
Dirk Brenken
2018-09-01 08:35:35 +02:00
parent 6680ce8650
commit e8813bb561
6 changed files with 993 additions and 997 deletions
+12 -12
View File
@@ -10,7 +10,7 @@
LC_ALL=C
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
mail_ver="1.0.3"
mail_ver="1.0.4"
mail_daemon="$(command -v msmtp)"
mail_profile="adb_notify"
#mail_debug="--debug"
@@ -18,22 +18,22 @@ mail_rc=1
# mail header & mail receiver check
#
mail_receiver=""
mail_sender="no-reply@adblock"
mail_receiver="!!!ChangeMe!!!"
mail_topic="${HOSTNAME}: adblock notification"
mail_head="From: ${mail_sender}\nTo: ${mail_receiver}\nSubject: ${mail_topic}\nReply-to: ${mail_sender}\nMime-Version: 1.0\nContent-Type: text/html\nContent-Disposition: inline\n\n"
if [ "${mail_receiver}" = "!!!ChangeMe!!!" ]
if [ -z "${mail_receiver}" ]
then
logger -p "err" -t "adblock-notify-[${mail_ver}]" "please change the 'mail_receiver' in '/etc/adblock/adblock.notify'"
exit ${mail_rc}
logger -p "err" -t "adblock-notify-${mail_ver}[${$}]" "please supply/customize the 'mail_receiver' in '/etc/adblock/adblock.notify'"
exit ${mail_rc}
fi
# mail daemon check
#
if [ ! -x "${mail_daemon}" ]
then
mail_daemon="$(command -v sendmail)"
mail_daemon="$(command -v sendmail)"
fi
# info preparation
@@ -42,9 +42,9 @@ sys_info="$(strings /etc/banner 2>/dev/null; ubus call system board | sed -e 's/
adb_info="$(/etc/init.d/adblock status 2>/dev/null)"
if [ -f "/var/log/messages" ]
then
log_info="$(awk '/adblock-/{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"&#8629;"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}' /var/log/messages)"
log_info="$(awk '/adblock-/{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"&#8629;"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}' /var/log/messages)"
else
log_info="$(logread -e "adblock-" | awk '{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"&#8629;"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}')"
log_info="$(logread -e "adblock-" | awk '{NR=1;max=79;if(length($0)>max+1)while($0){if(NR==1){print substr($0,1,max),"&#8629;"} else {print " ",substr($0,1,max)}{$0=substr($0,max+1);NR=NR+1}}else print}')"
fi
# mail body
@@ -59,11 +59,11 @@ mail_text="${mail_text}</pre></body></html>"
#
if [ -x "${mail_daemon}" ]
then
printf "%b" "${mail_head}${mail_text}" 2>/dev/null | "${mail_daemon}" ${mail_debug} -a "${mail_profile}" "${mail_receiver}" >/dev/null 2>&1
mail_rc=${?}
logger -p "info" -t "adblock-notify-[${mail_ver}]" "mail sent to '${mail_receiver}' with rc '${mail_rc}'"
printf "%b" "${mail_head}${mail_text}" 2>/dev/null | "${mail_daemon}" ${mail_debug} -a "${mail_profile}" "${mail_receiver}" >/dev/null 2>&1
mail_rc=${?}
logger -p "info" -t "adblock-notify-${mail_ver}[${$}]" "mail sent to '${mail_receiver}' with rc '${mail_rc}'"
else
logger -p "err" -t "adblock-notify-[${mail_ver}]" "msmtp mail daemon not found"
logger -p "err" -t "adblock-notify-${mail_ver}[${$}]" "msmtp mail daemon not found"
fi
exit ${mail_rc}