mirror of
https://github.com/EeeeKa/webhook-catcher.git
synced 2025-09-24 03:42:10 +05:00
Patch for GitHub
This commit is contained in:
parent
a8e8438301
commit
9f678a8b76
@ -150,10 +150,17 @@ class WebHookHandler(BaseHTTPRequestHandler):
|
|||||||
return
|
return
|
||||||
|
|
||||||
# GET DATA
|
# GET DATA
|
||||||
data_raw = self.rfile.read1(10240)
|
data_raw = b''
|
||||||
|
data_read_complete = False
|
||||||
|
|
||||||
## Process data
|
while not data_read_complete:
|
||||||
data = json.loads(data_raw.decode('UTF-8'))
|
data_raw += self.rfile.read1(-1)
|
||||||
|
try:
|
||||||
|
data = json.loads(data_raw.decode('UTF-8'))
|
||||||
|
except:
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
data_read_complete = True
|
||||||
|
|
||||||
try:
|
try:
|
||||||
requested_full_name = data['repository']['full_name']
|
requested_full_name = data['repository']['full_name']
|
||||||
@ -209,7 +216,7 @@ class WebHookHandler(BaseHTTPRequestHandler):
|
|||||||
# CHECK SIGNATURE
|
# CHECK SIGNATURE
|
||||||
if current_repo['secret'] != '':
|
if current_repo['secret'] != '':
|
||||||
if signature_type == 'Hub':
|
if signature_type == 'Hub':
|
||||||
data_hash = hmac.new(current_repo['secret'].encode(), data_raw, hashlib.sha1).hexdigest()
|
data_hash = 'sha1=' + hmac.new(current_repo['secret'].encode(), data_raw, hashlib.sha1).hexdigest()
|
||||||
elif signature_type == 'Gogs':
|
elif signature_type == 'Gogs':
|
||||||
data_hash = hmac.new(current_repo['secret'].encode(), data_raw, hashlib.sha256).hexdigest()
|
data_hash = hmac.new(current_repo['secret'].encode(), data_raw, hashlib.sha256).hexdigest()
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user