CORRECT VENV AND ACTUALL API & CLI UPDATE.. update
This commit is contained in:
20
API/Tiri.py
20
API/Tiri.py
@@ -100,6 +100,26 @@ def tiropit_add_user():
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# App version endpoints
|
||||||
|
|
||||||
|
@app.route("/api/getTiropitVersion", methods=["GET"])
|
||||||
|
def getTiropitVersion():
|
||||||
|
conn = get_db_connection()
|
||||||
|
cursor = conn.cursor(dictionary=True)
|
||||||
|
|
||||||
|
try:
|
||||||
|
cursor.execute("SELECT Version FROM AppData ORDER BY ID DESC LIMIT 1")
|
||||||
|
result = cursor.fetchone()
|
||||||
|
|
||||||
|
if result:
|
||||||
|
return jsonify({"Version":result["Version"]}), 200
|
||||||
|
else:
|
||||||
|
return jsonify({"error":"No version found"}), 404
|
||||||
|
except mysql.connector.Error as e:
|
||||||
|
return jsonify({"error":str(e)}), 500
|
||||||
|
finally:
|
||||||
|
cursor.close()
|
||||||
|
conn.close()
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
app.run(host="0.0.0.0", port=5000, debug=True)
|
app.run(host="0.0.0.0", port=5000, debug=True)
|
||||||
|
|||||||
49
CLI/Init.py
49
CLI/Init.py
@@ -23,7 +23,7 @@ class Config():
|
|||||||
class ServerObj():
|
class ServerObj():
|
||||||
def __init__(self, isReachable=False):
|
def __init__(self, isReachable=False):
|
||||||
|
|
||||||
self.host = "0.0.0.0" + ":5000"
|
self.host = "0.0.0.0"
|
||||||
self.isReachable = False
|
self.isReachable = False
|
||||||
self.state = "Resolving IP"
|
self.state = "Resolving IP"
|
||||||
|
|
||||||
@@ -38,6 +38,22 @@ class ServerObj():
|
|||||||
args = parser.parse_args()
|
args = parser.parse_args()
|
||||||
Server = ServerObj()
|
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
|
#declare files
|
||||||
config = configparser.ConfigParser()
|
config = configparser.ConfigParser()
|
||||||
configPath = Path("Config.ini")
|
configPath = Path("Config.ini")
|
||||||
@@ -90,6 +106,30 @@ def select_folder():
|
|||||||
|
|
||||||
return folder_path
|
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():
|
def TiropitLogin():
|
||||||
@@ -107,6 +147,8 @@ def TiropitLogin():
|
|||||||
Display.Clear()
|
Display.Clear()
|
||||||
showIntroText()
|
showIntroText()
|
||||||
print(f"|[LogIn: Login page] [{Server.Icon}]|")
|
print(f"|[LogIn: Login page] [{Server.Icon}]|")
|
||||||
|
|
||||||
|
|
||||||
print("| Enter your username |")
|
print("| Enter your username |")
|
||||||
print("| |")
|
print("| |")
|
||||||
print("| |")
|
print("| |")
|
||||||
@@ -316,7 +358,7 @@ def showMenu(menuID):
|
|||||||
print("|[1] Log in to tiropit | [2] Reset Data & Config |")
|
print("|[1] Log in to tiropit | [2] Reset Data & Config |")
|
||||||
print("|[3] Send / Get Request| [4] My Profile |")
|
print("|[3] Send / Get Request| [4] My Profile |")
|
||||||
print("|[5] Debug Data | [6] Games |")
|
print("|[5] Debug Data | [6] Games |")
|
||||||
print("|[e] Exit |")
|
print("|[e] Exit | [7] Update |")
|
||||||
print("======================================================")
|
print("======================================================")
|
||||||
option = input(">> ")
|
option = input(">> ")
|
||||||
if option == "": showMenu(1)
|
if option == "": showMenu(1)
|
||||||
@@ -328,6 +370,9 @@ def showMenu(menuID):
|
|||||||
TiropitLogin()
|
TiropitLogin()
|
||||||
case "5":
|
case "5":
|
||||||
debugMenu()
|
debugMenu()
|
||||||
|
case "7":
|
||||||
|
CheckForUpdate()
|
||||||
|
|
||||||
case "6":
|
case "6":
|
||||||
Gamesmenu()
|
Gamesmenu()
|
||||||
case "e":
|
case "e":
|
||||||
|
|||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user