Skip to content

Commit

Permalink
update to ver 0.1.1
Browse files Browse the repository at this point in the history
Prevent invalid device index interrupt the script

Make sure file path is not empty to prevent AltServer running in server mode
  • Loading branch information
powenn committed Jul 10, 2023
1 parent 085b611 commit e4855bf
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 7 deletions.
6 changes: 6 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"[python]": {
"editor.defaultFormatter": "ms-python.autopep8"
},
"python.formatting.provider": "none"
}
22 changes: 15 additions & 7 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
ALTSTORE_VERSION = "1_6_3"
NETMUXD_VERSION = "v0.1.4"
ANISETTE_SERVER_VERSION = "2.1.0"
SCRIPT_VERSION = "0.1"
SCRIPT_VERSION = "0.1.1"

# PATH AND URL
ALTSERVER_PATH = os.path.join(RESOURCE_DIRECTORY, "AltServer")
Expand Down Expand Up @@ -246,9 +246,13 @@ def __init__(self):
def selectDevice(self, devices: list[iDevice]):
for i in range(len(devices)):
print(f"[{i}] : {devices[i].name} , {devices[i].UDID}")
index = int(
getAnswer("Enter the index of the device for installation : "))
self.selectedDevice = devices[index]
try:
index = int(
getAnswer("Enter the index of the device for installation : "))
self.selectedDevice = devices[index]
except:
print("Invalid index")
self.selectedDevice = None

def getAccount(self):
ac = getAnswer("Enter your Apple ID : ")
Expand All @@ -257,12 +261,13 @@ def getAccount(self):
def getPassword(self):
pd = getpass.getpass("Enter password of the Apple ID : ")
self.password = pd

def selectFile(self):
answer = getAnswer(
"Do you want to install AltStore ? (y/n) [n for select your own iPA] : ").lower()
if answer == 'n':
self.filePath = getAnswer("Enter the absolute path of the file : ")
filePath = getAnswer("Enter the absolute path of the file : ")
self.filePath = filePath if filePath != "" else self.selectFile()
else:
self.filePath = ALTSTORE_PATH

Expand Down Expand Up @@ -296,6 +301,8 @@ def main():
if len(devices) == 0:
continue
installaion_manager.selectDevice(devices=devices)
if installaion_manager.selectedDevice == None:
continue
installaion_manager.getAccount()
installaion_manager.getPassword()
installaion_manager.selectFile()
Expand Down Expand Up @@ -328,7 +335,7 @@ def main():
elif option == 'p':
devices = device_manager.getDevices()
for d in devices:
print(f"{d.name}:{d.UDID}")
print(f"{d.name} , {d.UDID}")

elif option == 'u':
Update()
Expand Down Expand Up @@ -371,3 +378,4 @@ def main():
f"RUNNING AT {CURRENT_DIRECTORY} , RESOURCE_DIR : {RESOURCE_DIRECTORY}")
DebugPrint(f"ARCH : {ARCH} , NETMUXD_AVAILABLE : {NETMUXD_IS_AVAILABLE}")
main()

0 comments on commit e4855bf

Please sign in to comment.