Merge pull request 'Correction migration vers Forgejo' (#236) from dev into main
Reviewed-on: #236
This commit is contained in:
commit
eb19e9b688
1 changed files with 20 additions and 1 deletions
|
|
@ -5,8 +5,8 @@ os.environ.pop("SSL_CERT_FILE", None)
|
|||
|
||||
from flask import Flask, request, abort
|
||||
from datetime import datetime, timezone
|
||||
import hmac
|
||||
import hashlib
|
||||
import hmac
|
||||
|
||||
app = Flask(__name__)
|
||||
|
||||
|
|
@ -23,6 +23,25 @@ PM2_BINARY = "/home/discord/.nvm/versions/node/v24.15.0/bin/pm2"
|
|||
# Bot Local Proxy (Relai vers le Cog de ton bot)
|
||||
BOT_LOCAL_URL = "http://127.0.0.1:5001/bot_event"
|
||||
|
||||
|
||||
def relay_payload_to_bot(payload):
|
||||
try:
|
||||
requests.post(BOT_LOCAL_URL, json=payload, timeout=5)
|
||||
except Exception as e:
|
||||
print(f"[!] Erreur de relais vers le bot Discord : {e}")
|
||||
|
||||
|
||||
def verify_signature(payload_brut, received_signature):
|
||||
if not received_signature:
|
||||
return False
|
||||
expected_signature = "sha256=" + hmac.new(
|
||||
WEBHOOK_SECRET.encode("utf-8"),
|
||||
payload_brut,
|
||||
hashlib.sha256
|
||||
).hexdigest()
|
||||
return hmac.compare_digest(expected_signature, received_signature)
|
||||
|
||||
|
||||
def send_discord_log(status, message, color, author=None, commit_msg=None):
|
||||
embed = {
|
||||
"title": f"🚀 Kuby V2 [Forgejo] : {status}",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue