Skip to content

Commit

Permalink
Append ad list sources to latentWhitelist.txt to prevent them from be…
Browse files Browse the repository at this point in the history
…ing filtered.

Additional fixes for pi-hole#35. This will prevent our own sources from being
filtered out by competing source lists.
  • Loading branch information
korhadris committed Aug 23, 2015
1 parent e464c04 commit a26377d
Showing 1 changed file with 14 additions and 6 deletions.
20 changes: 14 additions & 6 deletions gravity.sh
Expand Up @@ -113,13 +113,21 @@ function gravity_advanced()
if [[ -f $whitelist ]];then
# Remove whitelist entries
numberOf=$(cat $whitelist | sed '/^\s*$/d' | wc -l)
echo "** Whitelisting $numberOf domain(s)..."
plural=; [[ "$numberOf" != "1" ]] && plural=s
echo "** Whitelisting $numberOf domain${plural}..."
# Append a "$" to the end of each line so it can be parsed out with grep -w
echo -n "^$" > $latentWhitelist
awk -F '[# \t]' 'NF>0&&$1!="" {print $1"$"}' $whitelist > $latentWhitelist
cat $origin/$matter | grep -vwf $latentWhitelist > $origin/$andLight
gravity_advanced
else
cat $origin/$matter > $origin/$andLight
gravity_advanced
rm $latentWhitelist
fi

# Prevent our sources from being pulled into the hole
plural=; [[ "${#sources[@]}" != "1" ]] && plural=s
echo "** Whitelisting ${#sources[@]} ad list source${plural}..."
for url in ${sources[@]}
do
echo "$url" | awk -F '/' '{print $3"$"}' >> $latentWhitelist
done
grep -vwf $latentWhitelist $origin/$matter > $origin/$andLight

gravity_advanced

2 comments on commit a26377d

@jacobsalmela
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm having trouble understanding this one. What do you mean by preventing our sources from being pulled into the hole? Is this whitelisting the domains that we are getting the sources from?

@korhadris
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this is whitelisting the domains that are in the source list. I thought the "hole" comment would be in line with the them of your other comments and names. :)

Please sign in to comment.