ernestmindres commited on
Commit
f29e2fa
·
verified ·
1 Parent(s): 48ef31f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -0
app.py CHANGED
@@ -10,7 +10,11 @@ from datetime import datetime
10
  from flask import Flask, request, jsonify, Response, session
11
  from flask_cors import CORS
12
  import baserow_storage # Assurez-vous que ceci est présent
 
 
13
 
 
 
14
  # Importation des modules backend
15
  from auth_backend import (
16
  get_user_by_id,
@@ -40,6 +44,12 @@ from werkzeug.middleware.proxy_fix import ProxyFix
40
  app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_prefix=1)
41
  # ------------------------------------------------------------------
42
 
 
 
 
 
 
 
43
  # Configuration
44
  app.secret_key = os.environ.get("FLASK_SECRET_KEY", "super_secret_dev_key")
45
  app.config['MAX_CONTENT_LENGTH'] = DEFAULT_MAX_CONTENT_LENGTH
@@ -57,6 +67,8 @@ app.register_blueprint(user_bp)
57
  app.register_blueprint(billing_bp)
58
  app.register_blueprint(embed_bp) # <-- NOUVEL ENREGISTREMENT
59
 
 
 
60
  # --- Décorateurs d'Authentification (Conservés) ---
61
  def login_required(f):
62
  @wraps(f)
 
10
  from flask import Flask, request, jsonify, Response, session
11
  from flask_cors import CORS
12
  import baserow_storage # Assurez-vous que ceci est présent
13
+ # NOUVEL IMPORT POUR LES WEB SOCKETS
14
+ from flask_socketio import SocketIO
15
 
16
+ # NOUVEL IMPORT POUR LA GESTION DU TERMINAL
17
+ from terminal_manager import setup_terminal_events
18
  # Importation des modules backend
19
  from auth_backend import (
20
  get_user_by_id,
 
44
  app.wsgi_app = ProxyFix(app.wsgi_app, x_for=1, x_proto=1, x_host=1, x_port=1, x_prefix=1)
45
  # ------------------------------------------------------------------
46
 
47
+ # car Hugging Face utilise souvent Gunicorn avec ces workers.
48
+ socketio = SocketIO(app, cors_allowed_origins="*")
49
+
50
+ # --- Configuration des événements SocketIO pour le Terminal ---
51
+ setup_terminal_events(socketio)
52
+
53
  # Configuration
54
  app.secret_key = os.environ.get("FLASK_SECRET_KEY", "super_secret_dev_key")
55
  app.config['MAX_CONTENT_LENGTH'] = DEFAULT_MAX_CONTENT_LENGTH
 
67
  app.register_blueprint(billing_bp)
68
  app.register_blueprint(embed_bp) # <-- NOUVEL ENREGISTREMENT
69
 
70
+
71
+
72
  # --- Décorateurs d'Authentification (Conservés) ---
73
  def login_required(f):
74
  @wraps(f)