CORRECT VENV AND ACTUALL API & CLI UPDATE.. update
This commit is contained in:
49
CLI/Init.py
49
CLI/Init.py
@@ -23,7 +23,7 @@ class Config():
|
||||
class ServerObj():
|
||||
def __init__(self, isReachable=False):
|
||||
|
||||
self.host = "0.0.0.0" + ":5000"
|
||||
self.host = "0.0.0.0"
|
||||
self.isReachable = False
|
||||
self.state = "Resolving IP"
|
||||
|
||||
@@ -38,6 +38,22 @@ class ServerObj():
|
||||
args = parser.parse_args()
|
||||
Server = ServerObj()
|
||||
|
||||
|
||||
class TiropitCliObj:
|
||||
_server_instance = Server
|
||||
|
||||
@property
|
||||
def url(self):
|
||||
return f"http://{self._server_instance.host}:5000"
|
||||
|
||||
@property
|
||||
def isReachable(self):
|
||||
return self._server_instance.isReachable
|
||||
|
||||
TiropitCLI = TiropitCliObj()
|
||||
|
||||
|
||||
|
||||
#declare files
|
||||
config = configparser.ConfigParser()
|
||||
configPath = Path("Config.ini")
|
||||
@@ -90,6 +106,30 @@ def select_folder():
|
||||
|
||||
return folder_path
|
||||
|
||||
# [Update Functions] <------------------------------------------------------------------------------------------------------------ [Begin]
|
||||
|
||||
def CheckForUpdate(log=False):
|
||||
print("Connecting....")
|
||||
print(f"Request Version from API@{TiropitCLI.url}")
|
||||
response = requests.get(TiropitCLI.url + "/api/getTiropitVersion")
|
||||
print(f"ResponseCode:{response.status_code}")
|
||||
print(f"ResponseJSON:{response.json()}")
|
||||
|
||||
|
||||
|
||||
|
||||
# [Update Functions] <-------------------------------------------------------------------------------------------------------------- [End]
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
def TiropitLogin():
|
||||
@@ -107,6 +147,8 @@ def TiropitLogin():
|
||||
Display.Clear()
|
||||
showIntroText()
|
||||
print(f"|[LogIn: Login page] [{Server.Icon}]|")
|
||||
|
||||
|
||||
print("| Enter your username |")
|
||||
print("| |")
|
||||
print("| |")
|
||||
@@ -316,7 +358,7 @@ def showMenu(menuID):
|
||||
print("|[1] Log in to tiropit | [2] Reset Data & Config |")
|
||||
print("|[3] Send / Get Request| [4] My Profile |")
|
||||
print("|[5] Debug Data | [6] Games |")
|
||||
print("|[e] Exit |")
|
||||
print("|[e] Exit | [7] Update |")
|
||||
print("======================================================")
|
||||
option = input(">> ")
|
||||
if option == "": showMenu(1)
|
||||
@@ -328,6 +370,9 @@ def showMenu(menuID):
|
||||
TiropitLogin()
|
||||
case "5":
|
||||
debugMenu()
|
||||
case "7":
|
||||
CheckForUpdate()
|
||||
|
||||
case "6":
|
||||
Gamesmenu()
|
||||
case "e":
|
||||
|
||||
Reference in New Issue
Block a user