parent
20f7958123
commit
837775b481
@ -39,27 +39,27 @@ ad_block() (
|
|||||||
|
|
||||||
adlist_update() (
|
adlist_update() (
|
||||||
ad_source=$(uci -q get mosdns.config.ad_source)
|
ad_source=$(uci -q get mosdns.config.ad_source)
|
||||||
[ $ad_source = "geosite.dat" ] && exit 0
|
[ "$ad_source" = "geosite.dat" ] && exit 0
|
||||||
AD_TMPDIR=$(mktemp -d) || exit 1
|
AD_TMPDIR=$(mktemp -d) || exit 1
|
||||||
if [[ $ad_source =~ "^https://raw.githubusercontent.com" ]]; then
|
if [[ "$ad_source" =~ "^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=$(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/"
|
[ "$google_status" -ne "204" ] && mirror="https://ghproxy.com/"
|
||||||
fi
|
fi
|
||||||
echo -e "\e[1;32mDownloading $mirror$ad_source\e[0m"
|
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"
|
curl --connect-timeout 60 -m 90 --ipv4 -fSLo "$AD_TMPDIR/adlist.txt" "$mirror$ad_source"
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
rm -rf $AD_TMPDIR
|
rm -rf "$AD_TMPDIR"
|
||||||
exit 1
|
exit 1
|
||||||
else
|
else
|
||||||
\cp $AD_TMPDIR/adlist.txt /etc/mosdns/rule/adlist.txt
|
\cp "$AD_TMPDIR/adlist.txt" /etc/mosdns/rule/adlist.txt
|
||||||
rm -rf $AD_TMPDIR
|
rm -rf "$AD_TMPDIR"
|
||||||
fi
|
fi
|
||||||
)
|
)
|
||||||
|
|
||||||
geodat_update() (
|
geodat_update() (
|
||||||
geodat_download() (
|
geodat_download() (
|
||||||
google_status=$(curl -I -4 -m 3 -o /dev/null -s -w %{http_code} http://www.google.com/generate_204)
|
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/"
|
[ "$google_status" -ne "204" ] && mirror="https://ghproxy.com/"
|
||||||
echo -e "\e[1;32mDownloading "$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1\e[0m"
|
echo -e "\e[1;32mDownloading "$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1\e[0m"
|
||||||
curl --connect-timeout 60 -m 900 --ipv4 -fSLo "$TMPDIR/$1" ""$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1"
|
curl --connect-timeout 60 -m 900 --ipv4 -fSLo "$TMPDIR/$1" ""$mirror"https://github.com/Loyalsoldier/v2ray-rules-dat/releases/latest/download/$1"
|
||||||
)
|
)
|
||||||
|
Loading…
Reference in New Issue
Block a user