Finished up Malfunction reporting in the backend. Removed forgotten print statement.
This commit is contained in:
parent
224b03125c
commit
0f500a97c5
|
@ -163,11 +163,13 @@ def addCyberware():
|
|||
try:
|
||||
tempName = json['name']
|
||||
tempHotpluggable = json['hotpluggable']
|
||||
tempCanSet = json['canSet']
|
||||
tempNewCyberware = copy(newCyberwareTemplate)
|
||||
|
||||
tempNewCyberware['uuid'] = str(uuid.uuid4())
|
||||
tempNewCyberware['name'] = tempName
|
||||
tempNewCyberware['hotpluggable'] = tempHotpluggable
|
||||
tempNewCyberware['canSet'] = tempCanSet
|
||||
|
||||
|
||||
cyberware.append(tempNewCyberware)
|
||||
|
@ -219,6 +221,21 @@ def getCyberwareMalfunctions():
|
|||
|
||||
return jsonify(returnArr), 200
|
||||
|
||||
# Arguments { uuid: STRING, malfunction: STRING }
|
||||
@app.route('/api/cyberware/malfunctions', methods=['POST'])
|
||||
def setCyberwareMalfunction():
|
||||
json = request.get_json()
|
||||
|
||||
try:
|
||||
desiredId = json['uuid']
|
||||
malfunction = json['malfunction']
|
||||
|
||||
requestedCyberware = getCyberwareHelper(desiredId)
|
||||
|
||||
requestedCyberware['lastMalfunction'] = malfunction
|
||||
except:
|
||||
return 'Incorrect usage.\nUsage: { malfunction: STRING, uuid: STRING }\n', 400
|
||||
|
||||
@app.route('/api/cyberware/messages')
|
||||
def getCyberwareMessages():
|
||||
returnArr = []
|
||||
|
@ -227,7 +244,6 @@ def getCyberwareMessages():
|
|||
if c['messages'] != None:
|
||||
returnArr.append({ 'name': c['name'], 'messages': c['messages'] })
|
||||
resetMessages()
|
||||
print(returnArr)
|
||||
return jsonify(returnArr), 200
|
||||
|
||||
# Arguments { uuid: STRING, message:{ title: STRING, message: STRING, progress: INT } }
|
||||
|
@ -416,6 +432,9 @@ def authenticate(uuid, endpoint):
|
|||
requestedHardware = c
|
||||
break
|
||||
|
||||
if requestedHardware['canSet'] == None:
|
||||
return False
|
||||
|
||||
for e in requestedHardware['canSet']: # Endpoint match
|
||||
if e == endpoint:
|
||||
return True
|
||||
|
|
Loading…
Reference in a new issue