Remove API key From Console
parent
b595d7aa1c
commit
2e2144cfa1
|
|
@ -112,6 +112,11 @@ class CL_GET_HOST_USER(BaseModel):
|
||||||
|
|
||||||
class CL_SET_HOST(BaseModel):
|
class CL_SET_HOST(BaseModel):
|
||||||
hostname: str
|
hostname: str
|
||||||
|
user: str
|
||||||
|
ipadresse: str
|
||||||
|
winver: str
|
||||||
|
cpuname: str
|
||||||
|
cores: str
|
||||||
dbname: str
|
dbname: str
|
||||||
ram: int
|
ram: int
|
||||||
hddfree: str
|
hddfree: str
|
||||||
|
|
|
||||||
6
main.py
6
main.py
|
|
@ -88,7 +88,7 @@ async def getuser(get: CL.CL_GET_USER,api_key: APIKey = Depends(auth.get_api_key
|
||||||
|
|
||||||
@app.post("/host/get")
|
@app.post("/host/get")
|
||||||
async def gethost(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
async def gethost(get: CL.CL_GET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
result = database(f"SELECT id FROM `clients` where `hostname` = '{get.hostname}'",f"{get.dbname}","")
|
result = database(f"SELECT id FROM `Clients` where `hostname` = '{get.hostname}'",f"{get.dbname}","")
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|
@ -115,9 +115,9 @@ async def getdatabase(get: CL.CL_GET_DATABASE,api_key: APIKey = Depends(auth.get
|
||||||
|
|
||||||
@app.post("/host/set")
|
@app.post("/host/set")
|
||||||
async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
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}')","","")
|
database(f"INSERT INTO `{get.dbname}`.Clients (Name,Username,IP-Adresse,Windows-Version,CPU-Name,Prozessor-Anzahl,RAM,Speichergesamt,Speicherfrei,Speicherbelegt) VALUES ('{get.hostname}','{get.user}','{get.ipadresse}','{get.winver}','{get.cpuname}','{get.cores}','{get.ram}','{get.hddtotal}','{get.hddfree}','{get.hddused}')","","")
|
||||||
result = database(
|
result = database(
|
||||||
f"SELECT id FROM `{get.dbname}`.hardware WHERE hostname = '{get.hostname}')",
|
f"SELECT id FROM `{get.dbname}`.Clients WHERE hostname = '{get.hostname}')",
|
||||||
"", "")
|
"", "")
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue