Add ignore domain list

This commit is contained in:
Andros Fenollosa 2023-03-13 18:41:15 +01:00
parent c4c84b1474
commit 50eb9863ef
2 changed files with 39 additions and 9 deletions

View File

@ -30,33 +30,33 @@ Simple, native and efficient **local ad blocker**. Bash script compatible with *
## 📟 Commands ## 📟 Commands
### 📡 Update database ### 📡 Update database
``` bash ``` bash
maza update maza update
``` ```
### 🔨 Start ### 🔨 Start
``` bash ``` bash
sudo maza start sudo maza start
``` ```
### 🛠 Stop ### 🛠 Stop
``` bash ``` bash
sudo maza stop sudo maza stop
``` ```
### ⚖️ Status ### ⚖️ Status
``` bash ``` bash
maza status maza status
``` ```
## ⚙️ Install ## ⚙️ Install
### 😥 Requirements ### 😥 Requirements
- **bash** 4.0 or higher - **bash** 4.0 or higher
- **curl** - **curl**
@ -94,9 +94,32 @@ Add the following line at the end.
sudo rm /usr/local/bin/maza && sudo rm -r ~/.maza sudo rm /usr/local/bin/maza && sudo rm -r ~/.maza
``` ```
## 🚫 Not blocking certain domains
Create a file named `ignore` inside the Maza configuration folder.
``` bash
touch ~/.maza/ignore
```
Edit the file for all domains that you do not want to ignore with a line break.
Example:
``` txt
ads-twitter.com
ads.twitter.com
```
Finally update Maza to apply the changes.
``` bash
maza update
```
## 🔒 Alternative DNS list ## 🔒 Alternative DNS list
By default the Yoyo DNS list (Peter Lowe) is used. If you want to use another list, like Steven Black's for example, you must modify the variable in line 7. By default the Yoyo DNS list (Peter Lowe) is used. If you want to use another list, like Steven Black's for example, you must modify the variable in line 7.
It would go from: It would go from:
@ -292,4 +315,3 @@ Remember to make a backup copy of `/etc/hosts` in case of unforeseen circumstanc
## 🧑‍🎨 Credits ## 🧑‍🎨 Credits
<a target="_blank" href="https://andros.dev/">Andros Fenollosa</a> <a target="_blank" href="https://andros.dev/">Andros Fenollosa</a>

8
maza
View File

@ -15,6 +15,7 @@ COLOR_GREEN=$(tput setaf 2)
COLOR_RESET=$(tput sgr0) COLOR_RESET=$(tput sgr0)
LIST="list" LIST="list"
LIST_DNSMASQ="dnsmasq.conf" LIST_DNSMASQ="dnsmasq.conf"
IGNORE_LIST_FILE="ignore"
START_TAG="## MAZA - List ad blocking" START_TAG="## MAZA - List ad blocking"
PROJECT="### https://github.com/tanrax/maza-ad-blocking" PROJECT="### https://github.com/tanrax/maza-ad-blocking"
AUTHOR="### Created by Andros Fenollosa (https://andros.dev/)" AUTHOR="### Created by Andros Fenollosa (https://andros.dev/)"
@ -97,6 +98,13 @@ update() {
custom-sed -i.bak "1i\\$START_TAG" "$CONFIG$LIST_DNSMASQ" custom-sed -i.bak "1i\\$START_TAG" "$CONFIG$LIST_DNSMASQ"
## Add end tag DNS DNSMASQ in first line ## Add end tag DNS DNSMASQ in first line
echo "$END_TAG" >> "$CONFIG$LIST_DNSMASQ" echo "$END_TAG" >> "$CONFIG$LIST_DNSMASQ"
# Remove the domains to ignore. They are located in ".maza/ignore"
if [ -f "$CONFIG/$IGNORE_LIST_FILE" ]; then
while IFS= read -r domain; do
custom-sed -i.bak "/$domain/d" "$CONFIG$LIST"
custom-sed -i.bak "/$domain/d" "$CONFIG$LIST_DNSMASQ"
done < "$CONFIG/$IGNORE_LIST_FILE"
fi
# Remove temp file # Remove temp file
rm "$CONFIG$LIST.bak" rm "$CONFIG$LIST.bak"
rm "$CONFIG$LIST_DNSMASQ.bak" rm "$CONFIG$LIST_DNSMASQ.bak"