mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 10:43:55 +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
|
fi
|
||||||
|
|
||||||
# Strip valid options, leaving only the domain and invalid options
|
# 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
|
# Handle errors
|
||||||
if [[ "${options}" == *" "* ]]; then
|
if [[ "${options}" == *" "* ]]; then
|
||||||
|
@ -181,13 +181,14 @@ Options:
|
||||||
results=($(scanList "${query}" "${lists}" "${method}"))
|
results=($(scanList "${query}" "${lists}" "${method}"))
|
||||||
|
|
||||||
if [[ -n "${results[*]}" ]]; then
|
if [[ -n "${results[*]}" ]]; then
|
||||||
|
blResult=true
|
||||||
# Loop through each scanList line to print appropriate title
|
# Loop through each scanList line to print appropriate title
|
||||||
for result in "${results[@]}"; do
|
for result in "${results[@]}"; do
|
||||||
filename="${result/:*/}"
|
filename="${result/:*/}"
|
||||||
if [[ -n "$exact" ]]; then
|
if [[ -n "$exact" ]]; then
|
||||||
printf " Exact result in %s\n" "${filename}"
|
printf " Exact result in %s\n" "${filename}"
|
||||||
elif [[ -n "$blockpage" ]]; then
|
elif [[ -n "$blockpage" ]]; then
|
||||||
printf " [i] %s\n" "${filename}"
|
printf "π %s\n" "${filename}"
|
||||||
else
|
else
|
||||||
domain="${result/*:/}"
|
domain="${result/*:/}"
|
||||||
if [[ ! "${filename}" == "${filename_prev:-}" ]]; then
|
if [[ ! "${filename}" == "${filename_prev:-}" ]]; then
|
||||||
|
@ -216,7 +217,7 @@ Options:
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ -n "${blockpage}" ]]; then
|
if [[ -n "${blockpage}" ]]; then
|
||||||
echo " ${INFO} ${match}"
|
echo "π ${wildcardlist/*\/}"
|
||||||
else
|
else
|
||||||
echo " *.${match}"
|
echo " *.${match}"
|
||||||
fi
|
fi
|
||||||
|
@ -287,12 +288,18 @@ Options:
|
||||||
filenum=("${filename/list./}")
|
filenum=("${filename/list./}")
|
||||||
filenum=("${filenum/.*/}")
|
filenum=("${filenum/.*/}")
|
||||||
filename="${adlists[$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
|
fi
|
||||||
|
|
||||||
if [[ -n "${exact}" ]]; then
|
if [[ -n "${exact}" ]]; then
|
||||||
printf " %s\n" "${filename}"
|
printf " %s\n" "${filename}"
|
||||||
elif [[ -n "${blockpage}" ]]; then
|
elif [[ -n "${blockpage}" ]]; then
|
||||||
printf " [%s] %s\n" "${filenum}" "${filename}"
|
printf "%s %s\n" "${filenum}" "${filename}"
|
||||||
else # Standard query output
|
else # Standard query output
|
||||||
|
|
||||||
# Print filename heading once per file, not for every match
|
# Print filename heading once per file, not for every match
|
||||||
|
|
Loading…
Reference in a new issue