Skip to content

Commit cf69c58

Browse files
committed
see changelog.md
1 parent bf4a009 commit cf69c58

File tree

10 files changed

+111
-55
lines changed

10 files changed

+111
-55
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,26 +18,26 @@
1818
# 特性
1919
- DNS 服务器选用腾讯和阿里的公共 DNS,你也可以在 AdGuardHome 的 DNS 设置里更改来满足你的需求
2020
- 仅内置[秋风广告规则](https://github.com/TG-Twilight/AWAvenue-Ads-Rule),精准,轻量,少误杀
21-
- 在 Magisk/KernelSU 中可以通过模块开关实时启动/关闭模块
21+
- 在 Magisk/KernelSU 中可以通过模块开关实时启动/关闭模块,当然你也可以在shell中模拟模块开关
22+
```shell
23+
touch /data/adb/modules/AdguardHome/disable
24+
```
2225
- 可修改位于 `/data/adb/agh/scripts/config.sh` 的配置文件来调整配置
23-
- 覆盖安装时会自动给原模块创建备份
26+
- 在更新模块时,用户可自行选择是否保留原来的配置文件,即使你选择不保留,也会自动备份原来的配置文件到 `/data/adb/agh/backup` 目录下
2427

2528
# FAQ
26-
> Q: 为什么模块无法屏蔽某些广告?
29+
> Q: 为什么模块无法屏蔽全部广告?
2730
28-
> A: 模块通过转发 53 端口的 DNS 请求来实现广告屏蔽,因此无法屏蔽通过 HTTPS 传输的广告,以及与正常内容同域名的广告,如 知乎,Youtube 等
31+
> A: 模块通过转发 53 端口的 DNS 请求来实现广告屏蔽,因此无法屏蔽通过 HTTPS 传输的广告,以及与正常内容同域名的广告,如 知乎,Youtube 等,好在大部分广告还是优先使用 53 端口的 DNS 请求。
2932
30-
> Q: 为什么装上模块后访问页面变慢?
31-
32-
> A: 因为模块会将所有 DNS 请求转发到 AdGuardHome,再由 AdGuardHome 转发到上游的公共 DNS,中间多了一层转发,但模块默认开启了乐观缓存,在第二次访问时将大大减少延迟
33+
> Q: 模块可以与其它代理模块/软件一起使用吗?
3334
34-
> Q: 为什么本来可以访问的页面一段时间后出现了无法访问?
35+
> A: 可以,一般的代理app可以直接兼容(这里推荐使用[FlClash](https://github.com/chen08209/FlClash)),且 AdGuardHome 的 DNS 查询会经过 VPN,其它代理模块看情况使用,可关闭自动 iptables 规则当作普通 DNS 使用
3536
36-
> A: 由于公共 DNS 请求较慢,模块默认配置文件里开启了乐观缓存,可能导致一些过时的 IP 在过期后仍然被使用,可在后台清理DNS缓存来缓解,或者关闭乐观缓存
37+
> Q: 为什么不接入 KernelSU 的 WebUI?
3738
38-
> Q: 模块可以与其它代理模块/软件一起使用吗?
39+
> A: 由于 KernelSU 的 WebUI 在无法显示确认弹窗,导致 AdGuardHome 管理端一些功能无法使用,因此暂时不接入
3940
40-
> A: 可以,一般的代理app可以直接兼容,且 AdGuardHome 的 DNS 查询会经过 VPN,其它代理模块看情况使用,可关闭自动 iptables 规则当作普通 DNS 使用
4141

4242

4343
# 鸣谢

README_en.md

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,27 @@ Follow our channel for the latest news, or join our group for discussion!
1818
# Features
1919
- The DNS server uses Tencent and Alibaba's public DNS, you can also change it in the DNS settings of AdGuardHome to meet your needs.
2020
- Only built-in [Autumn Breeze Ad Rule](https://github.com/TG-Twilight/AWAvenue-Ads-Rule), accurate, lightweight, and low false positives.
21-
- In Magisk/KernelSU, you can start/stop the module in real-time through the module switch.
21+
- In Magisk/KernelSU, you can start/stop the module in real-time using the module switch, or you can simulate the module switch in the shell.
22+
```shell
23+
touch /data/adb/modules/AdguardHome/disable
24+
```
2225
- You can modify the configuration file located in `/data/adb/agh/scripts/config.sh` to adjust the configuration.
23-
- When overwriting installation, the original module will be automatically backed up.
26+
- When updating the module, users can choose whether to keep the original configuration file, even if you choose not to keep it, the original configuration file will be automatically backed up to the `/data/adb/agh/backup` directory.
2427

2528
# FAQ
26-
> Q: Why can't the module block some ads?
29+
> Q: Why can't the module block all ads?
2730
28-
> A: The module blocks ads by forwarding DNS requests on port 53, so it cannot block ads transmitted over HTTPS or ads on the same domain as normal content, such as Zhihu, Youtube, etc.
31+
> A: The module blocks ads by forwarding DNS requests on port 53, so it cannot block ads transmitted over HTTPS or ads on the same domain as normal content, such as Zhihu, Youtube, etc., but fortunately, most ads still prefer to use DNS requests on port 53.
2932
30-
> Q: Why does the page slow down after installing the module?
31-
32-
> A: Because the module forwards all DNS requests to AdGuardHome, which then forwards them to the upstream public DNS, adding an extra layer of forwarding, but the module has optimistic caching enabled by default, which greatly reduces latency on the second visit.
33-
34-
> Q: Why can't I access a page that I could access before after a while?
33+
> Q: Can the module be used with other proxy modules/software?
3534
36-
> A: Because public DNS requests are slow, the module's default configuration file has optimistic caching enabled, which may cause some outdated IPs to continue to be used after they expire, you can clear the DNS cache in the background to alleviate this, or disable optimistic caching.
35+
> A: Yes, general proxy apps can be directly compatible (here we recommend using [FlClash](https://github.com/chen08209/FlClash)), and AdGuardHome's DNS queries will pass through the VPN, other proxy modules can be used as needed, and the automatic iptables rules can be turned off for normal DNS use.
3736
38-
> Q: Can the module be used with other proxy modules/software?
37+
> Q: Why not integrate with KernelSU's WebUI?
3938
40-
> A: Yes, general proxy apps are directly compatible, and AdGuardHome's DNS queries will pass through the VPN, other proxy modules can be used as needed, you can disable automatic iptables rules to use it as a regular DNS.
39+
> A: Because KernelSU's WebUI cannot display confirmation pop-ups, some functions of AdGuardHome's management end cannot be used, so it is not integrated for the time being.
4140
4241
# Acknowledgments
4342
- [AdguardHome_magisk](https://github.com/410154425/AdGuardHome_magisk)
4443
- [akashaProxy](https://github.com/ModuleList/akashaProxy)
45-
- [box_for_magisk](https://github.com/taamarin/box_for_magisk)
46-
- Translated with DeepL.com (free version)
44+
- [box_for_magisk](https://github.com/taamarin/box_for_magisk)

agh_service.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
(
44
while [ "$(getprop init.svc.bootanim)" != "stopped" ]; do
5-
echo "Waiting for system to finish booting..." >/data/adb/agh/agh.log
6-
sleep 5
5+
echo "Waiting for system to finish booting..." >>/data/adb/agh/agh.log
6+
sleep 8
77
done
88
AGH_DIR="/data/adb/agh"
99
SCRIPT_DIR="$AGH_DIR/scripts"

bin/AdGuardHome.yaml

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,18 +23,21 @@ dns:
2323
ratelimit_whitelist: []
2424
refuse_any: true
2525
upstream_dns:
26-
- tls://223.5.5.5
27-
- tls://1.12.12.12
26+
- https://223.5.5.5/dns-query
27+
- https://1.12.12.12/dns-query
2828
upstream_dns_file: ""
2929
bootstrap_dns:
3030
- 223.5.5.5
3131
- 119.29.29.29
3232
fallback_dns: []
33-
upstream_mode: load_balance
33+
upstream_mode: parallel
3434
fastest_timeout: 1s
3535
allowed_clients: []
3636
disallowed_clients: []
37-
blocked_hosts: []
37+
blocked_hosts:
38+
- version.bind
39+
- id.server
40+
- hostname.bind
3841
trusted_proxies:
3942
- 127.0.0.0/8
4043
- ::1/128
@@ -140,7 +143,7 @@ filtering:
140143
parental_cache_size: 1048576
141144
cache_time: 30
142145
filters_update_interval: 168
143-
blocked_response_ttl: 10
146+
blocked_response_ttl: 30
144147
filtering_enabled: true
145148
parental_enabled: false
146149
safebrowsing_enabled: false

changelog.md

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# ChangeLog
2-
- 修复关闭模块时开机仍然启动的问题
3-
- fix the problem that the module is still started when the module is closed
2+
- 修复manual选项不生效的问题
3+
- fix manual option not work
4+
- 更改了模块更新安装时的备份方式
5+
- change the backup method when updating the module
46
- 更新了 README.md
5-
- update README.md
7+
- update README.md
8+
- 更改了默认DNS查询方式为parallel,提高了查询速度
9+
- change the default DNS query method to parallel, improve the query speed

customize.sh

Lines changed: 58 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,75 @@
11
#!/system/bin/sh
22
SKIPUNZIP=1
33

4+
ui_print "- 开始安装 AdGuardHome for $ARCH"
45
ui_print "- Installing AdGuardHome for $ARCH"
56

67
AGH_DIR="/data/adb/agh"
78
BIN_DIR="$AGH_DIR/bin"
89
SCRIPT_DIR="$AGH_DIR/scripts"
10+
BACKUP_DIR="$AGH_DIR/backup"
911
SERVICE_DIR="/data/adb/service.d"
1012

13+
ui_print "- 解压模块基本文件..."
14+
ui_print "- Extracting module basic files..."
15+
unzip -o "$ZIPFILE" "uninstall.sh" -d $MODPATH
16+
unzip -o "$ZIPFILE" "module.prop" -d $MODPATH
17+
unzip -o "$ZIPFILE" "agh_service.sh" -d $SERVICE_DIR
18+
1119
if [ -d "$AGH_DIR" ]; then
12-
ui_print "- Backup existing installation..."
13-
BACKUP_DIR=$(mktemp -d /data/adb/agh.XXXXXXXXXX)
14-
mv "$AGH_DIR"/* "$BACKUP_DIR"
15-
ui_print "- Backup created at $BACKUP_DIR"
20+
# Stop AdGuardHome
21+
local pid_file="/data/adb/agh/bin/agh_pid"
22+
if [ -f "$pid_file" ]; then
23+
ui_print "- 发现正在运行的 AdGuardHome 进程,正在停止..."
24+
ui_print "- Found running AdGuardHome process, stopping..."
25+
kill -9 $(cat "$pid_file")
26+
rm "$pid_file"
27+
sleep 1
28+
fi
29+
ui_print "- 发现旧版模块,是否保留原来的配置文件?"
30+
ui_print "- Found old version, do you want to keep the old configuration?"
31+
ui_print "- (音量上键 = 是, 音量下键 = 否)"
32+
ui_print "- (Volume Up = Yes, Volume Down = No)"
33+
key_click=""
34+
while [ "$key_click" = "" ]; do
35+
key_click="$(getevent -qlc 1 | awk '{ print $3 }' | grep 'KEY_')"
36+
sleep 0.2
37+
done
38+
case "$key_click" in
39+
"KEY_VOLUMEUP")
40+
ui_print "- 保留原来的配置文件..."
41+
ui_print "- Keeping old configuration files..."
42+
unzip -o "$ZIPFILE" "scripts/*" -x "scripts/config.sh" -d $AGH_DIR
43+
unzip -o "$ZIPFILE" "bin/*" -x "bin/AdGuardHome.yaml" -d $AGH_DIR
44+
;;
45+
*)
46+
if [ ! -d "$BACKUP_DIR" ]; then
47+
mkdir -p "$BACKUP_DIR"
48+
else
49+
rm -r "$BACKUP_DIR"
50+
mkdir -p "$BACKUP_DIR"
51+
fi
52+
ui_print "- 正在备份旧配置文件..."
53+
ui_print "- Backing up old configuration files..."
54+
mv "$AGH_DIR/scripts/config.sh" "$BACKUP_DIR"
55+
mv "$AGH_DIR/bin/AdGuardHome.yaml" "$BACKUP_DIR"
56+
ui_print "- 正在解压脚本文件..."
57+
ui_print "- Extracting script files..."
58+
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR
59+
ui_print "- 正在解压二进制文件..."
60+
ui_print "- Extracting binary files..."
61+
unzip -o "$ZIPFILE" "bin/*" -d $AGH_DIR
62+
;;
63+
esac
1664
else
65+
ui_print "- 第一次安装,正在解压文件..."
66+
ui_print "- First time installation, extracting files..."
1767
mkdir -p "$AGH_DIR" "$BIN_DIR" "$SCRIPT_DIR"
68+
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR
69+
unzip -o "$ZIPFILE" "bin/*" -d $AGH_DIR
1870
fi
1971

20-
ui_print "- Extracting files..."
21-
unzip -o "$ZIPFILE" "uninstall.sh" -d $MODPATH
22-
unzip -o "$ZIPFILE" "module.prop" -d $MODPATH
23-
unzip -o "$ZIPFILE" "agh_service.sh" -d $SERVICE_DIR
24-
unzip -o "$ZIPFILE" "scripts/*" -d $AGH_DIR
25-
unzip -o "$ZIPFILE" "bin/*" -d $AGH_DIR
26-
72+
ui_print "- 正在设置权限..."
2773
ui_print "- Setting permissions..."
2874
chmod +x "$BIN_DIR/AdGuardHome"
2975
chmod +x "$SCRIPT_DIR/inotify.sh"
@@ -33,4 +79,5 @@ chmod +x "$SERVICE_DIR/agh_service.sh"
3379
chmod +x "$MODPATH/uninstall.sh"
3480
chown root:net_raw "$BIN_DIR/AdGuardHome"
3581

82+
ui_print "- 安装完成,请重启设备。"
3683
ui_print "- Installation completed, please reboot."

module.prop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
id=AdGuardHome
22
name=AdGuardHome for Magisk
3-
version=20241005
4-
versionCode=21
3+
version=20241007
4+
versionCode=22
55
author=twoone3
66
description=Filter ads at the DNS level
77
updateJson=https://raw.githubusercontent.com/twoone-3/AdGuardHomeForMagisk/main/version.json

scripts/config.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if ! command -v busybox &> /dev/null; then
55
export PATH="/data/adb/magisk:/data/adb/ksu/bin:/data/adb/ap/bin:$PATH:/system/bin"
66
fi
77

8-
# 是否手动模式,默认关闭,开启后不会自动应用iptables规则
8+
# 手动模式,默认关闭,开启后iptables.sh将跳过运行,如果你要在开机状态下修改本项,请先在Magisk/KernelSU关闭模块以确保预期的行为
99
# true: 开启
1010
# false: 关闭
1111
manual=false

scripts/iptables.sh

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ enable_ipv6() {
5555

5656
# sysctl -w net.ipv6.conf.all.accept_ra=2
5757
# sysctl -w net.ipv6.conf.wlan0.accept_ra=2
58-
# sysctl -w net.ipv6.conf.all.disable_ipv6=0
59-
# sysctl -w net.ipv6.conf.default.disable_ipv6=0
58+
sysctl -w net.ipv6.conf.all.disable_ipv6=0
59+
sysctl -w net.ipv6.conf.default.disable_ipv6=0
6060
# sysctl -w net.ipv6.conf.wlan0.disable_ipv6=0
6161
}
6262

@@ -69,11 +69,15 @@ disable_ipv6() {
6969

7070
# sysctl -w net.ipv6.conf.all.accept_ra=0
7171
# sysctl -w net.ipv6.conf.wlan0.accept_ra=0
72-
# sysctl -w net.ipv6.conf.all.disable_ipv6=1
73-
# sysctl -w net.ipv6.conf.default.disable_ipv6=1
72+
sysctl -w net.ipv6.conf.all.disable_ipv6=1
73+
sysctl -w net.ipv6.conf.default.disable_ipv6=1
7474
# sysctl -w net.ipv6.conf.wlan0.disable_ipv6=1
7575
}
7676

77+
if [ "$manual" = true ]; then
78+
exit 0
79+
fi
80+
7781
case "$1" in
7882
enable)
7983
enable_iptables

version.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
2-
"versionCode": 21,
3-
"version": "20241005",
2+
"versionCode": 22,
3+
"version": "20241007",
44
"zipUrl": "https://github.com/twoone-3/AdGuardHomeForMagisk/releases/latest/download/AdGuardHomeForMagisk-arm64.zip",
55
"changelog": "https://raw.githubusercontent.com/twoone-3/AdGuardHomeForMagisk/main/changelog.md"
66
}

0 commit comments

Comments
 (0)