Backwards compatibilty with 2.1.0

This commit is contained in:
Christoph Stahl 2025-06-16 23:13:23 +02:00
parent 4760076963
commit 72c70c03ec

View file

@ -1027,17 +1027,17 @@ class Server:
:rtype: None :rtype: None
""" """
if "version" not in data: # if "version" not in data:
await self.sio.emit( # await self.sio.emit(
"client-registered", # "client-registered",
{"success": False, "room": None, "reason": "NO_VERSION"}, # {"success": False, "room": None, "reason": "NO_VERSION"},
room=sid, # room=sid,
) # )
return # return
#
client_version = tuple(data["version"]) # client_version = tuple(data["version"])
if not await self.check_client_version(client_version, sid): # if not await self.check_client_version(client_version, sid):
return # return
def gen_id(length: int = 4) -> str: def gen_id(length: int = 4) -> str:
client_id = "".join([random.choice(string.ascii_letters) for _ in range(length)]) client_id = "".join([random.choice(string.ascii_letters) for _ in range(length)])
@ -1223,10 +1223,12 @@ class Server:
:rtype: None :rtype: None
""" """
logger.debug("Client %s connected", sid) logger.debug("Client %s connected", sid)
logger.debug("Data: %s", auth)
if auth is None or "type" not in auth: if auth is None or "type" not in auth:
logger.warning("Client %s connected without auth data", sid) logger.warning(
raise ConnectionRefusedError("No authentication data provided. Please register first.") "Client %s connected without auth data, fall back to old registration", sid
)
return
# raise ConnectionRefusedError("No authentication data provided. Please register first.")
match auth["type"]: match auth["type"]:
case "playback": case "playback":