Skip to content

Commit e4855bf

Browse files
committed
update to ver 0.1.1
Prevent invalid device index interrupt the script Make sure file path is not empty to prevent AltServer running in server mode
1 parent 085b611 commit e4855bf

2 files changed

Lines changed: 21 additions & 7 deletions

File tree

.vscode/settings.json

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"[python]": {
3+
"editor.defaultFormatter": "ms-python.autopep8"
4+
},
5+
"python.formatting.provider": "none"
6+
}

main.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@
3131
ALTSTORE_VERSION = "1_6_3"
3232
NETMUXD_VERSION = "v0.1.4"
3333
ANISETTE_SERVER_VERSION = "2.1.0"
34-
SCRIPT_VERSION = "0.1"
34+
SCRIPT_VERSION = "0.1.1"
3535

3636
# PATH AND URL
3737
ALTSERVER_PATH = os.path.join(RESOURCE_DIRECTORY, "AltServer")
@@ -246,9 +246,13 @@ def __init__(self):
246246
def selectDevice(self, devices: list[iDevice]):
247247
for i in range(len(devices)):
248248
print(f"[{i}] : {devices[i].name} , {devices[i].UDID}")
249-
index = int(
250-
getAnswer("Enter the index of the device for installation : "))
251-
self.selectedDevice = devices[index]
249+
try:
250+
index = int(
251+
getAnswer("Enter the index of the device for installation : "))
252+
self.selectedDevice = devices[index]
253+
except:
254+
print("Invalid index")
255+
self.selectedDevice = None
252256

253257
def getAccount(self):
254258
ac = getAnswer("Enter your Apple ID : ")
@@ -257,12 +261,13 @@ def getAccount(self):
257261
def getPassword(self):
258262
pd = getpass.getpass("Enter password of the Apple ID : ")
259263
self.password = pd
260-
264+
261265
def selectFile(self):
262266
answer = getAnswer(
263267
"Do you want to install AltStore ? (y/n) [n for select your own iPA] : ").lower()
264268
if answer == 'n':
265-
self.filePath = getAnswer("Enter the absolute path of the file : ")
269+
filePath = getAnswer("Enter the absolute path of the file : ")
270+
self.filePath = filePath if filePath != "" else self.selectFile()
266271
else:
267272
self.filePath = ALTSTORE_PATH
268273

@@ -296,6 +301,8 @@ def main():
296301
if len(devices) == 0:
297302
continue
298303
installaion_manager.selectDevice(devices=devices)
304+
if installaion_manager.selectedDevice == None:
305+
continue
299306
installaion_manager.getAccount()
300307
installaion_manager.getPassword()
301308
installaion_manager.selectFile()
@@ -328,7 +335,7 @@ def main():
328335
elif option == 'p':
329336
devices = device_manager.getDevices()
330337
for d in devices:
331-
print(f"{d.name}:{d.UDID}")
338+
print(f"{d.name} , {d.UDID}")
332339

333340
elif option == 'u':
334341
Update()
@@ -371,3 +378,4 @@ def main():
371378
f"RUNNING AT {CURRENT_DIRECTORY} , RESOURCE_DIR : {RESOURCE_DIRECTORY}")
372379
DebugPrint(f"ARCH : {ARCH} , NETMUXD_AVAILABLE : {NETMUXD_IS_AVAILABLE}")
373380
main()
381+

0 commit comments

Comments
 (0)