Răsfoiți Sursa

feat: prefer wget-ssl as the downloader

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 2 ani în urmă
părinte
comite
cf1d77663b

+ 2 - 2
root/etc/init.d/unblockneteasemusic

@@ -192,8 +192,8 @@ start_service() {
 		fi
 		config_foreach append_filter_client "acl_rule"
 
-		local netease_music_ips="$(uclient-fetch -qO- "http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com" |jsonfilter -e '@.data.*.ip.*')"
-		local netease_music_ips2="$(uclient-fetch -qO- "https://music.httpdns.c.163.com/d" --post-data="music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com" |jsonfilter -e '@.dns.*["ips"].*')"
+		local netease_music_ips="$(wget -qO- "http://httpdns.n.netease.com/httpdns/v2/d?domain=music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com" |jsonfilter -e '@.data.*.ip.*')"
+		local netease_music_ips2="$(wget -qO- "https://music.httpdns.c.163.com/d" --post-data="music.163.com,interface.music.163.com,interface3.music.163.com,apm.music.163.com,apm3.music.163.com,clientlog.music.163.com,clientlog3.music.163.com" |jsonfilter -e '@.dns.*["ips"].*')"
 		if [ -n "$FW4" ]; then
 			json_add_string acl_http_addr "$(echo -e "${acl_http_addr}" | sort -u)"
 			json_add_string acl_https_addr "$(echo -e "${acl_https_addr}" | sort -u)"

+ 2 - 1
root/usr/share/unblockneteasemusic/debugging.sh

@@ -17,7 +17,8 @@ echo -e "\n"
 echo -e "uclient-fetch info:"
 opkg info uclient-fetch
 opkg info libustream-*
-uclient-fetch -O- 'https://api.github.com/repos/UnblockNeteaseMusic/server/commits?sha=enhanced&path=precompiled' | jsonfilter -e '@[0].sha' || echo -e "Failed to connect to GitHub with uclient-fetch."
+opkg info wget-ssl
+wget -O- 'https://api.github.com/repos/UnblockNeteaseMusic/server/commits?sha=enhanced&path=precompiled' | jsonfilter -e '@[0].sha' || echo -e "Failed to connect to GitHub with uclient-fetch."
 echo -e "\n"
 
 echo -e "Node.js info:"

+ 4 - 4
root/usr/share/unblockneteasemusic/update.sh

@@ -24,7 +24,7 @@ clean_log(){
 }
 
 check_core_latest_version() {
-	core_latest_ver="$(uclient-fetch -qO- 'https://api.github.com/repos/UnblockNeteaseMusic/server/commits?sha=enhanced&path=precompiled' | jsonfilter -e '@[0].sha')"
+	core_latest_ver="$(wget -qO- 'https://api.github.com/repos/UnblockNeteaseMusic/server/commits?sha=enhanced&path=precompiled' | jsonfilter -e '@[0].sha')"
 	[ -n "$core_latest_ver" ] || { echo -e "\nFailed to check latest core version, please try again later." >> "$LOG"; rm -f "$LOCK"; exit 1; }
 	if [ ! -e "$$UNM_DIR/core_local_ver" ]; then
 		clean_log
@@ -50,9 +50,9 @@ update_core() {
 	mkdir -p "$UNM_DIR/core"
 	rm -rf "$UNM_DIR/core"/*
 
-	for file in $(uclient-fetch -qO- "https://api.github.com/repos/UnblockNeteaseMusic/server/contents/precompiled" | jsonfilter -e '@[*].path')
+	for file in $(wget -qO- "https://api.github.com/repos/UnblockNeteaseMusic/server/contents/precompiled" | jsonfilter -e '@[*].path')
 	do
-		uclient-fetch "https://fastly.jsdelivr.net/gh/UnblockNeteaseMusic/server@$core_latest_ver/$file" -qO "$UNM_DIR/core/${file##*/}"
+		wget "https://fastly.jsdelivr.net/gh/UnblockNeteaseMusic/server@$core_latest_ver/$file" -qO "$UNM_DIR/core/${file##*/}"
 		[ -s "$UNM_DIR/core/${file##*/}" ] || {
 			echo -e "Failed to download ${file##*/}." >> "$LOG"
 			rm -f "$LOCK"
@@ -62,7 +62,7 @@ update_core() {
 
 	for cert in "ca.crt" "server.crt" "server.key"
 	do
-		uclient-fetch "https://fastly.jsdelivr.net/gh/UnblockNeteaseMusic/server@$core_latest_ver/$cert" -qO "$UNM_DIR/core/$cert"
+		wget "https://fastly.jsdelivr.net/gh/UnblockNeteaseMusic/server@$core_latest_ver/$cert" -qO "$UNM_DIR/core/$cert"
 		[ -s "$UNM_DIR/core/${cert}" ] || {
 			echo -e "Failed to download ${cert}." >> "$LOG"
 			rm -f "$LOCK"