|
@@ -3,17 +3,15 @@
|
|
|
Website for Craftbroec RR stuff
|
|
|
"""
|
|
|
|
|
|
+import os
|
|
|
import hashlib
|
|
|
import hmac
|
|
|
-
|
|
|
from subprocess import call
|
|
|
+
|
|
|
from flask import jsonify, abort, request
|
|
|
from app import app
|
|
|
|
|
|
|
|
|
-secret = b'JdFILOA1O7x6WTcsphlszmeQqU5ngoKZ'
|
|
|
-
|
|
|
-
|
|
|
@app.route('/')
|
|
|
def index():
|
|
|
"""Show index page"""
|
|
@@ -23,6 +21,7 @@ def index():
|
|
|
@app.route('/deploy', methods=['POST'])
|
|
|
def deploy():
|
|
|
"""Run deploy script"""
|
|
|
+ secret = os.environ["WEBHOOK_KEY"]
|
|
|
digest = hmac.new(secret, request.data, hashlib.sha256).hexdigest()
|
|
|
signature = request.headers['X-Gogs-Signature']
|
|
|
if len(signature) < 2 or not hmac.compare_digest(signature, digest):
|