Remove API key From Console
parent
3f84aefd41
commit
1dd95e0757
|
|
@ -138,12 +138,16 @@ class CL_SET_CPU(BaseModel):
|
|||
|
||||
class CL_UPDATE_HOST(BaseModel):
|
||||
hostname: str
|
||||
user: str
|
||||
ipadresse: str
|
||||
winver: str
|
||||
cpuname: str
|
||||
cores: int
|
||||
dbname: str
|
||||
ram: int
|
||||
hddfree: str
|
||||
hddused: str
|
||||
hddtotal: str
|
||||
ipadresse: str
|
||||
|
||||
class CL_SET_LASTLOGON_USER(BaseModel):
|
||||
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:
|
||||
return result[0][0]
|
||||
|
||||
@app.post("/host/cpu")
|
||||
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")
|
||||
database(f"INSERT INTO `{get.dbname}`.cpulist (cpuname,ghz,cputyp) VALUES ('{get.cpuname}','{get.ghz}','{get.cputyp}')","","")
|
||||
result = database(
|
||||
f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname} AND cputyp = {get.cputyp}')",
|
||||
"", "")
|
||||
database(
|
||||
f"INSERT INTO `{get.dbname}`.cpu_to_client (hardwareID,cpulistID) VALUES ('{get.hardwareID}','{result[0][0]}',)",
|
||||
"", "")
|
||||
if not result:
|
||||
return False
|
||||
else:
|
||||
return result[0][0]
|
||||
# @app.post("/host/cpu")
|
||||
# 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")
|
||||
# database(f"INSERT INTO `{get.dbname}`.cpulist (cpuname,ghz,cputyp) VALUES ('{get.cpuname}','{get.ghz}','{get.cputyp}')","","")
|
||||
# result = database(
|
||||
# f"SELECT id FROM `{get.dbname}`.cpulist WHERE cpuname = '{get.cpuname} AND cputyp = {get.cputyp}')",
|
||||
# "", "")
|
||||
# database(
|
||||
# f"INSERT INTO `{get.dbname}`.cpu_to_client (hardwareID,cpulistID) VALUES ('{get.hardwareID}','{result[0][0]}',)",
|
||||
# "", "")
|
||||
# if not result:
|
||||
# return False
|
||||
# else:
|
||||
# return result[0][0]
|
||||
|
||||
@app.post("/host/update")
|
||||
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}'","","")
|
||||
result = database(f"SELECT id FROM `{get.dbname}`.hardware 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}`.Clients WHERE `Host-Name` = '{get.hostname}'","", "")
|
||||
if not result:
|
||||
return False
|
||||
else:
|
||||
|
|
|
|||
Loading…
Reference in New Issue