mirror of
https://github.com/novatiq/packages.git
synced 2026-04-30 07:28:39 +01:00
adblock: update 1.2.1
* small optimizations & cosmetics adblock: release 1.2.0 * rework download/backup/restore handling * rework firewall handling * refine whitelist parsing * changed default null-ip to 198.18.0.1 to prevent conflicts with bcp38 * spread traffic from ad servers (port 80/443) on two uhttpd instances, this fixes timeouts on sites with many ssl ad server connections, i.e. youtube.com * provide statistics & last runtime for LuCI interface * documentation update Signed-off-by: Dirk Brenken <dev@brenken.org> (cherry picked from commit8ab3d8bdc2) (cherry picked from commit672dd10b10)
This commit is contained in:
committed by
Hannu Nyman
parent
73776792f7
commit
d89f201d66
@@ -2,12 +2,11 @@
|
||||
#
|
||||
|
||||
START=99
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
EXTRA_COMMANDS="toggle cfgup"
|
||||
EXTRA_HELP=" toggle Toggle adblocking 'on' or 'off'
|
||||
cfgup Update the adblock configuration file"
|
||||
|
||||
PATH="/usr/sbin:/usr/bin:/sbin:/bin"
|
||||
|
||||
adb_debug=0
|
||||
if [ $((adb_debug)) -eq 0 ]
|
||||
then
|
||||
@@ -59,45 +58,62 @@ start()
|
||||
|
||||
restart()
|
||||
{
|
||||
restart="true"
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
reload()
|
||||
{
|
||||
restart="true"
|
||||
stop
|
||||
start
|
||||
}
|
||||
|
||||
stop()
|
||||
{
|
||||
if [ -n "$(${adb_uci} -q get "adblock.global.adb_overall_count")" ]
|
||||
cfg_check="$(${adb_uci} -q get "adblock.global.adb_overall_count")"
|
||||
if [ -n "${cfg_check}" ] && [ -z "${restart}" ]
|
||||
then
|
||||
. "/lib/functions.sh"
|
||||
config_load adblock
|
||||
config_foreach rm_config source
|
||||
"${adb_uci}" -q delete "adblock.global.adb_dnstoggle"
|
||||
"${adb_uci}" -q delete "adblock.global.adb_overall_count"
|
||||
"${adb_uci}" -q delete "adblock.global.adb_percentage"
|
||||
"${adb_uci}" -q delete "adblock.global.adb_lastrun"
|
||||
"${adb_uci}" -q commit "adblock"
|
||||
fi
|
||||
fw_check="$(iptables -w -vnL | grep -Fo "adb-")"
|
||||
if [ -n "${fw_check}" ] && [ -z "${restart}" ]
|
||||
then
|
||||
iptables-save -t nat | grep -Fv -- "adb-" | iptables-restore
|
||||
iptables-save -t filter | grep -Fv -- "adb-" | iptables-restore
|
||||
if [ -n "$(lsmod | grep -F "ip6table_nat")" ]
|
||||
then
|
||||
ip6tables-save -t nat | grep -Fv -- "adb-" | ip6tables-restore
|
||||
ip6tables-save -t filter | grep -Fv -- "adb-" | ip6tables-restore
|
||||
fi
|
||||
fi
|
||||
if [ -d "${adb_dnshidedir}" ]
|
||||
then
|
||||
find "${adb_dnshidedir}" -maxdepth 1 -type f -name "${adb_dnsprefix}*" -exec mv -f "{}" "${adb_dnsdir}" \;
|
||||
fi
|
||||
rm_done="$(find "${adb_dnsdir}" -maxdepth 1 -type f -name "${adb_dnsprefix}*" -print -exec rm -f "{}" \;)"
|
||||
rc=${?}
|
||||
if [ $((rc)) -eq 0 ] && [ -n "${rm_done}" ]
|
||||
dns_check="$(find "${adb_dnsdir}" -maxdepth 1 -type f -name "${adb_dnsprefix}*" -print -exec rm -f "{}" \;)"
|
||||
if [ -n "${dns_check}" ]
|
||||
then
|
||||
rm -rf "${adb_dnshidedir}"
|
||||
/etc/init.d/dnsmasq restart
|
||||
/etc/init.d/firewall restart
|
||||
fi
|
||||
uhttpd_pid="$(pgrep -f "uhttpd -h /www/adblock")"
|
||||
if [ -n "${uhttpd_pid}" ]
|
||||
www_check="$(pgrep -f "uhttpd -h /www/adblock")"
|
||||
if [ -n "${www_check}" ]
|
||||
then
|
||||
kill -9 "${uhttpd_pid}"
|
||||
for pid in ${www_check}
|
||||
do
|
||||
kill -9 "${pid}"
|
||||
done
|
||||
fi
|
||||
if [ -n "${rm_done}" ] || [ -n "${uhttpd_pid}" ]
|
||||
if [ -n "${cfg_check}" ] || [ -n "${fw_check}" ] || [ -n "${dns_check}" ] || [ -n "${www_check}" ]
|
||||
then
|
||||
"${adb_log}" ${log_parm} -t "adblock[${adb_pid}] info " "all adblock related services stopped" 2>&1
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user