mirror of
https://github.com/Grasscutters/Grasscutter.git
synced 2025-01-09 03:42:57 +08:00
Resume the app token exchanger (#2209)
This commit is contained in:
parent
e382c6d691
commit
c3339de184
@ -149,8 +149,7 @@ public class GameSession implements GameSessionManager.KcpChannel {
|
||||
@Override
|
||||
public void handleReceive(byte[] bytes) {
|
||||
// Decrypt and turn back into a packet
|
||||
if (this.getState() != SessionState.WAITING_FOR_TOKEN)
|
||||
Crypto.xor(bytes, useSecretKey() ? Crypto.ENCRYPT_KEY : Crypto.DISPATCH_KEY);
|
||||
Crypto.xor(bytes, useSecretKey() ? Crypto.ENCRYPT_KEY : Crypto.DISPATCH_KEY);
|
||||
ByteBuf packet = Unpooled.wrappedBuffer(bytes);
|
||||
|
||||
// Log
|
||||
|
@ -92,13 +92,15 @@ public final class RegionHandler implements Router {
|
||||
|
||||
// Create a region info object.
|
||||
var regionInfo =
|
||||
RegionInfo.newBuilder()
|
||||
.setGateserverIp(region.Ip)
|
||||
.setGateserverPort(region.Port)
|
||||
.setSecretKey(ByteString.copyFrom(Crypto.DISPATCH_SEED))
|
||||
.build();
|
||||
RegionInfo.newBuilder()
|
||||
.setGateserverIp(region.Ip)
|
||||
.setGateserverPort(region.Port)
|
||||
.build();
|
||||
// Create an updated region query.
|
||||
var updatedQuery = QueryCurrRegionHttpRsp.newBuilder().setRegionInfo(regionInfo).build();
|
||||
var updatedQuery = QueryCurrRegionHttpRsp.newBuilder()
|
||||
.setRegionInfo(regionInfo)
|
||||
.setClientSecretKey(ByteString.copyFrom(Crypto.DISPATCH_SEED))
|
||||
.build();
|
||||
regions.put(
|
||||
region.Name,
|
||||
new RegionData(
|
||||
|
@ -13,7 +13,6 @@ public class PacketGetPlayerTokenRsp extends BasePacket {
|
||||
super(PacketOpcodes.GetPlayerTokenRsp, true);
|
||||
|
||||
this.setUseDispatchKey(true);
|
||||
this.shouldEncrypt = false;
|
||||
|
||||
GetPlayerTokenRsp p =
|
||||
GetPlayerTokenRsp.newBuilder()
|
||||
@ -39,7 +38,6 @@ public class PacketGetPlayerTokenRsp extends BasePacket {
|
||||
super(PacketOpcodes.GetPlayerTokenRsp, true);
|
||||
|
||||
this.setUseDispatchKey(true);
|
||||
this.shouldEncrypt = false;
|
||||
|
||||
GetPlayerTokenRsp p =
|
||||
GetPlayerTokenRsp.newBuilder()
|
||||
@ -61,7 +59,6 @@ public class PacketGetPlayerTokenRsp extends BasePacket {
|
||||
super(PacketOpcodes.GetPlayerTokenRsp, true);
|
||||
|
||||
this.setUseDispatchKey(true);
|
||||
this.shouldEncrypt = false;
|
||||
|
||||
GetPlayerTokenRsp p =
|
||||
GetPlayerTokenRsp.newBuilder()
|
||||
|
@ -35,12 +35,12 @@ public class PacketPlayerLoginRsp extends BasePacket {
|
||||
RegionInfo.newBuilder()
|
||||
.setGateserverIp(lr(GAME_INFO.accessAddress, GAME_INFO.bindAddress))
|
||||
.setGateserverPort(lr(GAME_INFO.accessPort, GAME_INFO.bindPort))
|
||||
.setSecretKey(ByteString.copyFrom(Crypto.DISPATCH_SEED))
|
||||
.build();
|
||||
|
||||
regionCache =
|
||||
var regionCache =
|
||||
QueryCurrRegionHttpRspOuterClass.QueryCurrRegionHttpRsp.newBuilder()
|
||||
.setRegionInfo(serverRegion)
|
||||
.setClientSecretKey(ByteString.copyFrom(Crypto.DISPATCH_SEED))
|
||||
.build();
|
||||
} catch (Exception e) {
|
||||
Grasscutter.getLogger().error("Error while initializing region cache!", e);
|
||||
|
Loading…
Reference in New Issue
Block a user