mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-12-24 13:50:17 +00:00
Fix queryFunc if adlists URLs have been removed (#1618)
* Fix queryFunc if adlists URLs have been removed * Allow for -adlists command line switch (where the "s" is a typo) * Add error message when unable to find associated adlists URL * Provide PR fix on current dev version * Add blResult variable for white/black match * Supporting Block Page queryFunc fixes * Re-add unmerged lines
This commit is contained in:
parent
714fd93292
commit
e0eb5eb2b1
1 changed files with 11 additions and 4 deletions
15
pihole
15
pihole
|
@ -149,7 +149,7 @@ Options:
|
|||
fi
|
||||
|
||||
# Strip valid options, leaving only the domain and invalid options
|
||||
options=$(sed 's/ \?-\(exact\|adlist\|bp\|all\) \?//g' <<< "$options")
|
||||
options=$(sed 's/ \?-\(exact\|adlist\(s\)\?\|bp\|all\) \?//g' <<< "$options")
|
||||
|
||||
# Handle errors
|
||||
if [[ "${options}" == *" "* ]]; then
|
||||
|
@ -181,13 +181,14 @@ Options:
|
|||
results=($(scanList "${query}" "${lists}" "${method}"))
|
||||
|
||||
if [[ -n "${results[*]}" ]]; then
|
||||
blResult=true
|
||||
# Loop through each scanList line to print appropriate title
|
||||
for result in "${results[@]}"; do
|
||||
filename="${result/:*/}"
|
||||
if [[ -n "$exact" ]]; then
|
||||
printf " Exact result in %s\n" "${filename}"
|
||||
elif [[ -n "$blockpage" ]]; then
|
||||
printf " [i] %s\n" "${filename}"
|
||||
printf "π %s\n" "${filename}"
|
||||
else
|
||||
domain="${result/*:/}"
|
||||
if [[ ! "${filename}" == "${filename_prev:-}" ]]; then
|
||||
|
@ -216,7 +217,7 @@ Options:
|
|||
fi
|
||||
|
||||
if [[ -n "${blockpage}" ]]; then
|
||||
echo " ${INFO} ${match}"
|
||||
echo "π ${wildcardlist/*\/}"
|
||||
else
|
||||
echo " *.${match}"
|
||||
fi
|
||||
|
@ -287,12 +288,18 @@ Options:
|
|||
filenum=("${filename/list./}")
|
||||
filenum=("${filenum/.*/}")
|
||||
filename="${adlists[$filenum]}"
|
||||
|
||||
# If gravity has generated associated .domains files
|
||||
# but adlists.list has been modified since
|
||||
if [[ -z "${filename}" ]]; then
|
||||
filename="${COL_LIGHT_RED}Error: no associated adlists URL found${COL_NC}"
|
||||
fi
|
||||
fi
|
||||
|
||||
if [[ -n "${exact}" ]]; then
|
||||
printf " %s\n" "${filename}"
|
||||
elif [[ -n "${blockpage}" ]]; then
|
||||
printf " [%s] %s\n" "${filenum}" "${filename}"
|
||||
printf "%s %s\n" "${filenum}" "${filename}"
|
||||
else # Standard query output
|
||||
|
||||
# Print filename heading once per file, not for every match
|
||||
|
|
Loading…
Reference in a new issue