Correction migration vers Forgejo #236
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 flask import Flask, request, abort
|
||||||
from datetime import datetime, timezone
|
from datetime import datetime, timezone
|
||||||
import hmac
|
|
||||||
import hashlib
|
import hashlib
|
||||||
|
import hmac
|
||||||
|
|
||||||
app = Flask(__name__)
|
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 Proxy (Relai vers le Cog de ton bot)
|
||||||
BOT_LOCAL_URL = "http://127.0.0.1:5001/bot_event"
|
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):
|
def send_discord_log(status, message, color, author=None, commit_msg=None):
|
||||||
embed = {
|
embed = {
|
||||||
"title": f"🚀 Kuby V2 [Forgejo] : {status}",
|
"title": f"🚀 Kuby V2 [Forgejo] : {status}",
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue