From c81a28ec67a927a219ef0c0103416f502990401f Mon Sep 17 00:00:00 2001 From: wangzhiqiang <40115555+zhiqw@users.noreply.github.com> Date: Wed, 28 Jul 2021 19:58:16 +0800 Subject: [PATCH] feat: github --- spug_api/apps/apis/deploy.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/spug_api/apps/apis/deploy.py b/spug_api/apps/apis/deploy.py index 86ed372..006839d 100644 --- a/spug_api/apps/apis/deploy.py +++ b/spug_api/apps/apis/deploy.py @@ -45,6 +45,9 @@ def _is_valid_token(request): token = request.headers.get('X-Gogs-Signature') if token: return token == hmac.new(api_key.encode(), request.body, hashlib.sha256).hexdigest() + token = request.headers.get('X-Hub-Signature', '').split('=')[-1] + if token: + return token == hmac.new(api_key.encode(), request.body, hashlib.sha1).hexdigest() return False