mirror of
https://github.com/pi-hole/pi-hole.git
synced 2024-11-15 02:42:58 +00:00
Submission stale, addressing @mcat12's comments
Signed-off-by: Adam Warner <adamw@rner.email>
This commit is contained in:
parent
2feb5f22cc
commit
0131055ec9
1 changed files with 8 additions and 9 deletions
13
gravity.sh
13
gravity.sh
|
@ -72,11 +72,10 @@ fi
|
||||||
pihole_FTL="${piholeDir}/pihole-FTL.conf"
|
pihole_FTL="${piholeDir}/pihole-FTL.conf"
|
||||||
if [[ -f "${pihole_FTL}" ]]; then
|
if [[ -f "${pihole_FTL}" ]]; then
|
||||||
source "${pihole_FTL}"
|
source "${pihole_FTL}"
|
||||||
if [[ -z "${BLOCKINGMODE}" ]] ; then
|
|
||||||
BLOCKINGMODE="Default (NULL)"
|
|
||||||
fi
|
fi
|
||||||
else
|
|
||||||
BLOCKINGMODE="Default (NULL)"
|
if [[ -z "${BLOCKINGMODE}" ]] ; then
|
||||||
|
BLOCKINGMODE="NULL"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Determine if superseded pihole.conf exists
|
# Determine if superseded pihole.conf exists
|
||||||
|
@ -237,20 +236,20 @@ gravity_DownloadBlocklistFromUrl() {
|
||||||
if [[ $(dig "${domain}" | grep "NXDOMAIN" -c) -ge 1 ]]; then
|
if [[ $(dig "${domain}" | grep "NXDOMAIN" -c) -ge 1 ]]; then
|
||||||
blocked=true
|
blocked=true
|
||||||
fi;;
|
fi;;
|
||||||
"NULL"|"Default (NULL)"|*)
|
"NULL"|*)
|
||||||
if [[ $(dig "${domain}" +short | grep "0.0.0.0" -c) -ge 1 ]]; then
|
if [[ $(dig "${domain}" +short | grep "0.0.0.0" -c) -ge 1 ]]; then
|
||||||
blocked=true
|
blocked=true
|
||||||
fi;;
|
fi;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [[ "${blocked}" == true ]]; then
|
if [[ "${blocked}" == true ]]; then
|
||||||
ip=$(dig "@${CONDITIONAL_FORWARDING_IP}" +short "${domain}")
|
ip=$(dig "@${PIHOLE_DNS_1}" +short "${domain}")
|
||||||
if [[ $(echo "${url}" | awk -F '://' '{print $1}') = "https" ]]; then
|
if [[ $(echo "${url}" | awk -F '://' '{print $1}') = "https" ]]; then
|
||||||
port=443;
|
port=443;
|
||||||
else port=80
|
else port=80
|
||||||
fi
|
fi
|
||||||
bad_list=$(pihole -q -adlist hosts-file.net | head -n1 | awk -F 'Match found in ' '{print $2}')
|
bad_list=$(pihole -q -adlist hosts-file.net | head -n1 | awk -F 'Match found in ' '{print $2}')
|
||||||
echo -e "${OVER} ${CROSS} ${str} ${domain} is blocked by ${bad_list%:} on Pi-hole. Using DNS on ${CONDITIONAL_FORWARDING_IP} to download ${url}";
|
echo -e "${OVER} ${CROSS} ${str} ${domain} is blocked by ${bad_list%:}. Using DNS on ${PIHOLE_DNS_1} to download ${url}";
|
||||||
echo -ne " ${INFO} ${str} Pending..."
|
echo -ne " ${INFO} ${str} Pending..."
|
||||||
cmd_ext="--resolve $domain:$port:$ip $cmd_ext"
|
cmd_ext="--resolve $domain:$port:$ip $cmd_ext"
|
||||||
fi
|
fi
|
||||||
|
|
Loading…
Reference in a new issue