Require auth token for alarm status

This commit is contained in:
Tanner Collin 2023-06-20 22:21:34 +00:00
parent 1fa0596f6a
commit 6b2b99e161
2 changed files with 10 additions and 0 deletions

View File

@ -764,6 +764,10 @@ class StatsViewSet(viewsets.ViewSet, List):
# {'data': 'Disarmed: Partition 1'}
# {'data': 'Disarmed: Partition 2'}
auth_token = request.META.get('HTTP_AUTHORIZATION', '')
if secrets.VEND_API_TOKEN and auth_token != 'Bearer ' + secrets.ALARM_API_TOKEN:
raise exceptions.PermissionDenied()
try:
data = str(request.data['data'])
except KeyError:

View File

@ -74,6 +74,12 @@ PRINTER_API_TOKEN = ''
# head /dev/urandom | base32 | head -c 40
PINBALL_API_TOKEN = ''
# Alarm integration API token
# Set this to random characters
# For example, use the output of this:
# head /dev/urandom | base32 | head -c 40
ALARM_API_TOKEN = ''
# Protospace general info
DOOR_CODE = ''
WIFI_PASS = ''