From 9389fff3861a22c2d5f8eee05f27ac55af98634d Mon Sep 17 00:00:00 2001 From: Sebastian Serfling Date: Fri, 13 Oct 2023 09:32:13 +0200 Subject: [PATCH] Remove API key From Console --- main.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/main.py b/main.py index b9a0c23..a88bf6a 100644 --- a/main.py +++ b/main.py @@ -66,7 +66,7 @@ async def database_get(get: CL.CL_Database_get,api_key: APIKey = Depends(auth.ge else: return False -@app.post("/info/getvolume") +@app.post("/host/get/netvolume") async def getvolume(get: CL.CL_GET_VOLUMES,api_key: APIKey = Depends(auth.get_api_key)): ## Anpassung zum neune Schema erstellen result = database(f"SELECT `Netzlaufwerk_1`,`Netzlaufwerk_2`,`Netzlaufwerk_3`,`Netzlaufwerk_4`,`Netzlaufwerk_5`,`Netzlaufwerk_6`,`Netzlaufwerk_7`,`Netzlaufwerk_8`,`Netzlaufwerk_9`,`Netzlaufwerk_10` FROM `Clients` where `Name` = '{get.name}'",f"{get.database}","") @@ -86,16 +86,16 @@ async def getuser(get: CL.CL_GET_USER,api_key: APIKey = Depends(auth.get_api_key else: return result[0][0] -@app.post("/info/gethost") -async def gethostname(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key)): +@app.post("/host/get") +async def gethost(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key)): result = database(f"SELECT id FROM `hardware` where `hostname` = '{get.hostname}'",f"{get.dbname}","") if not result: return False else: return result[0][0] -@app.post("/info/sethost") -async def sethostname(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key)): +@app.post("/host/set") +async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key)): database(f"INSERT INTO `{get.dbname}`.hardware (hostname,ipadresse,ram,hddused,hddfree,hddtotal) VALUES ('{get.hostname}','{get.ipadresse}','{get.ram}','{get.hddused}','{get.hddfree}','{get.hddtotal}')","","") result = database( f"SELECT id FROM `{get.dbname}`.hardware WHERE hostname = '{get.hostname}')", @@ -105,8 +105,8 @@ async def sethostname(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api else: return result[0][0] -@app.post("/info/sethost_user") -async def sethost_user(get: CL.CL_SET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)): +@app.post("/user/set") +async def set_user(get: CL.CL_SET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)): database(f"INSERT INTO `{get.dbname}`.user (user) VALUES ('{get.user}')","","") result = database(f"SELECT id FROM `{get.dbname}`.user WHERE user = '{get.user}'","","") database(f"INSERT INTO `{get.dbname}`.hardware_to_user (userID,hardwareID) VALUES ('{result[0][0]}',{get.hardwareID})", "", "") @@ -115,16 +115,16 @@ async def sethost_user(get: CL.CL_SET_HOST_USER,api_key: APIKey = Depends(auth.g else: return result -@app.post("/info/gethost_user") -async def gethost_user(get: CL.CL_GET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)): +@app.post("/user/get") +async def get_user(get: CL.CL_GET_HOST_USER,api_key: APIKey = Depends(auth.get_api_key)): result = database(f"SELECT id FROM `{get.dbname}`.user WHERE user = '{get.user}'","","") if not result: return False else: return result[0][0] -@app.post("/info/setlastlogon_user") -async def setlastlogon_user(get: CL.CL_SET_LASTLOGON_USER,api_key: APIKey = Depends(auth.get_api_key)): +@app.post("/user/set/lastlogon") +async def set_lastlogon_user(get: CL.CL_SET_LASTLOGON_USER,api_key: APIKey = Depends(auth.get_api_key)): database(f"INSERT INTO `{get.dbname}`.lastlogon (lastlogon) VALUES ('{get.lastlogon}')","","") lastlogonid = database(f"SELECT id FROM `{get.dbname}`.lastlogon WHERE lastlogon = '{get.lastlogon}'","","") result = database(f"INSERT INTO `{get.dbname}`.lastlogon_to_user (userID,lastlogonID) VALUES ('{get.userID}','{lastlogonid[0][0]}')", "", "")