mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Modify query.sh to use the gravity database
Signed-off-by: DL6ER <dl6er@dl6er.de>
This commit is contained in:
parent
d5781fb110
commit
bc9b623638
1 changed files with 4 additions and 12 deletions
16
advanced/Scripts/query.sh
Normal file → Executable file
16
advanced/Scripts/query.sh
Normal file → Executable file
|
@ -11,7 +11,7 @@
|
||||||
|
|
||||||
# Globals
|
# Globals
|
||||||
piholeDir="/etc/pihole"
|
piholeDir="/etc/pihole"
|
||||||
adListsList="$piholeDir/adlists.list"
|
gravityDBfile="${piholeDir}/gravity.db"
|
||||||
wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
wildcardlist="/etc/dnsmasq.d/03-pihole-wildcard.conf"
|
||||||
options="$*"
|
options="$*"
|
||||||
adlist=""
|
adlist=""
|
||||||
|
@ -73,11 +73,6 @@ Options:
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [[ ! -e "$adListsList" ]]; then
|
|
||||||
echo -e "${COL_LIGHT_RED}The file $adListsList was not found${COL_NC}"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Handle valid options
|
# Handle valid options
|
||||||
if [[ "${options}" == *"-bp"* ]]; then
|
if [[ "${options}" == *"-bp"* ]]; then
|
||||||
exact="exact"; blockpage=true
|
exact="exact"; blockpage=true
|
||||||
|
@ -185,12 +180,9 @@ if [[ -z "${exact}" ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Get adlist file content as array
|
# Get adlist file content as array
|
||||||
if [[ -n "${adlist}" ]] || [[ -n "${blockpage}" ]]; then
|
if [[ -n "${blockpage}" ]]; then
|
||||||
for adlistUrl in $(< "${adListsList}"); do
|
# Retrieve source URLs from gravity database
|
||||||
if [[ "${adlistUrl:0:4}" =~ (http|www.) ]]; then
|
mapfile -t adlists <<< "$(sqlite3 "${gravityDBfile}" "SELECT address FROM vw_adlists;" 2> /dev/null)"
|
||||||
adlists+=("${adlistUrl}")
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Print "Exact matches for" title
|
# Print "Exact matches for" title
|
||||||
|
|
Loading…
Reference in a new issue