Skip to content

Commit 6a0dec6

Browse files
committed
update: improve module start/stop handling, enhance error reporting, and update filter lists
1 parent 296e7e9 commit 6a0dec6

File tree

4 files changed

+56
-17
lines changed

4 files changed

+56
-17
lines changed

action.sh

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,23 +12,42 @@ update_description() {
1212
}
1313

1414
if [ -f "$PID_FILE" ]; then
15-
echo "Stopping AdGuardHome..."
15+
echo "trying to stop module"
1616
if [ "$enable_iptables" = true ]; then
1717
$SCRIPT_DIR/iptables.sh disable
18+
if [ $? -ne 0 ]; then
19+
update_description "🔴failed to disable iptables"
20+
exit 1
21+
fi
1822
fi
1923
$SCRIPT_DIR/service.sh stop
20-
update_description "🔴AdGuardHome is stopped"
24+
if [ $? -ne 0 ]; then
25+
update_description "🔴failed to stop bin"
26+
exit 1
27+
fi
28+
echo "module is disabled"
29+
update_description "🔴module is disabled"
2130
else
22-
echo "Starting AdGuardHome..."
31+
echo "trying to start module"
2332
$SCRIPT_DIR/service.sh start
33+
if [ $? -ne 0 ]; then
34+
update_description "🔴failed to start bin"
35+
exit 1
36+
fi
2437
if [ "$enable_iptables" = true ]; then
2538
$SCRIPT_DIR/iptables.sh enable
26-
update_description "🟢AdGuardHome is running | iptables is enabled"
39+
if [ $? -ne 0 ]; then
40+
update_description "🔴failed to enable iptables"
41+
exit 1
42+
fi
43+
echo "iptables is enabled"
44+
update_description "🟢bin is running \& iptables is enabled"
2745
else
28-
update_description "🟢AdGuardHome is running | iptables is disabled"
46+
echo "iptables is disabled"
47+
update_description "🟢bin is running \& iptables is disabled"
2948
fi
3049
fi
3150

3251
echo "Waiting for 1 second..."
3352
echo "Refresh the page to see the changes."
34-
sleep 1
53+
sleep 1

bin/data/filters/1732747955.txt

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
||1010pic.com^
2-
||16dd-advertise-1252317822.file.myqcloud.com^
3-
||16dd-advertise-1252317822.image.myqcloud.com^
42
||8le8le.com^
53
||a0.app.xiaomi.com^
64
||aaid.umeng.com^
@@ -92,6 +90,7 @@
9290
||adserver.unityads.unity3d.com^
9391
||adservice.google.cn^
9492
||adservice.google.com^
93+
||adservice.sigmob.cn^
9594
||adserviceretry.kugou.com^
9695
||adsfile.bssdlbig.kugou.com^
9796
||adsfile.qq.com^
@@ -147,7 +146,6 @@
147146
||analysis.yozocloud.cn^
148147
||analytics-api.samsunghealthcn.com^
149148
||analytics.126.net^
150-
||analytics.95516.com^
151149
||analytics.google.com^
152150
||analytics.pinterest.com^
153151
||analytics.pointdrive.linkedin.com^
@@ -235,6 +233,7 @@
235233
||cdn-ads.oss-cn-shanghai.aliyuncs.com^
236234
||cdn-plugin-sync-upgrade-juui.hismarttv.com^
237235
||cdn.ad.xiaomi.com^
236+
||cdn.aiclk.com^
238237
||cdn.ynuf.aliapp.org^
239238
||cfg.imtt.qq.com^
240239
||chat1.jd.com^
@@ -251,6 +250,7 @@
251250
||commdata.v.qq.com^
252251
||config.chsmarttv.com^
253252
||config.unityads.unity3d.com^
253+
||cpc-service-square.aiclk.com^
254254
||cpro.baidustatic.com^
255255
||crashlytics.com^
256256
||crashlyticsreports-pa.googleapis.com^
@@ -261,6 +261,7 @@
261261
||data.mistat.india.xiaomi.com^
262262
||data.mistat.rus.xiaomi.com^
263263
||data.mistat.xiaomi.com^
264+
||dc.sigmob.cn^
264265
||diagnosis.ad.xiaomi.com^
265266
||dig.bdurl.net^
266267
||dl.zuimeitianqi.com^
@@ -375,6 +376,7 @@
375376
||kl.67it.com^
376377
||klink.volceapplog.com^
377378
||knicks.jd.com^
379+
||ks.ferlytc.com^
378380
||ks.pull.yximgs.com^
379381
||launcher.smart-tv.cn^
380382
||launcherimg.smart-tv.cn^
@@ -417,6 +419,7 @@
417419
||log.zijieapi.com^
418420
||log1.cmpassport.com^
419421
||logbak.hicloud.com^
422+
||logrcv.aiclk.com^
420423
||logs.amap.com^
421424
||logservice.hicloud.com^
422425
||logservice1.hicloud.com^
@@ -444,6 +447,7 @@
444447
||mine.baidu.com^
445448
||mission-pub.smart-tv.cn^
446449
||miui-fxcse.avlyun.com^
450+
||mmgame.qpic.cn^
447451
||mnqlog.ldmnq.com^
448452
||mobads-logs.baidu.com^
449453
||mobads-pre-config.cdn.bcebos.com^
@@ -476,6 +480,7 @@
476480
||open.snssdk.com^
477481
||optimus-ads.amap.com^
478482
||orbit.jd.com^
483+
||oss.cdn.aiclk.com^
479484
||oth.eve.mdt.qq.com^
480485
||oth.str.mdt.qq.com^
481486
||otheve.play.aiseet.atianqi.com^
@@ -519,6 +524,7 @@
519524
||res2.hubcloud.com.cn^
520525
||res3.hubcloud.com.cn^
521526
||resolve.umeng.com^
527+
||rev.aiclk.com^
522528
||review.gdtimg.com^
523529
||rms-drcn.platform.dbankcloud.cn^
524530
||roi.soulapp.cn^
@@ -532,7 +538,6 @@
532538
||samsung-com.112.2o7.net^
533539
||samsungads.com^
534540
||sanme2.taisantech.com^
535-
||saveu5-normal-lq.zijieapi.com^
536541
||scdown.qq.com^
537542
||scs.openspeech.cn^
538543
||sdk-ab-config.qquanquan.com^
@@ -620,6 +625,7 @@
620625
||tnc3-bjlgy.zijieapi.com^
621626
||toblog.ctobsnssdk.com^
622627
||trace.qq.com^
628+
||tracelog-debug.aiclk.com^
623629
||tracelog-debug.qquanquan.com^
624630
||track.lc.quark.cn^
625631
||track.uc.cn^
@@ -648,9 +654,11 @@
648654
||union.baidu.com^
649655
||update.avlyun.sec.miui.com^
650656
||update.lejiao.tv^
657+
||update0.aiclk.com^
651658
||upgrade-update.hismarttv.com^
652659
||uranus.jd.com^
653660
||us.l.qq.com^
661+
||usr-api.aiclk.com^
654662
||v.adintl.cn^
655663
||v.adx.hubcloud.com.cn^
656664
||v1-ad.video.yximgs.com^
@@ -709,6 +717,7 @@
709717
||ws.sj.qq.com^
710718
||www42.zskwai.com^
711719
||wxa.wxs.qq.com^
720+
||wxaintpcos.wxqcloud.qq.com.cn^
712721
||wximg.wxs.qq.com^
713722
||wxsmw.wxs.qq.com^
714723
||wxsnsad.tc.qq.com^
@@ -717,7 +726,6 @@
717726
||wxsnsdythumb.wxs.qq.com^
718727
||xc.gdt.qq.com^
719728
||xiaomi-dtv.m.cn.miaozhen.com^
720-
||xiaoshuo.wtzw.com^
721729
||xlivrdr.com^
722730
||xlmzc.cnjp-exp.com^
723731
||xlog.jd.com^

scripts/inotify.sh

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,29 @@ source "$AGH_DIR/scripts/config.sh"
99

1010
exec >>$AGH_DIR/agh.log 2>&1
1111

12-
update_description () {
12+
update_description() {
1313
sed -i "s/description=\[.*\]/description=\[$1\]/" "$MOD_PATH/module.prop"
1414
}
1515

1616
if [ "${monitor_file}" = "disable" ]; then
1717
if [ "${events}" = "d" ]; then
18+
echo "trying to stop module"
1819
$SCRIPT_DIR/service.sh start
20+
if [ $? -ne 0 ]; then
21+
update_description "🔴failed to start bin"
22+
exit 1
23+
fi
1924
if [ "$enable_iptables" = true ]; then
2025
$SCRIPT_DIR/iptables.sh enable
21-
update_description "🟢AdGuardHome is running | iptables is enabled"
26+
if [ $? -ne 0 ]; then
27+
update_description "🔴failed to enable iptables"
28+
exit 1
29+
fi
30+
echo "iptables is enabled"
31+
update_description "🟢bin is running \& iptables is enabled"
2232
else
23-
update_description "🟢AdGuardHome is running | iptables is disabled"
33+
echo "iptables is disabled"
34+
update_description "🟢bin is running \& iptables is disabled"
2435
fi
2536
elif [ "${events}" = "n" ]; then
2637
if [ "$enable_iptables" = true ]; then
@@ -29,4 +40,4 @@ if [ "${monitor_file}" = "disable" ]; then
2940
$SCRIPT_DIR/service.sh stop
3041
update_description "🔴AdGuardHome is stopped"
3142
fi
32-
fi
43+
fi

service.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,10 +36,11 @@ exec >$AGH_DIR/agh.log 2>&1
3636
update_description "🔴failed to enable iptables"
3737
exit 1
3838
fi
39-
update_description "🟢bin is running & iptables is enabled"
39+
echo "iptables is enabled"
40+
update_description "🟢bin is running \& iptables is enabled"
4041
else
4142
echo "iptables is disabled"
42-
update_description "🟢bin is running & iptables is disabled"
43+
update_description "🟢bin is running \& iptables is disabled"
4344
fi
4445
else
4546
echo "module is disabled"

0 commit comments

Comments
 (0)