| 
					
				 | 
			
			
				@@ -82,14 +82,13 @@ gen_random_string() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 config_after_install() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    local existing_username=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'username: .+' | awk '{print $2}') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    local existing_password=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'password: .+' | awk '{print $2}') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    local existing_hasDefaultCredential=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'hasDefaultCredential: .+' | awk '{print $2}') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     local existing_webBasePath=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'webBasePath: .+' | awk '{print $2}') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     local existing_port=$(/usr/local/x-ui/x-ui setting -show true | grep -Eo 'port: .+' | awk '{print $2}') 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     local server_ip=$(curl -s https://api.ipify.org) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     if [[ ${#existing_webBasePath} -lt 4 ]]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if [[ "$existing_hasDefaultCredential" == "true" ]]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             local config_webBasePath=$(gen_random_string 15) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             local config_username=$(gen_random_string 10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             local config_password=$(gen_random_string 10) 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -112,7 +111,6 @@ config_after_install() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "${green}WebBasePath: ${config_webBasePath}${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "${green}Access URL: http://${server_ip}:${config_port}/${config_webBasePath}${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "###############################################" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             local config_webBasePath=$(gen_random_string 15) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "${yellow}WebBasePath is missing or too short. Generating a new one...${plain}" 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -121,7 +119,7 @@ config_after_install() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "${green}Access URL: http://${server_ip}:${existing_port}/${config_webBasePath}${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         fi 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-        if [[ "$existing_username" == "admin" && "$existing_password" == "admin" ]]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if [[ "$existing_hasDefaultCredential" == "true" ]]; then 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             local config_username=$(gen_random_string 10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             local config_password=$(gen_random_string 10) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -132,7 +130,6 @@ config_after_install() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "${green}Username: ${config_username}${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "${green}Password: ${config_password}${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "###############################################" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            echo -e "${yellow}If you forgot your login info, you can type 'x-ui settings' to check${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         else 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             echo -e "${green}Username, Password, and WebBasePath are properly set. Exiting...${plain}" 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         fi 
			 |