new version check system

This commit is contained in:
2025-09-18 00:59:15 +03:00
parent 8e0116cb56
commit 45073b534a
2 changed files with 21 additions and 11 deletions

View File

@@ -1,5 +1,5 @@
[DEFAULT]
version = 1.02
version = 1.01
[ACCOUNT]
key = NK

View File

@@ -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}")
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}")