Update app.py
Browse files
app.py
CHANGED
@@ -20,7 +20,8 @@ import threading
|
|
20 |
app = Flask(__name__)
|
21 |
CORS(app)
|
22 |
|
23 |
-
|
|
|
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")
|
714 |
print("π Server running on http://0.0.0.0:7860")
|
715 |
|
716 |
-
|
|
|
|
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)
|