mirror of
https://github.com/tanrax/maza-ad-blocking.git
synced 2024-12-22 09:55:35 +01:00
This commit is contained in:
parent
4e1aad2739
commit
a592716528
18
README.md
18
README.md
@ -41,7 +41,7 @@ Simple, native and efficient **local ad blocker**. Bash script compatible with *
|
|||||||
### 📡 Update database
|
### 📡 Update database
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
maza update
|
sudo maza update
|
||||||
```
|
```
|
||||||
|
|
||||||
### 🔨 Start
|
### 🔨 Start
|
||||||
@ -59,7 +59,7 @@ sudo maza stop
|
|||||||
### ⚖️ Status
|
### ⚖️ Status
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
maza status
|
sudo maza status
|
||||||
```
|
```
|
||||||
|
|
||||||
## ⚙️ Install or Update
|
## ⚙️ Install or Update
|
||||||
@ -106,12 +106,12 @@ TERM=dumb
|
|||||||
## 🔪 Uninstall
|
## 🔪 Uninstall
|
||||||
|
|
||||||
``` bash
|
``` 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
|
## 🚫 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:
|
Example:
|
||||||
|
|
||||||
@ -140,12 +140,12 @@ ip6-allhosts
|
|||||||
Finally update Maza to apply the changes.
|
Finally update Maza to apply the changes.
|
||||||
|
|
||||||
``` bash
|
``` bash
|
||||||
maza update
|
sudo maza update
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🎯 Add custom domains to block
|
## 🎯 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:
|
For example:
|
||||||
|
|
||||||
@ -158,7 +158,7 @@ ad.about.com
|
|||||||
Then update the database to regenerate the list to include your domains.
|
Then update the database to regenerate the list to include your domains.
|
||||||
|
|
||||||
```
|
```
|
||||||
maza update
|
sudo maza update
|
||||||
```
|
```
|
||||||
|
|
||||||
## 🔒 Alternative DNS list
|
## 🔒 Alternative DNS list
|
||||||
@ -182,7 +182,7 @@ Unfortunately the hosts file does **not support sub-domains (wildcards)**, which
|
|||||||
#### 0 Update Maza
|
#### 0 Update Maza
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
maza update
|
sudo maza update
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 1 Install
|
#### 1 Install
|
||||||
@ -248,7 +248,7 @@ sudo maza start
|
|||||||
#### 0 Update Maza
|
#### 0 Update Maza
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
maza update
|
sudo maza update
|
||||||
```
|
```
|
||||||
|
|
||||||
#### 1 Install
|
#### 1 Install
|
||||||
|
16
maza
16
maza
@ -134,6 +134,19 @@ update() {
|
|||||||
# Remove empty lines
|
# Remove empty lines
|
||||||
custom-sed -i.bak '/^$/d' "$CONFIG$LIST"
|
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
|
# Make dnsmasq format
|
||||||
cp "$CONFIG$LIST" "$CONFIG$LIST_DNSMASQ"
|
cp "$CONFIG$LIST" "$CONFIG$LIST_DNSMASQ"
|
||||||
## Remove triple "-". Example: "my---domain.com" to "my-domain.com". Only in dnsmasq.
|
## Remove triple "-". Example: "my---domain.com" to "my-domain.com". Only in dnsmasq.
|
||||||
@ -165,9 +178,6 @@ update() {
|
|||||||
|
|
||||||
start() {
|
start() {
|
||||||
update
|
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
|
# Notify user
|
||||||
echo "${COLOR_GREEN}ENABLED!${COLOR_RESET}"
|
echo "${COLOR_GREEN}ENABLED!${COLOR_RESET}"
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user