mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-09-06 17:59:48 +00:00
More broken mess to spawn 1.2
This commit is contained in:
@ -27,6 +27,7 @@ namespace pocketmine\network\mcpe\protocol;
|
||||
|
||||
|
||||
use pocketmine\network\mcpe\NetworkSession;
|
||||
use pocketmine\utils\Utils;
|
||||
|
||||
class LoginPacket extends DataPacket{
|
||||
const NETWORK_ID = ProtocolInfo::LOGIN_PACKET;
|
||||
@ -35,7 +36,6 @@ class LoginPacket extends DataPacket{
|
||||
|
||||
public $username;
|
||||
public $protocol;
|
||||
public $gameEdition;
|
||||
public $clientUUID;
|
||||
public $clientId;
|
||||
public $identityPublicKey;
|
||||
@ -63,13 +63,11 @@ class LoginPacket extends DataPacket{
|
||||
return; //Do not attempt to decode for non-accepted protocols
|
||||
}
|
||||
|
||||
$this->gameEdition = $this->getByte();
|
||||
|
||||
$this->setBuffer($this->getString(), 0);
|
||||
|
||||
$this->chainData = json_decode($this->get($this->getLInt()), true);
|
||||
foreach($this->chainData["chain"] as $chain){
|
||||
$webtoken = $this->decodeToken($chain);
|
||||
$webtoken = Utils::decodeJWT($chain);
|
||||
if(isset($webtoken["extraData"])){
|
||||
if(isset($webtoken["extraData"]["displayName"])){
|
||||
$this->username = $webtoken["extraData"]["displayName"];
|
||||
@ -84,7 +82,7 @@ class LoginPacket extends DataPacket{
|
||||
}
|
||||
|
||||
$this->clientDataJwt = $this->get($this->getLInt());
|
||||
$this->clientData = $this->decodeToken($this->clientDataJwt);
|
||||
$this->clientData = Utils::decodeJWT($this->clientDataJwt);
|
||||
|
||||
$this->clientId = $this->clientData["ClientRandomId"] ?? null;
|
||||
$this->serverAddress = $this->clientData["ServerAddress"] ?? null;
|
||||
@ -99,12 +97,6 @@ class LoginPacket extends DataPacket{
|
||||
//TODO
|
||||
}
|
||||
|
||||
public function decodeToken($token){
|
||||
list($headB64, $payloadB64, $sigB64) = explode(".", $token);
|
||||
|
||||
return json_decode(base64_decode($payloadB64), true);
|
||||
}
|
||||
|
||||
public function handle(NetworkSession $session) : bool{
|
||||
return $session->handleLogin($this);
|
||||
}
|
||||
|
Reference in New Issue
Block a user