luci-app-mosdns: disable custom adblock list mirror

This commit is contained in:
sbwml 2022-10-30 14:44:59 +08:00
parent 9e1381cb60
commit cca5d2ff12

View File

@ -41,8 +41,10 @@ adlist_update() (
ad_source=$(uci -q get mosdns.config.ad_source)
[ $ad_source = "geosite.dat" ] && exit 0
AD_TMPDIR=$(mktemp -d) || exit 1
google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204)
[ $google_status -ne "204" ] && mirror="https://ghproxy.com/"
if [[ $a =~ "^https://raw.githubusercontent.com" ]]; then
google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204)
[ $google_status -ne "204" ] && mirror="https://ghproxy.com/"
fi
echo -e "\e[1;32mDownloading $mirror$ad_source\e[0m"
curl --connect-timeout 60 -m 90 --ipv4 -fSLo "$AD_TMPDIR/adlist.txt" "$mirror$ad_source"
if [ $? -ne 0 ]; then