@@ -11,10 +11,10 @@ def ip_list_loader(ip_file_path):
1111 return user_data .get ("IPPath" ) if "IPPath" in user_data else get_ip_path (ip_file_path )
1212
1313
14- def destination_path_loader (dest_file_path ):
15- with open (dest_file_path , "r+" ) as file :
14+ def destination_path_loader (destination_file_path ):
15+ with open (destination_file_path , "r+" ) as file :
1616 user_data = json .load (file )
17- path_to_save = user_data .get ("SaveLocation" ) if "SaveLocation" in user_data else get_save_location (dest_file_path )
17+ path_to_save = user_data .get ("SaveLocation" ) if "SaveLocation" in user_data else get_save_location (destination_file_path )
1818 return path_to_save
1919
2020
@@ -42,20 +42,22 @@ def get_save_location(save_file_path):
4242 return path_to_save
4343
4444
45- def split_the_i_ps (listofip ):
45+ def split_the_i_ps (list_of_ip ):
4646 output = []
47- for ip in listofip :
47+ for ip in list_of_ip :
4848 if ":" in ip :
4949 output .append (ip .split (":" )[0 ])
5050 return output
5151
5252
5353processDone = False
54- wehavedata = (os .path .isfile (os .path .join (os .getcwd (), 'Credentials.json' )) and
55- os .path .isfile (os .path .join (os .getcwd (), 'Paths.json' )))
5654while not processDone :
55+ we_have_data = (os .path .isfile (os .path .join (os .getcwd (), 'Credentials.json' )) and
56+ os .path .isfile (os .path .join (os .getcwd (), 'Paths.json' )))
57+
5758 choice = input (f"What do you want to do? \n 1_ Update V2ray Config\n 2_ Change Cloudflare DNS Record IP\n " +
58- f"{ ' 3_ Manage Settings' if wehavedata else '' } \n "
59+ f"{ ' 3_ Manage Settings' if we_have_data else '' } \n "
60+ f"{ ' 4_ Show your Info' if we_have_data else '' } \n "
5961 +
6062 " Enter Here: " ).strip ()
6163
@@ -84,6 +86,38 @@ def split_the_i_ps(listofip):
8486
8587 elif choice == "3" :
8688 settings = AppSettings ()
87-
89+ setting_choice = input ("what changes do you want to make?\n "
90+ " 1_ Change IPFile Location\n "
91+ " 2_ Change Save Destination Location\n "
92+ " 3_ Change Credentials(API Key, Email Address,Zone ID)\n "
93+ " Enter Here: " )
94+
95+ if setting_choice == "1" or setting_choice == "2" :
96+ new_location = input ("Please Enter New Location as Directory path\n "
97+ "Enter Here: " )
98+ if setting_choice == "1" :
99+ settings .change_ips_location (new_location )
100+
101+ elif setting_choice == "2" :
102+ settings .change_save_location (new_location )
103+
104+ elif setting_choice == "3" :
105+ credential_choice = input ("What Do you want to change?\n "
106+ " 1_ API Key\n "
107+ " 2_ Email Address\n "
108+ " 3_ Zone ID\n "
109+ " Enter Here: " )
110+ new_value = input ("Enter the new value: " )
111+ settings .change_credentials (int (credential_choice ), new_value )
112+ print ("Value Changed Successfully" )
113+ elif choice == "4" :
114+ settings = AppSettings ()
115+ user_info = settings .show_user_info ()
116+ print ("Your Info looks like this:\n "
117+ f"IP File Path: { user_info .IPPath } \n "
118+ f"Save Destination: { user_info .Save_Destination } \n "
119+ f"API Key: { user_info .apikey } \n "
120+ f"Zone ID: { user_info .ZoneID } \n "
121+ f"Email Address: { user_info .EmailAddress } \n " )
88122 else :
89123 print ("Please Enter Valid Input" )
0 commit comments