Browse Source

feat(debugging): add port check

Signed-off-by: Tianling Shen <[email protected]>
Tianling Shen 3 years ago
parent
commit
4216f9da0f
1 changed files with 8 additions and 2 deletions
  1. 8 2
      root/usr/share/unblockneteasemusic/debugging.sh

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

@@ -48,6 +48,14 @@ config_get custom_proxy "config" "proxy_server_ip"
 [ -n "$custom_proxy" ] && { curl -sL -x "$custom_proxy" "http://music.163.com/song/media/outer/url?id=641644.mp3" 2>&1 | grep "Location" || echo -e "Cannot connect to NeteaseMusic via proxy."; }
 echo -e "\n"
 
+echo -e "Port status:"
+config_get unm_port "config" "http_port" "5200"
+config_get unm_ports "config" "https_port" "5201"
+[ "x$(config_get "config" "hijack_ways")" = "xuse_hosts" ] && { unm_port="80"; unm_ports="443"; }
+netstat -tlpen | grep "$unm_port" || echo -e "No instance found on port $unm_port."
+netstat -tlpen | grep "$unm_ports" || echo -e "No instance found on port $unm_ports."
+echo -e "\n"
+
 echo -e "Running info:"
 procd_running_status="$(/etc/init.d/unblockneteasemusic status)"
 echo -e "PROCD running status: $procd_running_status"
@@ -69,8 +77,6 @@ echo -e "\n"
 
 	echo -e "Testing source replacing..."
 	lan_ip="$(uci -q get "network.lan.ipaddr" || echo "127.0.0.1")"
-	config_get unm_port "config" "http_port" "5200"
-	[ "x$(config_get "config" "hijack_ways")" = "xuse_hosts" ] && unm_port="80"
 
 	echo -n "" > "/tmp/unblockneteasemusic.log"
 	curl -sSL -X "POST" "https://music.163.com/weapi/song/enhance/player/url/v1?csrf_token=" --data "params=bf3kf%2BOyalbxNS%2FeHAXquH8D2nt2YrhBzww4zy5rj2H%2BeAhdOIaGh4HHHzcoREFcu9Ve35LUgc%2BGE1YJD1HxrJ87ucm5zK%2FFn1lLvHFv1A8ZAuyU1afjG28s2Xja6zpfg00T0EcCeqkK61OpTfAaqw%3D%3D&encSecKey=6bab0dfa7ee3b292f9263a7af466636731cdbbd1d8747c9178c17477e70be899b7788c4a4e315c9fdb8c6e787603db6f9dff62c356f164d35b16b7f2d9ad5ede3cc7336130605521a8f916d308ce86b15c32b81c883ae2ba9c244444d91e1683be93fa0ea3e2a85207c9d693b86b5bb31adb002dd56c0bbcce9c73ec3bf5c105"