Update main.py

This commit is contained in:
Vyvir
2024-08-23 19:03:49 +03:00
committed by GitHub
parent bd9af933a7
commit 08c2058f61
+83 -83
View File
@@ -40,11 +40,11 @@ computer_cpu_platform = platform.machine()
def resource_path(relative_path): def resource_path(relative_path):
global installedcheck global installedcheck
CheckRun10 = subprocess.run( CheckRun10 = subprocess.run(
f"find /usr/lib/altlinux/altlinux > /dev/null 2>&1", shell=True f"find /usr/lib/althea/althea > /dev/null 2>&1", shell=True
) )
if CheckRun10.returncode == 0: if CheckRun10.returncode == 0:
installedcheck = True installedcheck = True
base_path = "/usr/lib/altlinux" base_path = "/usr/lib/althea"
else: else:
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)
@@ -63,14 +63,14 @@ Warnmsg = "warn"
Failmsg = "fail" Failmsg = "fail"
icon_name = "changes-prevent-symbolic" icon_name = "changes-prevent-symbolic"
command_six = Gtk.CheckMenuItem(label="Launch at Login") command_six = Gtk.CheckMenuItem(label="Launch at Login")
AltServer = "$HOME/.local/share/altlinux/AltServer" AltServer = "$HOME/.local/share/althea/AltServer"
AnisetteServer = "$HOME/.local/share/altlinux/anisette-server" AnisetteServer = "$HOME/.local/share/althea/anisette-server"
AltStore = "$HOME/.local/share/altlinux/AltStore.ipa" AltStore = "$HOME/.local/share/althea/AltStore.ipa"
PATH = AltStore PATH = AltStore
AutoStart = resource_path("resources/AutoStart.sh") AutoStart = resource_path("resources/AutoStart.sh")
altlinuxpath = os.path.join( altheapath = os.path.join(
os.environ.get("XDG_DATA_HOME") or f'{ os.environ["HOME"] }/.local/share', os.environ.get("XDG_DATA_HOME") or f'{ os.environ["HOME"] }/.local/share',
"altlinux", "althea",
) )
@@ -87,16 +87,16 @@ with open(resource_path("resources/version"), "r", encoding="utf-8") as f:
LocalVersion = f.readline().strip() LocalVersion = f.readline().strip()
def main(): def main():
GLib.set_prgname("AltLinux") # Sets the global program name GLib.set_prgname("althea") # Sets the global program name
global altlinuxpath global altheapath
#global file_name #global file_name
if not os.path.exists(altlinuxpath): # Creates $HOME/.local/share/altlinux if not os.path.exists(altheapath): # Creates $HOME/.local/share/althea
os.mkdir(altlinuxpath) os.mkdir(altheapath)
if Gtk.StatusIcon.is_embedded: if Gtk.StatusIcon.is_embedded:
if connectioncheck(): if connectioncheck():
global indicator global indicator
indicator = appindicator.Indicator.new( indicator = appindicator.Indicator.new(
"altlinux-tray-icon", "althea-tray-icon",
resource_path("resources/1.png"), resource_path("resources/1.png"),
appindicator.IndicatorCategory.APPLICATION_STATUS, appindicator.IndicatorCategory.APPLICATION_STATUS,
) )
@@ -122,7 +122,7 @@ def menu():
menu.append(Gtk.SeparatorMenuItem()) menu.append(Gtk.SeparatorMenuItem())
command_one = Gtk.MenuItem(label="About AltLinux") command_one = Gtk.MenuItem(label="About althea")
command_one.connect("activate", on_abtdlg) command_one.connect("activate", on_abtdlg)
menu.append(command_one) menu.append(command_one)
@@ -146,18 +146,18 @@ def menu():
menu.append(Gtk.SeparatorMenuItem()) menu.append(Gtk.SeparatorMenuItem())
CheckRun11 = subprocess.run(f"test -e /usr/lib/altlinux/altlinux", shell=True) CheckRun11 = subprocess.run(f"test -e /usr/lib/althea/althea", shell=True)
if CheckRun11.returncode == 0: if CheckRun11.returncode == 0:
global command_six global command_six
CheckRun12 = subprocess.run( CheckRun12 = subprocess.run(
f"test -e $HOME/.config/autostart/AltLinux.desktop", shell=True f"test -e $HOME/.config/autostart/althea.desktop", shell=True
) )
if CheckRun12.returncode == 0: if CheckRun12.returncode == 0:
command_six.set_active(command_six) command_six.set_active(command_six)
command_six.connect("activate", launchatlogin1) command_six.connect("activate", launchatlogin1)
menu.append(command_six) menu.append(command_six)
exittray = Gtk.MenuItem(label="Quit AltLinux") exittray = Gtk.MenuItem(label="Quit althea")
exittray.connect("activate", lambda x: quitit()) exittray.connect("activate", lambda x: quitit())
menu.append(exittray) menu.append(exittray)
@@ -173,7 +173,7 @@ def on_abtdlg(self):
resource_path("resources/3.png"), width, height resource_path("resources/3.png"), width, height
) )
about.set_logo(pixbuf) about.set_logo(pixbuf)
about.set_program_name("AltLinux") about.set_program_name("althea")
about.set_version("0.5.0") about.set_version("0.5.0")
about.set_authors( about.set_authors(
[ [
@@ -186,7 +186,7 @@ def on_abtdlg(self):
) # , 'Provision made by', 'Dadoum']) ) # , 'Provision made by', 'Dadoum'])
about.set_artists(["nebula"]) about.set_artists(["nebula"])
about.set_comments("A GUI for AltServer-Linux written in Python.") about.set_comments("A GUI for AltServer-Linux written in Python.")
about.set_website("https://github.com/vyvir/AltLinux") about.set_website("https://github.com/vyvir/althea")
about.set_website_label("Github") about.set_website_label("Github")
about.set_copyright("GUI by vyvir") about.set_copyright("GUI by vyvir")
about.set_position(Gtk.WindowPosition.CENTER_ALWAYS) about.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
@@ -253,10 +253,10 @@ class SplashScreen(Handy.Window):
image.show() image.show()
self.mainBox.pack_start(image, False, True, 0) self.mainBox.pack_start(image, False, True, 0)
self.lbl1 = Gtk.Label(label="Starting AltLinux...") self.lbl1 = Gtk.Label(label="Starting althea...")
self.mainBox.pack_start(self.lbl1, False, False, 6) self.mainBox.pack_start(self.lbl1, False, False, 6)
self.loadaltlinux = Gtk.ProgressBar() self.loadalthea = Gtk.ProgressBar()
self.mainBox.pack_start(self.loadaltlinux, True, True, 0) self.mainBox.pack_start(self.loadalthea, True, True, 0)
self.t = threading.Thread(target=self.lol321actualfunction) self.t = threading.Thread(target=self.lol321actualfunction)
self.t.start() self.t.start()
self.wait_for_t(self.t) self.wait_for_t(self.t)
@@ -272,62 +272,62 @@ class SplashScreen(Handy.Window):
def lol321actualfunction(self): def lol321actualfunction(self):
self.lbl1.set_text("Checking if anisette-server is already running...") self.lbl1.set_text("Checking if anisette-server is already running...")
self.loadaltlinux.set_fraction(0.1) self.loadalthea.set_fraction(0.1)
command = 'curl 127.0.0.1:6969 | grep -q "{"' command = 'curl 127.0.0.1:6969 | grep -q "{"'
CheckRun = subprocess.run(command, shell=True) CheckRun = subprocess.run(command, shell=True)
if not os.path.isfile(f"{(altlinuxpath)}/anisette-server"): if not os.path.isfile(f"{(altheapath)}/anisette-server"):
self.lbl1.set_text("Downloading anisette-server...") self.lbl1.set_text("Downloading anisette-server...")
if computer_cpu_platform == 'x86_64': if computer_cpu_platform == 'x86_64':
r = requests.get( r = requests.get(
"https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-x86_64", "https://github.com/vyvir/althea/releases/download/v0.5.0/anisette-server-x86_64",
allow_redirects=True, allow_redirects=True,
) )
elif computer_cpu_platform == "aarch64": elif computer_cpu_platform == "aarch64":
#Thanks, Dadoum for the anisette server! #Thanks, Dadoum for the anisette server!
#or vyvir, do not forget to upload ur version of server. #or vyvir, do not forget to upload ur version of server.
r = requests.get( r = requests.get(
"https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-aarch64", "https://github.com/vyvir/althea/releases/download/v0.5.0/anisette-server-aarch64",
allow_redirects=True allow_redirects=True
) )
#sorry i dont know what will arm32 output #sorry i dont know what will arm32 output
elif computer_cpu_platform.find('v7') != -1 or computer_cpu_platform.find('ARM') != -1 or computer_cpu_platform.find('hf') != -1: elif computer_cpu_platform.find('v7') != -1 or computer_cpu_platform.find('ARM') != -1 or computer_cpu_platform.find('hf') != -1:
r = requests.get( r = requests.get(
"https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-armv7", "https://github.com/vyvir/althea/releases/download/v0.5.0/anisette-server-armv7",
allow_redirects=True allow_redirects=True
) )
else: else:
print('WARNING: YOUR CPU IS NOT SUPPORTED, THE PROGRAM MAY NOT WORK!') print('WARNING: YOUR CPU IS NOT SUPPORTED, THE PROGRAM MAY NOT WORK!')
#ooops, just download x86-64 ver #ooops, just download x86-64 ver
r = requests.get( r = requests.get(
"https://github.com/vyvir/AltLinux/releases/download/v0.5.0/anisette-server-x86_64", "https://github.com/vyvir/althea/releases/download/v0.5.0/anisette-server-x86_64",
allow_redirects=True, allow_redirects=True,
) )
open(f"{(altlinuxpath)}/anisette-server", "wb").write(r.content) open(f"{(altheapath)}/anisette-server", "wb").write(r.content)
subprocess.run(f"chmod +x {(altlinuxpath)}/anisette-server", shell=True) subprocess.run(f"chmod +x {(altheapath)}/anisette-server", shell=True)
subprocess.run(f"chmod 755 {(altlinuxpath)}/anisette-server", shell=True) subprocess.run(f"chmod 755 {(altheapath)}/anisette-server", shell=True)
self.loadaltlinux.set_fraction(0.2) self.loadalthea.set_fraction(0.2)
self.lbl1.set_text("Downloading Apple Music APK...") self.lbl1.set_text("Downloading Apple Music APK...")
r = requests.get( r = requests.get(
"https://apps.mzstatic.com/content/android-apple-music-apk/applemusic.apk", "https://apps.mzstatic.com/content/android-apple-music-apk/applemusic.apk",
allow_redirects=True, allow_redirects=True,
) )
open(f"{(altlinuxpath)}/am.apk", "wb").write(r.content) open(f"{(altheapath)}/am.apk", "wb").write(r.content)
os.makedirs(f"{(altlinuxpath)}/lib/x86_64") os.makedirs(f"{(altheapath)}/lib/x86_64")
self.loadaltlinux.set_fraction(0.3) self.loadalthea.set_fraction(0.3)
self.lbl1.set_text("Extracting necessary libraries...") self.lbl1.set_text("Extracting necessary libraries...")
CheckRunB = subprocess.run( CheckRunB = subprocess.run(
f'unzip -j "{(altlinuxpath)}/am.apk" "lib/x86_64/libstoreservicescore.so" -d "{(altlinuxpath)}/lib/x86_64"', f'unzip -j "{(altheapath)}/am.apk" "lib/x86_64/libstoreservicescore.so" -d "{(altheapath)}/lib/x86_64"',
shell=True, shell=True,
) )
CheckRunC = subprocess.run( CheckRunC = subprocess.run(
f'unzip -j "{(altlinuxpath)}/am.apk" "lib/x86_64/libCoreADI.so" -d "{(altlinuxpath)}/lib/x86_64"', f'unzip -j "{(altheapath)}/am.apk" "lib/x86_64/libCoreADI.so" -d "{(altheapath)}/lib/x86_64"',
shell=True, shell=True,
) )
silentremove(f"{(altlinuxpath)}/am.apk") silentremove(f"{(altheapath)}/am.apk")
self.loadaltlinux.set_fraction(0.4) self.loadalthea.set_fraction(0.4)
self.lbl1.set_text("Starting anisette-server...") self.lbl1.set_text("Starting anisette-server...")
subprocess.run(f"cd {(altlinuxpath)} && ./anisette-server &", shell=True)#-n 127.0.0.1 -p 6969 &", shell=True subprocess.run(f"cd {(altheapath)} && ./anisette-server &", shell=True)#-n 127.0.0.1 -p 6969 &", shell=True
self.loadaltlinux.set_fraction(0.5) self.loadalthea.set_fraction(0.5)
finished = False finished = False
while not finished: while not finished:
CheckRun5 = subprocess.run(command, shell=True) CheckRun5 = subprocess.run(command, shell=True)
@@ -335,9 +335,9 @@ class SplashScreen(Handy.Window):
finished = True finished = True
else: else:
sleep(1) sleep(1)
if not os.path.isfile(f"{(altlinuxpath)}/AltServer"): if not os.path.isfile(f"{(altheapath)}/AltServer"):
self.lbl1.set_text("Downloading AltServer...") self.lbl1.set_text("Downloading AltServer...")
self.loadaltlinux.set_fraction(0.6) self.loadalthea.set_fraction(0.6)
""" """
r = requests.get( r = requests.get(
@@ -367,11 +367,11 @@ class SplashScreen(Handy.Window):
"https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-x86_64", "https://github.com/NyaMisty/AltServer-Linux/releases/download/v0.0.5/AltServer-x86_64",
allow_redirects=True, allow_redirects=True,
) )
open(f"{(altlinuxpath)}/AltServer", "wb").write(r.content) open(f"{(altheapath)}/AltServer", "wb").write(r.content)
subprocess.run(f"chmod +x {(altlinuxpath)}/AltServer", shell=True) subprocess.run(f"chmod +x {(altheapath)}/AltServer", shell=True)
subprocess.run(f"chmod 755 {(altlinuxpath)}/AltServer", shell=True) subprocess.run(f"chmod 755 {(altheapath)}/AltServer", shell=True)
self.loadaltlinux.set_fraction(0.8) self.loadalthea.set_fraction(0.8)
if not os.path.isfile(f"{(altlinuxpath)}/AltStore.ipa"): if not os.path.isfile(f"{(altheapath)}/AltStore.ipa"):
self.lbl1.set_text("Downloading AltStore...") self.lbl1.set_text("Downloading AltStore...")
altstoredownload("Download") altstoredownload("Download")
else: else:
@@ -380,8 +380,8 @@ class SplashScreen(Handy.Window):
self.lbl1.set_text("Downloading new version of AltStore...") self.lbl1.set_text("Downloading new version of AltStore...")
altstoredownload("Download") altstoredownload("Download")
self.lbl1.set_text("Starting AltServer...") self.lbl1.set_text("Starting AltServer...")
self.loadaltlinux.set_fraction(1.0) self.loadalthea.set_fraction(1.0)
subprocess.run(f"{(altlinuxpath)}/AltServer &", shell=True) subprocess.run(f"{(altheapath)}/AltServer &", shell=True)
return 0 return 0
@@ -419,7 +419,7 @@ class login(Gtk.Window):#
grid.attach(self.entry, 1, 2, 1, 1) grid.attach(self.entry, 1, 2, 1, 1)
grid.attach_next_to(self.button, self.entry, Gtk.PositionType.RIGHT, 1, 1) grid.attach_next_to(self.button, self.entry, Gtk.PositionType.RIGHT, 1, 1)
silentremove(f"{(altlinuxpath)}/log.txt") silentremove(f"{(altheapath)}/log.txt")
def on_click_me_clicked1(self): def on_click_me_clicked1(self):
self.realthread1 = threading.Thread(target=self.onclickmethread) self.realthread1 = threading.Thread(target=self.onclickmethread)
@@ -427,8 +427,8 @@ class login(Gtk.Window):#
GLib.idle_add(self.ermlol) GLib.idle_add(self.ermlol)
def on_click_me_clicked(self, button): def on_click_me_clicked(self, button):
silentremove(f"{(altlinuxpath)}/log.txt") silentremove(f"{(altheapath)}/log.txt")
if not os.path.isfile(f"{(altlinuxpath)}/saved.txt"): if not os.path.isfile(f"{(altheapath)}/saved.txt"):
self.set_position(Gtk.WindowPosition.CENTER_ALWAYS) self.set_position(Gtk.WindowPosition.CENTER_ALWAYS)
dialog = Gtk.MessageDialog( dialog = Gtk.MessageDialog(
transient_for=self, transient_for=self,
@@ -442,7 +442,7 @@ class login(Gtk.Window):#
if response == Gtk.ResponseType.YES: if response == Gtk.ResponseType.YES:
AppleID = self.entry1.get_text().lower() AppleID = self.entry1.get_text().lower()
Password = self.entry.get_text() Password = self.entry.get_text()
f = open(f"{(altlinuxpath)}/saved.txt", "x") f = open(f"{(altheapath)}/saved.txt", "x")
f.write(AppleID) f.write(AppleID)
f.write(":") f.write(":")
f.write(Password) f.write(Password)
@@ -469,12 +469,12 @@ class login(Gtk.Window):#
UDID = subprocess.check_output("idevice_id -l", shell=True).decode().strip() UDID = subprocess.check_output("idevice_id -l", shell=True).decode().strip()
global InsAltStore global InsAltStore
print(PATH) print(PATH)
silentremove(f"{(altlinuxpath)}/log.txt") silentremove(f"{(altheapath)}/log.txt")
#f = open(f"{(altlinuxpath)}/log.txt", "w") #f = open(f"{(altheapath)}/log.txt", "w")
#f.close() #f.close()
if os.path.isdir(f'{ os.environ["HOME"] }/.adi'): if os.path.isdir(f'{ os.environ["HOME"] }/.adi'):
rmtree(f'{ os.environ["HOME"] }/.adi') rmtree(f'{ os.environ["HOME"] }/.adi')
InsAltStoreCMD = f"""export ALTSERVER_ANISETTE_SERVER='http://127.0.0.1:6969' ; {(AltServer)} -u {UDID} -a {AppleID} -p {Password} {PATH} > {("$HOME/.local/share/altlinux/log.txt")}""" InsAltStoreCMD = f"""export ALTSERVER_ANISETTE_SERVER='http://127.0.0.1:6969' ; {(AltServer)} -u {UDID} -a {AppleID} -p {Password} {PATH} > {("$HOME/.local/share/althea/log.txt")}"""
InsAltStore = subprocess.Popen( InsAltStore = subprocess.Popen(
InsAltStoreCMD, InsAltStoreCMD,
stdin=subprocess.PIPE, stdin=subprocess.PIPE,
@@ -496,25 +496,25 @@ class login(Gtk.Window):#
global InsAltStore global InsAltStore
while Installing: while Installing:
CheckIns = subprocess.run( CheckIns = subprocess.run(
f'grep -F "Could not" {(altlinuxpath)}/log.txt', shell=True f'grep -F "Could not" {(altheapath)}/log.txt', shell=True
) )
CheckWarn = subprocess.run( CheckWarn = subprocess.run(
f'grep -F "Are you sure you want to continue?" {(altlinuxpath)}/log.txt', f'grep -F "Are you sure you want to continue?" {(altheapath)}/log.txt',
shell=True, shell=True,
) )
CheckSuccess = subprocess.run( CheckSuccess = subprocess.run(
f'grep -F "Notify: Installation Succeeded" {(altlinuxpath)}/log.txt', f'grep -F "Notify: Installation Succeeded" {(altheapath)}/log.txt',
shell=True, shell=True,
) )
Check2fa = subprocess.run( Check2fa = subprocess.run(
f'grep -F "Enter two factor code" {(altlinuxpath)}/log.txt', shell=True f'grep -F "Enter two factor code" {(altheapath)}/log.txt', shell=True
) )
if CheckIns.returncode == 0: if CheckIns.returncode == 0:
InsAltStore.terminate() InsAltStore.terminate()
Installing = False Installing = False
global Failmsg global Failmsg
Failmsg = subprocess.check_output( Failmsg = subprocess.check_output(
f"tail -6 {(altlinuxpath)}/log.txt", shell=True f"tail -6 {(altheapath)}/log.txt", shell=True
).decode() ).decode()
dialog2 = DialogExample3(self) dialog2 = DialogExample3(self)
dialog2.run() dialog2.run()
@@ -524,14 +524,14 @@ class login(Gtk.Window):#
Installing = False Installing = False
word = "Are you sure you want to continue?" word = "Are you sure you want to continue?"
# This fixes an issue where the warn window appears when it shouldn't # This fixes an issue where the warn window appears when it shouldn't
with open(f"{(altlinuxpath)}/log.txt", "r") as file: with open(f"{(altheapath)}/log.txt", "r") as file:
# Read all content of the file # Read all content of the file
content = file.read() content = file.read()
# Check if a string present in the file # Check if a string present in the file
if word in content: if word in content:
global Warnmsg global Warnmsg
Warnmsg = subprocess.check_output( Warnmsg = subprocess.check_output(
f"tail -8 {('$HOME/.local/share/altlinux/log.txt')}", f"tail -8 {('$HOME/.local/share/althea/log.txt')}",
shell=True, shell=True,
).decode() ).decode()
dialog1 = DialogExample2(self) dialog1 = DialogExample2(self)
@@ -682,7 +682,7 @@ class PairWindow(Handy.Window):
global lolcheck global lolcheck
global PATH global PATH
if lolcheck == "altstr": if lolcheck == "altstr":
PATH = f"{(altlinuxpath)}/AltStore.ipa" PATH = f"{(altheapath)}/AltStore.ipa"
win1() win1()
elif lolcheck == "ipa": elif lolcheck == "ipa":
win2 = FileChooserWindow() win2 = FileChooserWindow()
@@ -914,7 +914,7 @@ class OopsInternet(Handy.Window):
vb.pack_start(image, True, True, 0) vb.pack_start(image, True, True, 0)
lbl1 = Gtk.Label( lbl1 = Gtk.Label(
label="AltLinux is unable to connect to the Internet.\nPlease connect to the Internet and restart AltLinux." label="althea is unable to connect to the Internet.\nPlease connect to the Internet and restart althea."
) )
lbl1.set_property("margin_left", 15) lbl1.set_property("margin_left", 15)
lbl1.set_property("margin_right", 15) lbl1.set_property("margin_right", 15)
@@ -941,7 +941,7 @@ def notify():
if (connectioncheck()) == True: if (connectioncheck()) == True:
LatestVersion = ( LatestVersion = (
urllib.request.urlopen( urllib.request.urlopen(
"https://raw.githubusercontent.com/vyvir/AltLinux/main/resources/version" "https://raw.githubusercontent.com/vyvir/althea/main/resources/version"
) )
.readline() .readline()
.rstrip() .rstrip()
@@ -966,7 +966,7 @@ def notify():
def showurl(_): def showurl(_):
Gtk.show_uri_on_window( Gtk.show_uri_on_window(
None, "https://github.com/vyvir/AltLinux/releases", Gdk.CURRENT_TIME None, "https://github.com/vyvir/althea/releases", Gdk.CURRENT_TIME
) )
quitit() quitit()
@@ -988,13 +988,13 @@ def restartaltserver(_):
subprocess.run(f"killall {AnisetteServer}", shell=True) subprocess.run(f"killall {AnisetteServer}", shell=True)
subprocess.run("idevicepair pair", shell=True) subprocess.run("idevicepair pair", shell=True)
subprocess.run( subprocess.run(
f"""export ALTSERVER_ANISETTE_SERVER='http://127.0.0.1:6969' ; {(altlinuxpath)}/AltServer &""", f"""export ALTSERVER_ANISETTE_SERVER='http://127.0.0.1:6969' ; {(altheapath)}/AltServer &""",
shell=True, shell=True,
) )
def winerm(): def winerm():
silentremove(f"{(altlinuxpath)}/log.txt") silentremove(f"{(altheapath)}/log.txt")
dialog = Gtk.MessageDialog( dialog = Gtk.MessageDialog(
# transient_for=self, # transient_for=self,
flags=0, flags=0,
@@ -1007,7 +1007,7 @@ def winerm():
if response == Gtk.ResponseType.YES: if response == Gtk.ResponseType.YES:
global AppleID global AppleID
global Password global Password
f = open(f"{(altlinuxpath)}/saved.txt", "r") f = open(f"{(altheapath)}/saved.txt", "r")
for line in f: for line in f:
AppleID, Password = line.split(":") AppleID, Password = line.split(":")
f.close() f.close()
@@ -1016,21 +1016,21 @@ def winerm():
savedcheck = True savedcheck = True
login().on_click_me_clicked1() login().on_click_me_clicked1()
else: else:
silentremove(f"{(altlinuxpath)}/saved.txt") silentremove(f"{(altheapath)}/saved.txt")
win3 = login() win3 = login()
win3.show_all() win3.show_all()
dialog.destroy() dialog.destroy()
def win1(): def win1():
if os.path.isfile(f"{(altlinuxpath)}/saved.txt"): if os.path.isfile(f"{(altheapath)}/saved.txt"):
winerm() winerm()
else: else:
openwindow(login) openwindow(login)
def win2(_): def win2(_):
if os.path.isfile(f"{(altlinuxpath)}/saved.txt"): if os.path.isfile(f"{(altheapath)}/saved.txt"):
winerm() winerm()
else: else:
openwindow(login) openwindow(login)
@@ -1038,7 +1038,7 @@ def win2(_):
def actionCallback(notification, action, user_data=None): def actionCallback(notification, action, user_data=None):
Gtk.show_uri_on_window( Gtk.show_uri_on_window(
None, "https://github.com/vyvir/AltLinux/releases", Gdk.CURRENT_TIME None, "https://github.com/vyvir/althea/releases", Gdk.CURRENT_TIME
) )
quitit() quitit()
@@ -1050,7 +1050,7 @@ def launchatlogin1(_):
os.popen(AutoStart).read() os.popen(AutoStart).read()
return True return True
else: else:
silentremove("$HOME/.config/autostart/AltLinux.desktop") silentremove("$HOME/.config/autostart/althea.desktop")
return False return False
@@ -1073,7 +1073,7 @@ def altstoredownload(value):
if app['name'] == "AltStore": if app['name'] == "AltStore":
if value == "Check": if value == "Check":
size = app['versions'][0]['size'] size = app['versions'][0]['size']
return size == os.path.getsize(f'{(altlinuxpath)}/AltStore.ipa') return size == os.path.getsize(f'{(altheapath)}/AltStore.ipa')
break break
if value == "Download": if value == "Download":
latest = app['versions'][0]['downloadURL'] latest = app['versions'][0]['downloadURL']
@@ -1082,19 +1082,19 @@ def altstoredownload(value):
allow_redirects=True, allow_redirects=True,
) )
latest_filename = latest.split('/')[-1] latest_filename = latest.split('/')[-1]
open(f"{(altlinuxpath)}/{(latest_filename)}", "wb").write(r.content) open(f"{(altheapath)}/{(latest_filename)}", "wb").write(r.content)
os.rename(f"{(altlinuxpath)}/{(latest_filename)}", f"{(altlinuxpath)}/AltStore.ipa") os.rename(f"{(altheapath)}/{(latest_filename)}", f"{(altheapath)}/AltStore.ipa")
subprocess.run(f"chmod 755 {(altlinuxpath)}/AltStore.ipa", shell=True) subprocess.run(f"chmod 755 {(altheapath)}/AltStore.ipa", shell=True)
break break
return True return True
else: else:
return False return False
def checkiosver(): def checkiosver():
silentremove(f"{(altlinuxpath)}/ideviceinfo.txt") silentremove(f"{(altheapath)}/ideviceinfo.txt")
subprocess.run(f"ideviceinfo > {(altlinuxpath)}/ideviceinfo.txt", shell=True) subprocess.run(f"ideviceinfo > {(altheapath)}/ideviceinfo.txt", shell=True)
result = "result" result = "result"
pathsy = f"{(altlinuxpath)}/ideviceinfo.txt" pathsy = f"{(altheapath)}/ideviceinfo.txt"
with open(pathsy) as file: with open(pathsy) as file:
# Iterate through lines # Iterate through lines
for line in file.readlines(): for line in file.readlines():
@@ -1103,7 +1103,7 @@ def checkiosver():
# If the word is inside the line # If the word is inside the line
if index != -1: if index != -1:
result = line[:-1][16:] result = line[:-1][16:]
silentremove(f"{(altlinuxpath)}/ideviceinfo.txt") silentremove(f"{(altheapath)}/ideviceinfo.txt")
print(result) print(result)
return(result) return(result)