|
|
|
|
@ -2,7 +2,8 @@ from django.shortcuts import render |
|
|
|
|
from django.http import HttpResponse, JsonResponse |
|
|
|
|
from django.views.decorators.csrf import csrf_exempt |
|
|
|
|
from .models import ASSNotification |
|
|
|
|
import json |
|
|
|
|
from django.conf import settings |
|
|
|
|
import json, jwt |
|
|
|
|
|
|
|
|
|
def index(request): |
|
|
|
|
return HttpResponse("Hello, world. You're at the subs index.") |
|
|
|
|
@ -18,8 +19,18 @@ def app_store_webhook(request): |
|
|
|
|
fulljson = json.loads(data) |
|
|
|
|
signedPayload = fulljson['signedPayload'] |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
KEY_FILE = settings.ASS_KEY_FILE |
|
|
|
|
|
|
|
|
|
with open(KEY_FILE,'r') as key_file: |
|
|
|
|
key = ''.join(key_file.readlines()) |
|
|
|
|
|
|
|
|
|
decodedPayload = jwt.decode(signedPayload, key, algorithms=['ES256']) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
notification = ASSNotification( |
|
|
|
|
content=signedPayload, |
|
|
|
|
content=decodedPayload, |
|
|
|
|
) |
|
|
|
|
notification.save() |
|
|
|
|
|
|
|
|
|
|