o2switch
erreur401 2 years ago
parent 12d35bdb4e
commit 87b6723178
  1. 21
      app.py

@ -116,29 +116,10 @@ def search():
def webhook():
if request.method == 'POST':
repo_path = "http://git.tdtdt.net:3003/zvevqx/tdtdt.git" # Replace with the actual path
subprocess.run(['git', 'pull origin o2switch', repo_path])
subprocess.run(['git', 'pull', repo_path])
return "Webhook received!"
# # Verify the secret (if you used one in Gitea)
# secret = "salut" # Replace with your actual secret
# if secret:
# if 'X-Gitea-Signature' not in request.headers:
# return "Unauthorized", 401
# received_signature = request.headers['X-Gitea-Signature']
# expected_signature = f"sha256={compute_signature(request.data, secret)}"
# if received_signature != expected_signature:
# return "Unauthorized", 401
#
# # Perform Git pull to update the website's code
# # repo_path = "/path/to/your/website/repo" # Replace with the actual path
# # subprocess.run(['git', 'pull'], cwd=repo_path)
# # Restart the Flask app
# #restart_flask_app()
# print("YOLOLYOYLOOLLYYYOOOLLOO il y a un push")
# return "Webhook received and processed successfully", 200
def compute_signature(data, secret):
import hmac
import hashlib

Loading…
Cancel
Save