mirror of
https://github.com/kuitoi/kuitoi-Server.git
synced 2025-08-17 08:15:42 +00:00
Compare commits
3 Commits
c1c18f4f3b
...
a057004cd2
Author | SHA1 | Date | |
---|---|---|---|
a057004cd2 | |||
f7defaed0c | |||
abd4fb60c1 |
@ -15,10 +15,13 @@ BeamingDrive Multiplayer (BeamMP) server compatible with BeamMP clients.
|
||||
- [x] Connecting to the world
|
||||
- [x] Chat
|
||||
- [ ] ABG: (compressed data)
|
||||
- [ ] Decompress data
|
||||
- [x] Decompress data
|
||||
- [ ] Vehicle data
|
||||
- [ ] Players synchronizations
|
||||
- [ ] UDP Server part:
|
||||
- [ ] Players synchronizations
|
||||
- [ ] Ping
|
||||
- [ ] Player counter
|
||||
- [x] Additional:
|
||||
- [x] Events System
|
||||
- [x] Plugins support
|
||||
|
@ -5,6 +5,7 @@
|
||||
# Licence: FPA
|
||||
# (c) kuitoi.su 2023
|
||||
import asyncio
|
||||
import zlib
|
||||
|
||||
from core import utils
|
||||
from .tcp_server import TCPServer
|
||||
@ -70,7 +71,6 @@ class Client:
|
||||
# if not self.is_disconnected():
|
||||
# self.log.debug(f"Client with {self.nick}({self.cid}) disconnected")
|
||||
# return b""
|
||||
|
||||
header = await self.reader.read(4) # header: 4 bytes
|
||||
|
||||
int_header = 0
|
||||
@ -88,17 +88,16 @@ class Client:
|
||||
return b""
|
||||
|
||||
data = await self.reader.read(101 * MB)
|
||||
self.log.debug(f"header: `{header}`; int_header: `{int_header}`; data: `{data}`;")
|
||||
|
||||
if len(data) != int_header:
|
||||
self.log.debug(f"WARN Expected to read {int_header} bytes, instead got {len(data)}")
|
||||
|
||||
# TODO: ABG: DeComp(Data)
|
||||
abg = b"ABG:"
|
||||
if len(data) > len(abg) and data.startswith(abg):
|
||||
data = data[len(abg):]
|
||||
return b""
|
||||
# return DeComp(Data);
|
||||
self.log.debug(f"header: `{header}`; int_header: `{int_header}`; data: `{data}`;")
|
||||
data = zlib.decompress(data[len(abg):])
|
||||
self.log.debug(f"ABG: {data}")
|
||||
return data
|
||||
return data
|
||||
|
||||
async def sync_resources(self):
|
||||
|
@ -27,10 +27,10 @@ class TCPServer:
|
||||
self.log.debug(f"recv1 data: {data}")
|
||||
if len(data) > 50:
|
||||
await client.kick("Too long data")
|
||||
return
|
||||
return False, None
|
||||
if "VC2.0" not in data.decode("utf-8"):
|
||||
await client.kick("Outdated Version.")
|
||||
return
|
||||
return False, None
|
||||
else:
|
||||
await client.tcp_send(b"A") # Accepted client version
|
||||
|
||||
@ -38,7 +38,7 @@ class TCPServer:
|
||||
self.log.debug(f"recv2 data: {data}")
|
||||
if len(data) > 50:
|
||||
await client.kick("Invalid Key (too long)!")
|
||||
return
|
||||
return False, None
|
||||
client.key = data.decode("utf-8")
|
||||
async with aiohttp.ClientSession() as session:
|
||||
url = 'https://auth.beammp.com/pkToUser'
|
||||
|
Loading…
x
Reference in New Issue
Block a user