| 
					
				 | 
			
			
				@@ -25,18 +25,18 @@ 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')" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	[ -n "${core_latest_ver}" ] || { echo -e "\nFailed to check latest core version, please try again later." >> "$LOG"; rm -f "$LOCK"; exit 1; } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	[ -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 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		echo -e "Local version: NOT FOUND, latest version: ${core_latest_ver}." >> "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		echo -e "Local version: NOT FOUND, latest version: $core_latest_ver." >> "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		update_core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-		if [ "$(cat $UNM_DIR/core_local_ver)" != "${core_latest_ver}" ]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		if [ "$(cat $UNM_DIR/core_local_ver)" != "$core_latest_ver" ]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			clean_log 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			echo -e "Local version: $(cat $UNM_DIR/core_local_ver 2>"/dev/null"), latest version: ${core_latest_ver}." >> "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			echo -e "Local version: $(cat $UNM_DIR/core_local_ver 2>"/dev/null"), latest version: $core_latest_ver." >> "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 			update_core 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-			echo -e "\nLocal version: $(cat $UNM_DIR/core_local_ver 2>"/dev/null"), latest version: ${core_latest_ver}." >> "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+			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 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -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@enhanced/${cert}" -qO "$UNM_DIR/core/${cert}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+		uclient-fetch "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" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -70,11 +70,11 @@ update_core() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 		} 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	done 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	echo -e "${core_latest_ver}" > "$UNM_DIR/core_local_ver" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	[ -n "${non_restart}" ] || /etc/init.d/"$NAME" restart 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	echo -e "$core_latest_ver" > "$UNM_DIR/core_local_ver" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	[ -n "$non_restart" ] || /etc/init.d/"$NAME" restart 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	echo -e "Succeeded in updating core." > "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-	echo -e "Current core version: ${core_latest_ver}.\n" >> "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+	echo -e "Current core version: $core_latest_ver.\n" >> "$LOG" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 	rm -f "$LOCK" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 |