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:
|
try:
|
||||||
tempName = json['name']
|
tempName = json['name']
|
||||||
tempHotpluggable = json['hotpluggable']
|
tempHotpluggable = json['hotpluggable']
|
||||||
|
tempCanSet = json['canSet']
|
||||||
tempNewCyberware = copy(newCyberwareTemplate)
|
tempNewCyberware = copy(newCyberwareTemplate)
|
||||||
|
|
||||||
tempNewCyberware['uuid'] = str(uuid.uuid4())
|
tempNewCyberware['uuid'] = str(uuid.uuid4())
|
||||||
tempNewCyberware['name'] = tempName
|
tempNewCyberware['name'] = tempName
|
||||||
tempNewCyberware['hotpluggable'] = tempHotpluggable
|
tempNewCyberware['hotpluggable'] = tempHotpluggable
|
||||||
|
tempNewCyberware['canSet'] = tempCanSet
|
||||||
|
|
||||||
|
|
||||||
cyberware.append(tempNewCyberware)
|
cyberware.append(tempNewCyberware)
|
||||||
|
@ -219,6 +221,21 @@ def getCyberwareMalfunctions():
|
||||||
|
|
||||||
return jsonify(returnArr), 200
|
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')
|
@app.route('/api/cyberware/messages')
|
||||||
def getCyberwareMessages():
|
def getCyberwareMessages():
|
||||||
returnArr = []
|
returnArr = []
|
||||||
|
@ -227,7 +244,6 @@ def getCyberwareMessages():
|
||||||
if c['messages'] != None:
|
if c['messages'] != None:
|
||||||
returnArr.append({ 'name': c['name'], 'messages': c['messages'] })
|
returnArr.append({ 'name': c['name'], 'messages': c['messages'] })
|
||||||
resetMessages()
|
resetMessages()
|
||||||
print(returnArr)
|
|
||||||
return jsonify(returnArr), 200
|
return jsonify(returnArr), 200
|
||||||
|
|
||||||
# Arguments { uuid: STRING, message:{ title: STRING, message: STRING, progress: INT } }
|
# Arguments { uuid: STRING, message:{ title: STRING, message: STRING, progress: INT } }
|
||||||
|
@ -416,6 +432,9 @@ def authenticate(uuid, endpoint):
|
||||||
requestedHardware = c
|
requestedHardware = c
|
||||||
break
|
break
|
||||||
|
|
||||||
|
if requestedHardware['canSet'] == None:
|
||||||
|
return False
|
||||||
|
|
||||||
for e in requestedHardware['canSet']: # Endpoint match
|
for e in requestedHardware['canSet']: # Endpoint match
|
||||||
if e == endpoint:
|
if e == endpoint:
|
||||||
return True
|
return True
|
||||||
|
|
Loading…
Reference in a new issue