mike23415 commited on
Commit
5e6839e
Β·
verified Β·
1 Parent(s): 17d921b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -4
app.py CHANGED
@@ -20,7 +20,8 @@ import threading
20
  app = Flask(__name__)
21
  CORS(app)
22
 
23
- socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading')
 
24
 
25
  # ADD THIS new storage for chat rooms:
26
  CHAT_ROOMS = {} # { room_id: { admin_session, active_sessions, settings, created_at, expires_at } }
@@ -165,7 +166,8 @@ def index():
165
  "QR code generation",
166
  "Analytics tracking",
167
  "Short URLs",
168
- "Self-destruct messages"
 
169
  ]
170
  })
171
 
@@ -698,6 +700,7 @@ def not_found(error):
698
  def internal_error(error):
699
  return jsonify({"error": "Internal server error"}), 500
700
 
 
701
  if __name__ == "__main__":
702
  print("πŸ” Sharelock Backend Starting...")
703
  print("πŸ“Š Features enabled:")
@@ -710,7 +713,8 @@ if __name__ == "__main__":
710
  print(" βœ… Multiple themes")
711
  print(" βœ… Password hints")
712
  print(" βœ… verify_only parameter support")
713
- print(" βœ… Real-time chat rooms") # ADD THIS LINE
714
  print("πŸš€ Server running on http://0.0.0.0:7860")
715
 
716
- socketio.run(app, host="0.0.0.0", port=7860, debug=True) # CHANGE THIS LINE
 
 
20
  app = Flask(__name__)
21
  CORS(app)
22
 
23
+ # FIX: Configure SocketIO for production deployment
24
+ socketio = SocketIO(app, cors_allowed_origins="*", async_mode='threading', logger=False, engineio_logger=False)
25
 
26
  # ADD THIS new storage for chat rooms:
27
  CHAT_ROOMS = {} # { room_id: { admin_session, active_sessions, settings, created_at, expires_at } }
 
166
  "QR code generation",
167
  "Analytics tracking",
168
  "Short URLs",
169
+ "Self-destruct messages",
170
+ "Real-time chat rooms"
171
  ]
172
  })
173
 
 
700
  def internal_error(error):
701
  return jsonify({"error": "Internal server error"}), 500
702
 
703
+ # FIX: Modified startup section
704
  if __name__ == "__main__":
705
  print("πŸ” Sharelock Backend Starting...")
706
  print("πŸ“Š Features enabled:")
 
713
  print(" βœ… Multiple themes")
714
  print(" βœ… Password hints")
715
  print(" βœ… verify_only parameter support")
716
+ print(" βœ… Real-time chat rooms")
717
  print("πŸš€ Server running on http://0.0.0.0:7860")
718
 
719
+ # FIX: Add allow_unsafe_werkzeug=True for HuggingFace Spaces
720
+ socketio.run(app, host="0.0.0.0", port=7860, debug=False, allow_unsafe_werkzeug=True)