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