Add input box for sending messages to the sign
This commit is contained in:
@@ -26,6 +26,7 @@ DEFAULTS = {
|
||||
'card_scans': 0,
|
||||
'track': {},
|
||||
'alarm': {},
|
||||
'sign': '',
|
||||
}
|
||||
|
||||
if secrets.MUMBLE:
|
||||
|
@@ -569,6 +569,23 @@ class StatsViewSet(viewsets.ViewSet, List):
|
||||
except KeyError:
|
||||
raise exceptions.ValidationError(dict(data='This field is required.'))
|
||||
|
||||
@action(detail=False, methods=['post'])
|
||||
def sign(self, request):
|
||||
try:
|
||||
sign = request.data['sign']
|
||||
cache.set('sign', sign)
|
||||
|
||||
try:
|
||||
post_data = dict(access_token=secrets.SIGN_TOKEN, args=sign)
|
||||
r = requests.post('https://api.particle.io/v1/devices/200042000647343232363230/text/', data=post_data, timeout=5)
|
||||
r.raise_for_status()
|
||||
except:
|
||||
raise exceptions.ValidationError(dict(sign='Something went wrong :('))
|
||||
|
||||
return Response(200)
|
||||
except KeyError:
|
||||
raise exceptions.ValidationError(dict(sign='This field is required.'))
|
||||
|
||||
@action(detail=False, methods=['post'])
|
||||
def alarm(self, request):
|
||||
try:
|
||||
|
@@ -68,6 +68,7 @@ DOOR_CODE = ''
|
||||
WIFI_PASS = ''
|
||||
MINECRAFT = ''
|
||||
MUMBLE = ''
|
||||
SIGN_TOKEN = ''
|
||||
|
||||
# Portal Email Credentials
|
||||
# For sending password resets, etc.
|
||||
|
Reference in New Issue
Block a user