Andros Fenollosa 2024-08-19 20:54:48 +02:00
parent 4e1aad2739
commit a592716528
2 changed files with 22 additions and 12 deletions

View File

@ -41,7 +41,7 @@ Simple, native and efficient **local ad blocker**. Bash script compatible with *
### 📡 Update database
``` bash
maza update
sudo maza update
```
### 🔨 Start
@ -59,7 +59,7 @@ sudo maza stop
### ⚖️ Status
``` bash
maza status
sudo maza status
```
## ⚙️ Install or Update
@ -106,12 +106,12 @@ TERM=dumb
## 🔪 Uninstall
``` bash
sudo rm /usr/local/bin/maza && sudo rm -r ~/.config/maza
sudo rm /usr/local/bin/maza && sudo rm -r /root/.config/maza
```
## 🚫 Not blocking certain domains
Edit `~/.config/maza/ignore` and add the domains you want to ignore.
Edit `/root/.config/maza/ignore` and add the domains you want to ignore.
Example:
@ -140,12 +140,12 @@ ip6-allhosts
Finally update Maza to apply the changes.
``` bash
maza update
sudo maza update
```
## 🎯 Add custom domains to block
If you want to include your own domains to be blocked, you can add them to `~/.config/maza/custom-domains`. They must each be on one line, ignoring end slash or protocol (`http` or `https`).
If you want to include your own domains to be blocked, you can add them to `/root/.config/maza/custom-domains`. They must each be on one line, ignoring end slash or protocol (`http` or `https`).
For example:
@ -158,7 +158,7 @@ ad.about.com
Then update the database to regenerate the list to include your domains.
```
maza update
sudo maza update
```
## 🔒 Alternative DNS list
@ -182,7 +182,7 @@ Unfortunately the hosts file does **not support sub-domains (wildcards)**, which
#### 0 Update Maza
```bash
maza update
sudo maza update
```
#### 1 Install
@ -248,7 +248,7 @@ sudo maza start
#### 0 Update Maza
```bash
maza update
sudo maza update
```
#### 1 Install

16
maza
View File

@ -134,6 +134,19 @@ update() {
# Remove empty lines
custom-sed -i.bak '/^$/d' "$CONFIG$LIST"
# Update HOST_FILE
## Remove old list
custom-sed -i "/$START_TAG/,/$END_TAG/d" "$HOST_FILE"
## Add List to host file.
# Add start tag DNS list in first line
echo "$START_TAG" >> "$HOST_FILE"
echo "$PROJECT" >> "$HOST_FILE"
echo "$AUTHOR" >> "$HOST_FILE"
# Transform "mydomain.com" to "127.0.0.1 mydomain.com" except comments
custom-sed "/^#/!s/^/127.0.0.1 /g" "$CONFIG$LIST" >> "$HOST_FILE"
# Add end tag DNS list in first line
echo "$END_TAG" >> "$HOST_FILE"
# Make dnsmasq format
cp "$CONFIG$LIST" "$CONFIG$LIST_DNSMASQ"
## Remove triple "-". Example: "my---domain.com" to "my-domain.com". Only in dnsmasq.
@ -165,9 +178,6 @@ update() {
start() {
update
# Add List to host file.
# Transform "mydomain.com" to "127.0.0.1 mydomain.com" except comments
custom-sed "/^#/!s/^/127.0.0.1 /g" "$CONFIG$LIST" >> "$HOST_FILE"
# Notify user
echo "${COLOR_GREEN}ENABLED!${COLOR_RESET}"
}