From 63eb3bebefb7bc5130461b0c4688353906a4531c Mon Sep 17 00:00:00 2001 From: FreneticScribbler Date: Tue, 27 Jun 2023 00:14:36 +0100 Subject: [PATCH] What if I gave it the right arguments. That might be a good start. --- RIGS/views/rigboard.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/RIGS/views/rigboard.py b/RIGS/views/rigboard.py index 31e99568..07f1365d 100644 --- a/RIGS/views/rigboard.py +++ b/RIGS/views/rigboard.py @@ -408,7 +408,7 @@ def dispatch(self, request, *args, **kwargs): return super().dispatch(request, *args, **kwargs) def post(self, request, *args, **kwargs): - computed = f"sha256={hmac.new(env('FORUM_WEBHOOK_SECRET'), request.body).hexdigest()}" + computed = f"sha256={hmac.new(env('FORUM_WEBHOOK_SECRET').encode(), request.body, digestmod='sha256').hexdigest()}" if request.POST.get('X-Discourse-Event-Signature') == computed: # and request.POST.get('X-Discourse-Event') == "topic_created": body = json.loads(request.body.decode('utf-8')) event_id = int(body['title'][1:5]) # find the ID, force convert it to an int to eliminate leading zeros