Update app.py
Browse files
app.py
CHANGED
|
@@ -751,7 +751,7 @@ def create_chat_room():
|
|
| 751 |
form = request.form
|
| 752 |
ttl = int(form.get("ttl", 3600))
|
| 753 |
max_receivers = int(form.get("max_receivers", 5))
|
| 754 |
-
|
| 755 |
allow_files = form.get("allow_files", "true").lower() == "true"
|
| 756 |
admin_public_key = form.get("admin_public_key", "") # NEW: ECDSA public key
|
| 757 |
|
|
@@ -781,7 +781,7 @@ def create_chat_room():
|
|
| 781 |
"expires_at": expires_at,
|
| 782 |
"settings": {
|
| 783 |
"max_receivers": max_receivers,
|
| 784 |
-
|
| 785 |
"allow_files": allow_files,
|
| 786 |
"burn_on_admin_exit": True
|
| 787 |
},
|
|
@@ -814,7 +814,7 @@ def handle_register_receiver(data):
|
|
| 814 |
room_id = data.get("room_id")
|
| 815 |
receiver_token = data.get("receiver_token")
|
| 816 |
ecdsa_public_key = data.get("ecdsa_public_key")
|
| 817 |
-
|
| 818 |
|
| 819 |
print(f"\n{'='*60}")
|
| 820 |
print(f"🔵 WEBSOCKET: register_receiver")
|
|
@@ -839,11 +839,7 @@ def handle_register_receiver(data):
|
|
| 839 |
emit('registration_error', {"error": "Chat room has expired"})
|
| 840 |
return
|
| 841 |
|
| 842 |
-
|
| 843 |
-
room_password = room["settings"].get("password", "")
|
| 844 |
-
if room_password and password != room_password:
|
| 845 |
-
emit('registration_error', {"error": "Wrong password"})
|
| 846 |
-
return
|
| 847 |
|
| 848 |
# Find the token
|
| 849 |
token_data = None
|
|
@@ -903,7 +899,7 @@ def handle_register_admin(data):
|
|
| 903 |
room_id = data.get("room_id")
|
| 904 |
admin_session = data.get("admin_session")
|
| 905 |
ecdsa_public_key = data.get("ecdsa_public_key")
|
| 906 |
-
|
| 907 |
|
| 908 |
print(f"\n{'='*60}")
|
| 909 |
print(f"🔵 WEBSOCKET: register_admin")
|
|
@@ -933,11 +929,7 @@ def handle_register_admin(data):
|
|
| 933 |
emit('registration_error', {"error": "Invalid admin session"})
|
| 934 |
return
|
| 935 |
|
| 936 |
-
|
| 937 |
-
room_password = room["settings"].get("password", "")
|
| 938 |
-
if room_password and password != room_password:
|
| 939 |
-
emit('registration_error', {"error": "Wrong password"})
|
| 940 |
-
return
|
| 941 |
|
| 942 |
# Check if this is first join (key should match)
|
| 943 |
if ecdsa_public_key == room["admin_ecdsa_public_key"]:
|
|
|
|
| 751 |
form = request.form
|
| 752 |
ttl = int(form.get("ttl", 3600))
|
| 753 |
max_receivers = int(form.get("max_receivers", 5))
|
| 754 |
+
|
| 755 |
allow_files = form.get("allow_files", "true").lower() == "true"
|
| 756 |
admin_public_key = form.get("admin_public_key", "") # NEW: ECDSA public key
|
| 757 |
|
|
|
|
| 781 |
"expires_at": expires_at,
|
| 782 |
"settings": {
|
| 783 |
"max_receivers": max_receivers,
|
| 784 |
+
|
| 785 |
"allow_files": allow_files,
|
| 786 |
"burn_on_admin_exit": True
|
| 787 |
},
|
|
|
|
| 814 |
room_id = data.get("room_id")
|
| 815 |
receiver_token = data.get("receiver_token")
|
| 816 |
ecdsa_public_key = data.get("ecdsa_public_key")
|
| 817 |
+
|
| 818 |
|
| 819 |
print(f"\n{'='*60}")
|
| 820 |
print(f"🔵 WEBSOCKET: register_receiver")
|
|
|
|
| 839 |
emit('registration_error', {"error": "Chat room has expired"})
|
| 840 |
return
|
| 841 |
|
| 842 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 843 |
|
| 844 |
# Find the token
|
| 845 |
token_data = None
|
|
|
|
| 899 |
room_id = data.get("room_id")
|
| 900 |
admin_session = data.get("admin_session")
|
| 901 |
ecdsa_public_key = data.get("ecdsa_public_key")
|
| 902 |
+
|
| 903 |
|
| 904 |
print(f"\n{'='*60}")
|
| 905 |
print(f"🔵 WEBSOCKET: register_admin")
|
|
|
|
| 929 |
emit('registration_error', {"error": "Invalid admin session"})
|
| 930 |
return
|
| 931 |
|
| 932 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
| 933 |
|
| 934 |
# Check if this is first join (key should match)
|
| 935 |
if ecdsa_public_key == room["admin_ecdsa_public_key"]:
|