diff --git a/agh_service.sh b/agh_service.sh index 2893519..033afcb 100644 --- a/agh_service.sh +++ b/agh_service.sh @@ -4,21 +4,34 @@ AGH_DIR="/data/adb/agh" SCRIPT_DIR="$AGH_DIR/scripts" MOD_PATH="/data/adb/modules/AdGuardHome" +update_description() { + sed -i "s/description=\[.*\]/description=\[$1\]/" "$MOD_PATH/module.prop" +} + +exec >$AGH_DIR/agh.log 2>&1 + ( - exec >$AGH_DIR/agh.log 2>&1 + wait_time=0 while [ "$(getprop init.svc.bootanim)" != "stopped" ]; do - echo "Waiting for system to finish booting..." - sleep 8 + echo "Waiting for system to finish booting... ($wait_time)" + sleep 3 + wait_time=$((wait_time + 3)) done if [ ! -f "$MOD_PATH/disable" ]; then + echo "start normally" $SCRIPT_DIR/service.sh start if [ ! -f "$MOD_PATH/disable_iptable" ]; then + echo "enabling iptables" $SCRIPT_DIR/iptables.sh enable - sed -i "s/description=\[.*\]/description=\[😎AdGuardHome is running and 🔗iptables is enabled\]/" "$MOD_PATH/module.prop" + update_description "🟢AdGuardHome is running | iptables is enabled" else - sed -i "s/description=\[.*\]/description=\[😎AdGuardHome is running but ⛓️‍💥iptables is disabled\]/" "$MOD_PATH/module.prop" + echo "don't enable iptables" + update_description "🟢AdGuardHome is running | iptables is disabled" fi + else + echo "don't start" + update_description "🔴AdGuardHome is stopped" fi inotifyd $SCRIPT_DIR/inotify.sh $MOD_PATH:d,n >/dev/null 2>&1 & diff --git a/bin/AdGuardHome.yaml b/bin/AdGuardHome.yaml index 6c6ced1..6be08f4 100644 --- a/bin/AdGuardHome.yaml +++ b/bin/AdGuardHome.yaml @@ -59,7 +59,7 @@ dns: bootstrap_prefer_ipv6: false upstream_timeout: 10s private_networks: [] - use_private_ptr_resolvers: false + use_private_ptr_resolvers: true local_ptr_upstreams: [] use_dns64: false dns64_prefixes: [] @@ -135,7 +135,7 @@ filtering: pixabay: true yandex: true youtube: true - blocking_mode: default + blocking_mode: null_ip parental_block_host: family-block.dns.adguard.com safebrowsing_block_host: standard-block.dns.adguard.com rewrites: [] @@ -144,7 +144,7 @@ filtering: safesearch_cache_size: 1048576 parental_cache_size: 1048576 cache_time: 30 - filters_update_interval: 168 + filters_update_interval: 72 blocked_response_ttl: 10 filtering_enabled: true parental_enabled: false diff --git a/changelog.md b/changelog.md index 445512b..8ce4112 100644 --- a/changelog.md +++ b/changelog.md @@ -1,6 +1,4 @@ # ChangeLog -- 新增模块描述动态显示模块状态功能 -- 新增 [Wiki](https://github.com/twoone-3/AdGuardHomeForMagisk/wiki) 页面 -- 更新 `AdGuardHome` 到 v0.107.53 -- 更新 `AdGuardHome.yaml` 版本 -- 删除 `config.sh` 中的 manual 配置项,转而改用创建 `disable_iptable` 文件 \ No newline at end of file +- 修复在模块禁用时,开机模块状态显示错误 +- 优化了模块状态显示emoji +- 优化了默认模块配置 \ No newline at end of file diff --git a/module.prop b/module.prop index 1993156..9cf976d 100644 --- a/module.prop +++ b/module.prop @@ -1,7 +1,7 @@ id=AdGuardHome name=AdGuardHome for Magisk -version=20241012 -versionCode=23 +version=20241030 +versionCode=24 author=twoone3 -description=[😐AdGuardHome is stopped and ⛓️‍💥iptables is disabled] Filter ads at the DNS level +description=[state] Filter ads at the DNS level updateJson=https://raw.githubusercontent.com/twoone-3/AdGuardHomeForMagisk/main/version.json \ No newline at end of file diff --git a/scripts/inotify.sh b/scripts/inotify.sh index d9e73b5..b29be00 100644 --- a/scripts/inotify.sh +++ b/scripts/inotify.sh @@ -8,21 +8,25 @@ MOD_PATH="/data/adb/modules/AdGuardHome" exec >>$AGH_DIR/agh.log 2>&1 +update_description () { + sed -i "s/description=\[.*\]/description=\[$1\]/" "$MOD_PATH/module.prop" +} + if [ "${monitor_file}" = "disable" ]; then if [ "${events}" = "d" ]; then $SCRIPT_DIR/service.sh start if [ ! -f "/data/adb/modules/AdGuardHome/disable_iptable" ]; then $SCRIPT_DIR/iptables.sh enable - sed -i "s/description=\[.*\]/description=\[😎AdGuardHome is running and 🔗iptables is enabled\]/" "$MOD_PATH/module.prop" + update_description "🟢AdGuardHome is running | iptables is enabled" else - sed -i "s/description=\[.*\]/description=\[😎AdGuardHome is running but ⛓️‍💥iptables is disabled\]/" "$MOD_PATH/module.prop" + update_description "🟢AdGuardHome is running | iptables is disabled" fi elif [ "${events}" = "n" ]; then if [ ! -f "/data/adb/modules/AdGuardHome/disable_iptable" ]; then $SCRIPT_DIR/iptables.sh disable fi $SCRIPT_DIR/service.sh stop - sed -i "s/description=\[.*\]/description=\[😐AdGuardHome is stopped and ⛓️‍💥iptables is disabled\]/" "$MOD_PATH/module.prop" + update_description "🔴AdGuardHome is stopped" fi fi @@ -30,12 +34,12 @@ if [ "${monitor_file}" = "disable_iptable" ]; then if [ "${events}" = "d" ]; then if [ ! -f "/data/adb/modules/AdGuardHome/disable" ]; then $SCRIPT_DIR/iptables.sh enable - sed -i "s/description=\[.*\]/description=\[😎AdGuardHome is running and 🔗iptables is enabled\]/" "$MOD_PATH/module.prop" + update_description "🟢AdGuardHome is running | iptables is enabled" fi elif [ "${events}" = "n" ]; then if [ ! -f "/data/adb/modules/AdGuardHome/disable" ]; then $SCRIPT_DIR/iptables.sh disable - sed -i "s/description=\[.*\]/description=\[😎AdGuardHome is running but ⛓️‍💥iptables is disabled\]/" "$MOD_PATH/module.prop" + update_description "🟢AdGuardHome is running | iptables is disabled" fi fi fi diff --git a/scripts/iptables.sh b/scripts/iptables.sh index 1afb499..3acb7b6 100644 --- a/scripts/iptables.sh +++ b/scripts/iptables.sh @@ -3,6 +3,8 @@ AGH_DIR="/data/adb/agh" source "$AGH_DIR/scripts/config.sh" +exec >>$AGH_DIR/agh.log 2>&1 + find_packages_uid() { uid_list=() for package in "${packages_list[@]}"; do diff --git a/scripts/service.sh b/scripts/service.sh index 2d482bd..a3ea5ec 100644 --- a/scripts/service.sh +++ b/scripts/service.sh @@ -5,6 +5,8 @@ BIN_DIR="$AGH_DIR/bin" SCRIPT_DIR="$AGH_DIR/scripts" source "$AGH_DIR/scripts/config.sh" +exec >>$AGH_DIR/agh.log 2>&1 + start_bin() { # to fix https://github.com/AdguardTeam/AdGuardHome/issues/7002 export SSL_CERT_DIR="/system/etc/security/cacerts/" diff --git a/version.json b/version.json index 8ac2f21..6cd8e48 100644 --- a/version.json +++ b/version.json @@ -1,6 +1,6 @@ { - "versionCode": 23, - "version": "20241012", + "versionCode": 24, + "version": "20241030", "zipUrl": "https://github.com/twoone-3/AdGuardHomeForMagisk/releases/latest/download/AdGuardHomeForMagisk_arm64.zip", "changelog": "https://raw.githubusercontent.com/twoone-3/AdGuardHomeForMagisk/main/changelog.md" } \ No newline at end of file