fix saved login + partially bring back PR

This commit is contained in:
vyvir
2024-09-27 16:20:06 +03:00
parent f9efafc3e3
commit cc113e39d4
2 changed files with 31 additions and 39 deletions
+1
View File
@@ -13,3 +13,4 @@ ipaList.txt
log.txt log.txt
old old
traybackup.py traybackup.py
.directory
+30 -39
View File
@@ -49,6 +49,9 @@ def resource_path(relative_path):
base_path = os.path.abspath(".") base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path) return os.path.join(base_path, relative_path)
installedcheck = subprocess.run("test -e /usr/lib/althea/althea", shell=True).returncode == 0
base_path = "/usr/lib/althea" if installedcheck else os.path.abspath(".")
# Global variables # Global variables
ipa_path_exists = False # Checks if the IPA path has been defined by user ipa_path_exists = False # Checks if the IPA path has been defined by user
@@ -88,51 +91,39 @@ def connectioncheck():
def menu(): def menu():
menu = Gtk.Menu() menu = Gtk.Menu()
if (notify()) == True: if notify():
command_upd = Gtk.MenuItem(label="Download Update") command_upd = Gtk.MenuItem(label="Download Update")
command_upd.connect("activate", showurl) command_upd.connect("activate", showurl)
menu.append(command_upd) menu.append(command_upd)
menu.append(Gtk.SeparatorMenuItem()) menu.append(Gtk.SeparatorMenuItem())
command_one = Gtk.MenuItem(label="About althea") commands = [
command_one.connect("activate", on_abtdlg) ("About althea", on_abtdlg),
menu.append(command_one) ("Install AltStore", altstoreinstall),
("Install an IPA file", altserverfile),
("Pair", lambda x: openwindow(PairWindow)),
("Restart AltServer", restartaltserver),
("Quit althea", lambda x: quitit())
]
menu.append(Gtk.SeparatorMenuItem()) for label, callback in commands:
command = Gtk.MenuItem(label=label)
command.connect("activate", callback)
menu.append(command)
if label == "About althea":
menu.append(Gtk.SeparatorMenuItem())
command_two = Gtk.MenuItem(label="Install AltStore") #CheckRun11 = subprocess.run(f"test -e /usr/lib/althea/althea", shell=True)
command_two.connect("activate", altstoreinstall) #if CheckRun11.returncode == 0:
menu.append(command_two) # global command_six
# CheckRun12 = subprocess.run(
command_three = Gtk.MenuItem(label="Install an IPA file") # f"test -e $HOME/.config/autostart/althea.desktop", shell=True
command_three.connect("activate", altserverfile) # )
menu.append(command_three) # if CheckRun12.returncode == 0:
# command_six.set_active(command_six)
command_four = Gtk.MenuItem(label="Pair") # command_six.connect("activate", launchatlogin1)
command_four.connect("activate", lambda x: openwindow(PairWindow)) # menu.append(command_six)
menu.append(command_four)
command_five = Gtk.MenuItem(label="Restart AltServer")
command_five.connect("activate", restartaltserver)
menu.append(command_five)
menu.append(Gtk.SeparatorMenuItem())
CheckRun11 = subprocess.run(f"test -e /usr/lib/althea/althea", shell=True)
if CheckRun11.returncode == 0:
global command_six
CheckRun12 = subprocess.run(
f"test -e $HOME/.config/autostart/althea.desktop", shell=True
)
if CheckRun12.returncode == 0:
command_six.set_active(command_six)
command_six.connect("activate", launchatlogin1)
menu.append(command_six)
exittray = Gtk.MenuItem(label="Quit althea")
exittray.connect("activate", lambda x: quitit())
menu.append(exittray)
menu.show_all() menu.show_all()
return menu return menu
@@ -261,7 +252,7 @@ def winerm():
global password global password
f = open(f"{(altheapath)}/saved.txt", "r") f = open(f"{(altheapath)}/saved.txt", "r")
for line in f: for line in f:
apple_id, password = line.split("ł") # unacceptable char both in e-mail and apple id apple_id, password = line.strip().split(' ')
f.close() f.close()
print(apple_id, password) print(apple_id, password)
global savedcheck global savedcheck
@@ -573,7 +564,7 @@ class Login(Gtk.Window):#
password = self.entry.get_text() password = self.entry.get_text()
f = open(f"{(altheapath)}/saved.txt", "x") f = open(f"{(altheapath)}/saved.txt", "x")
f.write(apple_id) f.write(apple_id)
f.write(":") f.write(" ")
f.write(password) f.write(password)
f.close() f.close()
dialog.destroy() dialog.destroy()