Compare commits

...

3 Commits

Author SHA1 Message Date
Fabian Dill
6f12caf55e Update MultiServer.py 2025-08-26 21:04:50 +02:00
Fabian Dill
ad7d2157c3 add notify_client_without_auth to send messages to not authenticated clients 2025-08-26 13:57:14 +02:00
Fabian Dill
27ed50ff1b MultiServer: prevent GetDataPackage if PerMessageDeflate is not supported. 2025-08-22 18:03:23 +02:00

View File

@@ -413,6 +413,12 @@ class Context:
self.logger.info("Notice (Player %s in team %d): %s" % (client.name, client.team + 1, text))
async_start(self.send_msgs(client, [{"cmd": "PrintJSON", "data": [{ "text": text }], **additional_arguments}]))
def notify_client_without_auth(self, client: Client, text: str, additional_arguments: dict = {}):
if client.auth:
return self.notify_client(client, text, additional_arguments)
self.logger.info("Notice (Unauthenticated Player): " + text)
async_start(self.send_msgs(client, [{"cmd": "PrintJSON", "data": [{ "text": text }], **additional_arguments}]))
def notify_client_multiple(self, client: Client, texts: typing.List[str], additional_arguments: dict = {}):
if not client.auth or client.no_text:
return
@@ -1858,6 +1864,13 @@ async def process_client_cmd(ctx: Context, client: Client, args: dict):
await ctx.send_msgs(client, reply)
elif cmd == "GetDataPackage":
if not any(isinstance(extension, PerMessageDeflate) for extension in client.socket.extensions):
ctx.notify_client_without_auth(
client,
"Warning: your client does not support compressed websocket connections! "
"DataPackage (item and location names) were rejected to be transferred."
)
return
exclusions = args.get("exclusions", [])
if "games" in args:
games = {name: game_data for name, game_data in ctx.gamespackage.items()