[tasks] First try at adding an emacs webhook
This commit is contained in:
@ -525,6 +525,7 @@ def gps_webhook(request):
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
@permission_classes([IsAuthenticated])
|
||||
@api_view(["POST"])
|
||||
def emacs_webhook(request):
|
||||
try:
|
||||
@ -539,18 +540,19 @@ def emacs_webhook(request):
|
||||
"user_id": 1,
|
||||
},
|
||||
)
|
||||
data_dict["source"] = "orgmode"
|
||||
data_dict["source_id"] = data_dict.pop("emacs_id")
|
||||
|
||||
# TODO Fix this so we have to authenticate!
|
||||
user_id = 1
|
||||
if request.user.id:
|
||||
user_id = request.user.id
|
||||
user_id = request.user.id
|
||||
if not user_id:
|
||||
user_id = 1
|
||||
|
||||
# scrobble = gpslogger_scrobble_location(data_dict, user_id)
|
||||
scrobble = emacs_scrobble_task(data_dict, user_id)
|
||||
|
||||
# if not scrobble:
|
||||
# return Response({}, status=status.HTTP_200_OK)
|
||||
if not scrobble:
|
||||
return Response({"data": data_dict}, status=status.HTTP_200_OK)
|
||||
|
||||
return Response({"post_data": post_data}, status=status.HTTP_200_OK)
|
||||
return Response({"scrobble_id": scrobble.id}, status=status.HTTP_200_OK)
|
||||
|
||||
|
||||
@csrf_exempt
|
||||
|
||||
Reference in New Issue
Block a user