Added basic PIN to web interface, partially implemented back-end

This commit is contained in:
2026-06-03 17:55:26 +01:00
parent a13f73cb99
commit 739f3ec5b4
3 changed files with 8 additions and 3 deletions

2
app.py
View File

@ -60,11 +60,13 @@ def transmit():
action = ACTION_MAP[data['action']]
intensity = int(data.get('intensity', 0))
lucal = bool(data.get('lucalEncoded', False))
pin = int(data['shockerPin'])
# If any of those failed, return an error.
except (ValueError, KeyError):
return {'success': False, 'message': 'Request must contain the following keys:\n'+
'txID: int,\n'+
'channel: int,\n'+
'pin: int,\n'+
'action: "shock", "vibrate" or "beep",\n'+
'intensity (optional): int\n'+
'lucalEncoded (optional): bool'}, 400