adblock: update 2.6.0

* no longer misuse ubus/procd service object for adblock runtime 
  information, now save all required information directly 
  in a JSON file/format (/tmp/adb_runtime.json)
* new 'status' init command to print runtime information
* add a configurable interface trigger timeout for 
  nested or slow modem/router setups,
  set 'adb_triggerdelay' accordingly (default 1 second)
* add support for pure http download utilities like wget-nossl 
  or uclient-fetch without libustream-ssl (http donwloads only!)
* fix stop action
* fix enabled/disabled action
* fix country code in regional list for china
* LuCI update to reflect all changes

Signed-off-by: Dirk Brenken <dev@brenken.org>
This commit is contained in:
Dirk Brenken
2017-04-10 21:15:34 +02:00
parent 1fdf5d1e7e
commit 45af003ba1
5 changed files with 127 additions and 91 deletions

View File

@@ -4,23 +4,19 @@
START=90
USE_PROCD=1
EXTRA_COMMANDS="suspend resume query"
EXTRA_COMMANDS="suspend resume query status"
EXTRA_HELP=" suspend Suspend adblock processing
resume Resume adblock processing
query <DOMAIN> Query active blocklists for specific domain"
query <DOMAIN> Query active blocklists for specific domains
status Print runtime information"
adb_init="/etc/init.d/adblock"
adb_script="/usr/bin/adblock.sh"
boot()
{
local list iface="$(uci -q get adblock.global.adb_iface)"
for name in ${iface}
do
list="${list} network.interface.${name}"
done
ubus -t 60 wait_for network.interface ${list} 2>/dev/null
adb_boot=1
ubus -t 30 wait_for network.interface 2>/dev/null
rc_procd start_service
}
@@ -28,6 +24,10 @@ start_service()
{
if [ $("${adb_init}" enabled; printf ${?}) -eq 0 ]
then
if [ -n "${adb_boot}" ]
then
return 0
fi
procd_open_instance "adblock"
procd_set_param command "${adb_script}" "${@}"
procd_set_param stdout 1
@@ -39,6 +39,7 @@ start_service()
stop_service()
{
rc_procd "${adb_script}" stop
rc_procd start_service
}
restart()
@@ -61,10 +62,17 @@ query()
rc_procd "${adb_script}" query "${1}"
}
status()
{
rc_procd "${adb_script}" status
}
service_triggers()
{
local iface="$(uci -q get adblock.global.adb_iface)"
local delay="$(uci -q get adblock.global.adb_triggerdelay)"
PROCD_RELOAD_DELAY=$((${delay:=1} * 1000))
for name in ${iface}
do
procd_add_interface_trigger "interface.*.up" "${name}" "${adb_init}" start