mirror of
				https://github.com/kenzok8/openwrt-packages.git
				synced 2025-10-30 07:50:37 +08:00 
			
		
		
		
	update 2025-09-27 20:32:07
This commit is contained in:
		| @ -10,8 +10,8 @@ LUCI_DEPENDS:=+dnsmasq-full +ipset +node \ | ||||
| LUCI_PKGARCH:=all | ||||
|  | ||||
| PKG_NAME:=luci-app-unblockneteasemusic | ||||
| PKG_VERSION:=2.14 | ||||
| PKG_RELEASE:=3 | ||||
| PKG_VERSION:=2.15 | ||||
| PKG_RELEASE:=1 | ||||
|  | ||||
| PKG_MAINTAINER:=Tianling Shen <cnsztl@immortalwrt.org> | ||||
|  | ||||
|  | ||||
| @ -16,6 +16,7 @@ o = s:option(Value, "music_source", translate("音源接口")) | ||||
| o:value("default", translate("默认")) | ||||
| o:value("bilibili", translate("Bilibili音乐")) | ||||
| o:value("bilivideo", translate("Bilibili音乐(bilivideo)")) | ||||
| o:value("bodian", translate("波点音乐")) | ||||
| o:value("joox", translate("JOOX音乐")) | ||||
| o:value("kugou", translate("酷狗音乐")) | ||||
| o:value("kuwo", translate("酷我音乐")) | ||||
|  | ||||
| @ -166,9 +166,8 @@ start_service() { | ||||
| 		ipset create "neteasemusic" hash:ip timeout 7200 | ||||
| 		config_foreach append_filter_client "acl_rule" | ||||
|  | ||||
| 		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"].*')" | ||||
| 		echo -e "${netease_music_ips}\n${netease_music_ips2}" | sort -u | awk '{print "ipset add neteasemusic "$1}' | sh | ||||
| 		local netease_music_ips="$(wget -T10 -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.*')" | ||||
| 		echo -e "${netease_music_ips}" | sort -u | awk '{print "ipset add neteasemusic "$1}' | sh | ||||
|  | ||||
| 		$IPT_N -N "netease_cloud_music" | ||||
| 		for local_addr in "0.0.0.0/8" "10.0.0.0/8" "127.0.0.0/8" "169.254.0.0/16" "172.16.0.0/12" "192.168.0.0/16" "224.0.0.0/4" "240.0.0.0/4"; do | ||||
|  | ||||
| @ -18,7 +18,7 @@ echo -e "uclient-fetch info:" | ||||
| opkg info uclient-fetch | ||||
| opkg info libustream-* | ||||
| 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." | ||||
| wget -T10 -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:" | ||||
|  | ||||
| @ -10,22 +10,19 @@ mkdir -p "$RUN_DIR" | ||||
| LOCK="$RUN_DIR/update_core.lock" | ||||
| LOG="$RUN_DIR/run.log" | ||||
|  | ||||
| check_core_if_already_running() { | ||||
| 	if [ -e "$LOCK" ]; then | ||||
| 		echo -e "\nA task is already running." >> "$LOG" | ||||
| 		exit 2 | ||||
| 	else | ||||
| 		touch "$LOCK" | ||||
| 	fi | ||||
| } | ||||
|  | ||||
| clean_log(){ | ||||
| 	echo "" > "$LOG" | ||||
| } | ||||
|  | ||||
| check_core_latest_version() { | ||||
| 	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; } | ||||
| 	exec 200>"$LOCK" | ||||
| 	if ! flock -n 200 &> /dev/null; then | ||||
| 		echo -e "\nA task is already running." >> "$LOG" | ||||
| 		exit 2 | ||||
| 	fi | ||||
|  | ||||
| 	core_latest_ver="$(wget -T10 -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"; exit 1; } | ||||
| 	if [ ! -e "$UNM_DIR/core_local_ver" ]; then | ||||
| 		clean_log | ||||
| 		echo -e "Local version: NOT FOUND, latest version: $core_latest_ver." >> "$LOG" | ||||
| @ -38,7 +35,6 @@ check_core_latest_version() { | ||||
| 		else | ||||
| 			echo -e "\nLocal version: $(cat $UNM_DIR/core_local_ver 2>"/dev/null"), latest version: $core_latest_ver." >> "$LOG" | ||||
| 			echo -e "You're already using the latest version." >> "$LOG" | ||||
| 			rm -f "$LOCK" | ||||
| 			exit 3 | ||||
| 		fi | ||||
| 	fi | ||||
| @ -50,22 +46,20 @@ update_core() { | ||||
| 	mkdir -p "$UNM_DIR/core" | ||||
| 	rm -rf "$UNM_DIR/core"/* | ||||
|  | ||||
| 	for file in $(wget -qO- "https://api.github.com/repos/UnblockNeteaseMusic/server/contents/precompiled" | jsonfilter -e '@[*].path') | ||||
| 	for file in $(wget -T10 -qO- "https://api.github.com/repos/UnblockNeteaseMusic/server/contents/precompiled" | jsonfilter -e '@[*].path') | ||||
| 	do | ||||
| 		wget "https://fastly.jsdelivr.net/gh/UnblockNeteaseMusic/server@$core_latest_ver/$file" -qO "$UNM_DIR/core/${file##*/}" | ||||
| 		wget -T10 "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" | ||||
| 			exit 1 | ||||
| 		} | ||||
| 	done | ||||
|  | ||||
| 	for cert in "ca.crt" "server.crt" "server.key" | ||||
| 	do | ||||
| 		wget "https://fastly.jsdelivr.net/gh/UnblockNeteaseMusic/server@$core_latest_ver/$cert" -qO "$UNM_DIR/core/$cert" | ||||
| 		wget -T10 "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" | ||||
| 			exit 1 | ||||
| 		} | ||||
| 	done | ||||
| @ -76,17 +70,14 @@ update_core() { | ||||
|  | ||||
| 	echo -e "Succeeded in updating core." > "$LOG" | ||||
| 	echo -e "Current core version: $core_latest_ver.\n" >> "$LOG" | ||||
| 	rm -f "$LOCK" | ||||
| } | ||||
|  | ||||
| case "$1" in | ||||
| 	"update_core") | ||||
| 		check_core_if_already_running | ||||
| 		check_core_latest_version | ||||
| 		;; | ||||
| 	"update_core_non_restart") | ||||
| 		non_restart=1 | ||||
| 		check_core_if_already_running | ||||
| 		check_core_latest_version | ||||
| 		;; | ||||
| 	"update_core_from_luci") | ||||
|  | ||||
		Reference in New Issue
	
	Block a user
	 actions-user
					actions-user