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] [DEFAULT]
version = 1.02 version = 1.01
[ACCOUNT] [ACCOUNT]
key = NK key = NK

View File

@@ -1,5 +1,7 @@
#it Wasnt the venv .... 😁🔫 --> 🏠🔥 --> 👶🏻👷🏻💀 #it Wasnt the venv .... 😁🔫 --> 🏠🔥 --> 👶🏻👷🏻💀
APP_VERSION = 1.01
import configparser import configparser
import os import os
from pathlib import Path from pathlib import Path
@@ -18,7 +20,7 @@ class Config():
AccountKey = "NK" AccountKey = "NK"
AccountID = "NA" AccountID = "NA"
version = 01.02 version = APP_VERSION
class ServerObj(): class ServerObj():
def __init__(self, isReachable=False): def __init__(self, isReachable=False):
@@ -93,7 +95,6 @@ def makeConfig():
with open('Config.ini', 'w') as configfile: with open('Config.ini', 'w') as configfile:
config.write(configfile) config.write(configfile)
def select_folder(): def select_folder():
root = tk.Tk() root = tk.Tk()
root.withdraw() root.withdraw()
@@ -154,7 +155,13 @@ def TiropitLogin():
def loadConfig(): def loadConfig():
try: try:
config.read(configPath) config.read(configPath)
Config.version = config["DEFAULT"]["Version"] Config.version = config["DEFAULT"]["Version"]
if float(Config.version) != float(APP_VERSION):
WarnMissingConfig("Outdated Config")
Config.AccountID = config["ACCOUNT"]["ID"] Config.AccountID = config["ACCOUNT"]["ID"]
Config.AccountID = config["ACCOUNT"]["KEY"] Config.AccountID = config["ACCOUNT"]["KEY"]
except Exception as e: except Exception as e:
@@ -167,20 +174,23 @@ def loadConfig():
# [Update Functions] <------------------------------------------------------------------------------------------------------------ [Begin] # [Update Functions] <------------------------------------------------------------------------------------------------------------ [Begin]
def CheckForUpdate(log=False): def CheckForUpdate(log=False):
print("Connecting....") if log: print("Connecting....")
print(f"Request Version from API@{TiropitCLI.url}") if log:print(f"Request Version from API@{TiropitCLI.url}")
response = requests.get(TiropitCLI.url + "/api/getTiropitVersion") response = requests.get(TiropitCLI.url + "/api/getTiropitVersion")
print(f"ResponseCode:{response.status_code}") if log:print(f"ResponseCode:{response.status_code}")
data = response.json() data = response.json()
print(f"ResponseJSON:{data}") if log:print(f"ResponseJSON:{data}")
version = float(data["Version"]) version = float(data["Version"])
currentVersion = float(Config.version) currentVersion = float(Config.version)
print(f"Recieved Version {version} - Current Version {currentVersion}") if log:print(f"Recieved Version {version} - Current Version {currentVersion}")
if version > currentVersion: if float(version) > float(currentVersion):
print(f"Downloading & Installing Update {version}")
download_file("https://kevinblog.sytes.net/APIS/TiropitLauncher/TiropitAPI.php", "test.mogus") 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}")