Remove API key From Console
parent
3f84aefd41
commit
1dd95e0757
|
|
@ -138,12 +138,16 @@ class CL_SET_CPU(BaseModel):
|
||||||
|
|
||||||
class CL_UPDATE_HOST(BaseModel):
|
class CL_UPDATE_HOST(BaseModel):
|
||||||
hostname: str
|
hostname: str
|
||||||
|
user: str
|
||||||
|
ipadresse: str
|
||||||
|
winver: str
|
||||||
|
cpuname: str
|
||||||
|
cores: int
|
||||||
dbname: str
|
dbname: str
|
||||||
ram: int
|
ram: int
|
||||||
hddfree: str
|
hddfree: str
|
||||||
hddused: str
|
hddused: str
|
||||||
hddtotal: str
|
hddtotal: str
|
||||||
ipadresse: str
|
|
||||||
|
|
||||||
class CL_SET_LASTLOGON_USER(BaseModel):
|
class CL_SET_LASTLOGON_USER(BaseModel):
|
||||||
userID: int
|
userID: int
|
||||||
|
|
|
||||||
32
main.py
32
main.py
|
|
@ -124,25 +124,25 @@ async def sethost(get: CL.CL_SET_HOST,api_key: APIKey = Depends(auth.get_api_key
|
||||||
else:
|
else:
|
||||||
return result[0][0]
|
return result[0][0]
|
||||||
|
|
||||||
@app.post("/host/cpu")
|
# @app.post("/host/cpu")
|
||||||
async def setcpu(get: CL.CL_SET_CPU,api_key: APIKey = Depends(auth.get_api_key)):
|
# async def setcpu(get: CL.CL_SET_CPU,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
check = database(f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname}' AND ghz")
|
# check = database(f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname}' AND ghz")
|
||||||
database(f"INSERT INTO `{get.dbname}`.cpulist (cpuname,ghz,cputyp) VALUES ('{get.cpuname}','{get.ghz}','{get.cputyp}')","","")
|
# database(f"INSERT INTO `{get.dbname}`.cpulist (cpuname,ghz,cputyp) VALUES ('{get.cpuname}','{get.ghz}','{get.cputyp}')","","")
|
||||||
result = database(
|
# result = database(
|
||||||
f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname} AND cputyp = {get.cputyp}')",
|
# f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname} AND cputyp = {get.cputyp}')",
|
||||||
"", "")
|
# "", "")
|
||||||
database(
|
# database(
|
||||||
f"INSERT INTO `{get.dbname}`.cpu_to_client (hardwareID,cpulistID) VALUES ('{get.hardwareID}','{result[0][0]}',)",
|
# f"INSERT INTO `{get.dbname}`.cpu_to_client (hardwareID,cpulistID) VALUES ('{get.hardwareID}','{result[0][0]}',)",
|
||||||
"", "")
|
# "", "")
|
||||||
if not result:
|
# if not result:
|
||||||
return False
|
# return False
|
||||||
else:
|
# else:
|
||||||
return result[0][0]
|
# return result[0][0]
|
||||||
|
|
||||||
@app.post("/host/update")
|
@app.post("/host/update")
|
||||||
async def updatehost(get: CL.CL_UPDATE_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
async def updatehost(get: CL.CL_UPDATE_HOST,api_key: APIKey = Depends(auth.get_api_key)):
|
||||||
database(f"UPDATE `{get.dbname}`.hardware SET ipadresse = '{get.ipadresse}', ram = '{get.ram}', hddused = '{get.hddused}' ,hddfree = '{get.hddfree}',hddtotal = '{get.hddtotal}' WHERE hostname = '{get.hostname}'","","")
|
database(f"UPDATE `{get.dbname}`.Clients SET Username = {get.user},`IP-Adresse` = {get.ipadresse},`Windows-Version` = {get.winver},`CPU-Name` = {get.cpuname}',`Prozessor-Anzahl = '{get.cores}'`,RAM = '{get.ram}',Speichergesamt = '{get.hddtotal}',Speicherfrei = '{get.hddfree}',Speicherbelegt = '{get.hddused}', LastChange = {datetime.now()} WHERE hostname = '{get.hostname}'","","")
|
||||||
result = database(f"SELECT id FROM `{get.dbname}`.hardware WHERE hostname = '{get.hostname}'","", "")
|
result = database(f"SELECT id FROM `{get.dbname}`.Clients WHERE `Host-Name` = '{get.hostname}'","", "")
|
||||||
if not result:
|
if not result:
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue