mirror of
https://github.com/pi-hole/pi-hole
synced 2024-12-22 14:58:08 +00:00
Makes blocklists world readable
Signed-off-by: pvogt09 <50047961+pvogt09@users.noreply.github.com>
This commit is contained in:
parent
2e6198077d
commit
a3d2a1062f
@ -328,6 +328,7 @@ gravity_DownloadBlocklistFromUrl() {
|
||||
# Parse source files into domains format
|
||||
gravity_ParseFileIntoDomains() {
|
||||
local source="${1}" destination="${2}" firstLine abpFilter
|
||||
chmod 644 "${source}"
|
||||
|
||||
# Determine if we are parsing a consolidated list
|
||||
if [[ "${source}" == "${piholeDir}/${matterAndLight}" ]]; then
|
||||
@ -345,6 +346,7 @@ gravity_ParseFileIntoDomains() {
|
||||
sed -r '/(\/|#).*$/d' | \
|
||||
sed -r 's/^.*\s+//g' | \
|
||||
sed -r '/([^\.]+\.)+[^\.]{2,}/!d' > "${destination}"
|
||||
chmod 644 "${destination}"
|
||||
return 0
|
||||
fi
|
||||
|
||||
@ -375,6 +377,7 @@ gravity_ParseFileIntoDomains() {
|
||||
if($0 ~ /^[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+$/) { $0="" }
|
||||
if($0) { print $0 }
|
||||
}' "${source}" > "${destination}"
|
||||
chmod 644 "${destination}"
|
||||
|
||||
# Determine if there are Adblock exception rules
|
||||
# https://adblockplus.org/filters
|
||||
@ -391,6 +394,7 @@ gravity_ParseFileIntoDomains() {
|
||||
|
||||
# Remove exceptions
|
||||
comm -23 "${destination}" <(sort "${destination}.exceptionsFile.tmp") > "${source}"
|
||||
chmod 644 "${source}"
|
||||
mv "${source}" "${destination}"
|
||||
fi
|
||||
|
||||
@ -427,6 +431,7 @@ gravity_ParseFileIntoDomains() {
|
||||
gravity_Cleanup "error"
|
||||
fi
|
||||
fi
|
||||
chmod 644 "${destination}"
|
||||
}
|
||||
|
||||
# Create (unfiltered) "Matter and Light" consolidated list
|
||||
@ -440,6 +445,7 @@ gravity_ConsolidateDownloadedBlocklists() {
|
||||
|
||||
# Empty $matterAndLight if it already exists, otherwise, create it
|
||||
: > "${piholeDir}/${matterAndLight}"
|
||||
chmod 644 "${piholeDir}/${matterAndLight}"
|
||||
|
||||
# Loop through each *.domains file
|
||||
for i in "${activeDomains[@]}"; do
|
||||
|
Loading…
Reference in New Issue
Block a user