Browse Source

Fix header and string to byte

JoostSijm 6 năm trước cách đây
mục cha
commit
a99f11fb60
1 tập tin đã thay đổi với 4 bổ sung4 xóa
  1. 4 4
      app/flaskr.py

+ 4 - 4
app/flaskr.py

@@ -11,7 +11,7 @@ from flask import jsonify, abort, request
 from app import app
 
 
-secret = "JdFILOA1O7x6WTcsphlszmeQqU5ngoKZ"
+secret = 'JdFILOA1O7x6WTcsphlszmeQqU5ngoKZ'
 
 
 @app.route('/')
@@ -24,11 +24,11 @@ def index():
 def deploy():
     """Run deploy script"""
     digest = hmac.new(secret, request.data, hashlib.sha1).hexdigest()
-    signature = request.headers['X-Hub-Signature'].split('=', 1)
+    signature = request.headers['X-Gogs-Signature'].split('=', 1)
     if (len(signature) < 2 or signature[0] != 'sha1'
             or not hmac.compare_digest(signature[1], digest)):
         abort(400, 'Invalid signature')
 
-    call(["git", "pull"])
-    call(["touch", "flask.wsgi"])
+    call(['git', 'pull'])
+    call(['touch', 'flask.wsgi'])
     return jsonify(True)