Minor updates..

This commit is contained in:
Maxim Khomutov 2023-07-23 23:06:29 +03:00
parent 2368fec501
commit 43fd56f327
3 changed files with 17 additions and 15 deletions

View File

@ -112,7 +112,7 @@ class Client:
if not reason:
reason = "Kicked!"
else:
reason = f"{reason!r}"
reason = f"{reason}"
if not self.__alive:
self.log.debug(f"{self.nick}.kick('{reason}') skipped: Not alive;")
return

View File

@ -157,7 +157,6 @@ class Core:
"version": self.BeamMP_version, "clientversion": self.client_major_version,
"name": config.Server["name"], "modlist": modlist, "modstotalsize": modstotalsize,
"modstotal": modstotal, "playerslist": "", "desc": config.Server['description'], "pass": False}
self.log.debug(f"Auth: data {data}")
# Sentry?
ok = False
@ -169,7 +168,6 @@ class Core:
async with session.post(url, data=data, headers={"api-v": "2"}) as response:
code = response.status
body = await response.json()
self.log.debug(f"Auth: code {code}, body {body}")
ok = True
break
except Exception as e:
@ -183,15 +181,18 @@ class Core:
self.log.error("Missing/invalid json members in backend response")
raise KeyboardInterrupt
if test:
status = body.get("status")
msg = body.get("msg")
if status == "2000":
if test:
# TODO: i18n
self.log.info(f"Authenticated! {msg}")
elif status == "200":
if test:
self.log.info(f"Resumed authenticated session. {msg}")
else:
self.log.debug(f"Auth: data {data}")
self.log.debug(f"Auth: code {code}, body {body}")
self.log.error(f"Backend REFUSED the auth key. Reason: "
f"{msg or 'Backend did not provide a reason'}")
self.log.info(f"Server still runnig, but only in Direct connect mode.")

View File

@ -23,8 +23,9 @@ class UDPServer(asyncio.DatagramTransport):
self.port = port
self.run = False
def connection_made(self, transport):
...
def connection_made(self, *args, **kwargs): ...
def pause_writing(self, *args, **kwargs): ...
def resume_writing(self, *args, **kwargs): ...
async def handle_datagram(self, data, addr):
try: