feat: github

pull/360/head
wangzhiqiang 2021-07-28 19:58:16 +08:00 committed by GitHub
parent 6fa67120ef
commit c81a28ec67
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -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