UPDATE MOMENT , ACTUALLY UPDATES
This commit is contained in:
29
CLI/Init.py
29
CLI/Init.py
@@ -1,7 +1,7 @@
|
||||
#it Wasnt the venv .... 😁🔫 --> 🏠🔥 --> 👶🏻👷🏻💀
|
||||
|
||||
APP_VERSION = 1.01
|
||||
|
||||
APP_VERSION = 1.21
|
||||
import zipfile
|
||||
import configparser
|
||||
import os
|
||||
from pathlib import Path
|
||||
@@ -11,6 +11,10 @@ import sys
|
||||
import tkinter as tk
|
||||
from tkinter import filedialog
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
parser = argparse.ArgumentParser(description='TiropitLauncher CLI & Back-End')
|
||||
parser.add_argument('-backend', help="Runs the app in backend mode (no UI)", action="store_true")
|
||||
|
||||
@@ -112,8 +116,6 @@ def select_folder():
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def TiropitLogin():
|
||||
class menuData():
|
||||
def menuInstructions():
|
||||
@@ -170,7 +172,6 @@ def loadConfig():
|
||||
|
||||
|
||||
|
||||
|
||||
# [Update Functions] <------------------------------------------------------------------------------------------------------------ [Begin]
|
||||
|
||||
def CheckForUpdate(log=False):
|
||||
@@ -179,7 +180,7 @@ def CheckForUpdate(log=False):
|
||||
response = requests.get(TiropitCLI.url + "/api/getTiropitVersion")
|
||||
if log:print(f"ResponseCode:{response.status_code}")
|
||||
data = response.json()
|
||||
|
||||
|
||||
|
||||
if log:print(f"ResponseJSON:{data}")
|
||||
version = float(data["Version"])
|
||||
@@ -188,12 +189,26 @@ def CheckForUpdate(log=False):
|
||||
if float(version) > float(currentVersion):
|
||||
|
||||
if log:print(f"Downloading & Installing Update {version}")
|
||||
download_file("https://kevinblog.sytes.net/APIS/TiropitLauncher/TiropitAPI.php", "test.mogus")
|
||||
download_file("https://kevinblog.sytes.net/APIS/TiropitLauncher/Tiri.zip", "update.zip")
|
||||
unzipFile("update.zip", ".")
|
||||
print("Assuming Update Done - Exiting , Restart Tiropit")
|
||||
else:
|
||||
if log:print(f"Already using latest version -> {currentVersion}")
|
||||
|
||||
|
||||
|
||||
|
||||
def unzipFile(filename,path):
|
||||
os.makedirs(path, exist_ok=True)
|
||||
|
||||
with zipfile.ZipFile(filename, "r") as zf:
|
||||
zf.extractall(path)
|
||||
print(f"Extract Done :) to {path}")
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def download_file(url, filename):
|
||||
|
||||
with requests.get(url, stream=True) as r:
|
||||
|
||||
Reference in New Issue
Block a user