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__':
|
||||
app.run(host="0.0.0.0", port=5000, debug=True)
|
||||
|
||||
Reference in New Issue
Block a user