From 45073b534a598824464fa091fa14cb82d1376b3e Mon Sep 17 00:00:00 2001 From: KevinKor01 Date: Thu, 18 Sep 2025 00:59:15 +0300 Subject: [PATCH] new version check system --- CLI/Config.ini | 2 +- CLI/Init.py | 30 ++++++++++++++++++++---------- 2 files changed, 21 insertions(+), 11 deletions(-) diff --git a/CLI/Config.ini b/CLI/Config.ini index 28dea07..9f61f79 100644 --- a/CLI/Config.ini +++ b/CLI/Config.ini @@ -1,5 +1,5 @@ [DEFAULT] -version = 1.02 +version = 1.01 [ACCOUNT] key = NK diff --git a/CLI/Init.py b/CLI/Init.py index 5b31eca..c088ef2 100644 --- a/CLI/Init.py +++ b/CLI/Init.py @@ -1,5 +1,7 @@ #it Wasnt the venv .... πŸ˜πŸ”« --> 🏠πŸ”₯ --> πŸ‘ΆπŸ»πŸ‘·πŸ»πŸ’€ +APP_VERSION = 1.01 + import configparser import os from pathlib import Path @@ -18,7 +20,7 @@ class Config(): AccountKey = "NK" AccountID = "NA" - version = 01.02 + version = APP_VERSION class ServerObj(): def __init__(self, isReachable=False): @@ -93,7 +95,6 @@ def makeConfig(): with open('Config.ini', 'w') as configfile: config.write(configfile) - def select_folder(): root = tk.Tk() root.withdraw() @@ -154,7 +155,13 @@ def TiropitLogin(): def loadConfig(): try: config.read(configPath) + Config.version = config["DEFAULT"]["Version"] + if float(Config.version) != float(APP_VERSION): + + WarnMissingConfig("Outdated Config") + + Config.AccountID = config["ACCOUNT"]["ID"] Config.AccountID = config["ACCOUNT"]["KEY"] except Exception as e: @@ -167,20 +174,23 @@ def loadConfig(): # [Update Functions] <------------------------------------------------------------------------------------------------------------ [Begin] def CheckForUpdate(log=False): - print("Connecting....") - print(f"Request Version from API@{TiropitCLI.url}") + if log: print("Connecting....") + if log:print(f"Request Version from API@{TiropitCLI.url}") response = requests.get(TiropitCLI.url + "/api/getTiropitVersion") - print(f"ResponseCode:{response.status_code}") + if log:print(f"ResponseCode:{response.status_code}") data = response.json() - print(f"ResponseJSON:{data}") + if log:print(f"ResponseJSON:{data}") version = float(data["Version"]) currentVersion = float(Config.version) - print(f"Recieved Version {version} - Current Version {currentVersion}") - if version > currentVersion: - print(f"Downloading & Installing Update {version}") - download_file("https://kevinblog.sytes.net/APIS/TiropitLauncher/TiropitAPI.php", "test.mogus") + if log:print(f"Recieved Version {version} - Current Version {currentVersion}") + 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") + else: + if log:print(f"Already using latest version -> {currentVersion}")