blacksinisterx commited on
Commit
c73833d
·
verified ·
1 Parent(s): 7cbb328

deploy: batch update 2 file(s)

Browse files
Files changed (2) hide show
  1. alert_routes.py +4 -0
  2. app.py +4 -2
alert_routes.py CHANGED
@@ -208,6 +208,10 @@ def get_active_alerts():
208
  engine = get_alert_engine()
209
  alerts = engine.get_active_alerts(camera_id=camera_id)
210
 
 
 
 
 
211
  return jsonify({
212
  'success': True,
213
  'count': len(alerts),
 
208
  engine = get_alert_engine()
209
  alerts = engine.get_active_alerts(camera_id=camera_id)
210
 
211
+ logger.info(f"📡 /active polled — returning {len(alerts)} pending alert(s) "
212
+ f"(total generated: {engine.stats.get('total_alerts', 0)}, "
213
+ f"history: {len(engine._alert_history)})")
214
+
215
  return jsonify({
216
  'success': True,
217
  'count': len(alerts),
app.py CHANGED
@@ -93,12 +93,14 @@ except ImportError as e:
93
  # Initialize Flask app
94
  app = Flask(__name__)
95
 
96
- # CORS — allow Vercel frontend + localhost dev
97
  _allowed_origins = os.environ.get(
98
  'CORS_ORIGINS',
99
  'http://localhost:3000,https://detectif-ai-fyp.vercel.app'
100
  ).split(',')
101
- CORS(app, resources={r"/api/*": {"origins": _allowed_origins}})
 
 
102
 
103
  # Configure logging — file handler only when logs/ is writable
104
  _log_handlers = [logging.StreamHandler()]
 
93
  # Initialize Flask app
94
  app = Flask(__name__)
95
 
96
+ # CORS — allow Vercel frontend (all preview/prod deployments) + localhost dev
97
  _allowed_origins = os.environ.get(
98
  'CORS_ORIGINS',
99
  'http://localhost:3000,https://detectif-ai-fyp.vercel.app'
100
  ).split(',')
101
+ CORS(app, resources={r"/api/*": {"origins": _allowed_origins}},
102
+ supports_credentials=True,
103
+ allow_headers=["Content-Type", "Accept", "Authorization"])
104
 
105
  # Configure logging — file handler only when logs/ is writable
106
  _log_handlers = [logging.StreamHandler()]