mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-21 13:54:43 +08:00
OnlinePush.SidTicketExpired: Refresh token and register online (#1242)
* OnlinePush.SidTicketExpired: Refresh token and register online * Also update key map * Update package name to internal Co-authored-by: Him188 <Him188@mamoe.net> * Fix build Co-authored-by: Him188 <Him188@mamoe.net>
This commit is contained in:
parent
6854252c77
commit
e459c76f92
@ -169,6 +169,7 @@ internal object KnownPacketFactories {
|
||||
OnlinePushPbPushGroupMsg,
|
||||
OnlinePushReqPush,
|
||||
OnlinePushPbPushTransMsg,
|
||||
OnlinePushSidExpired,
|
||||
MessageSvcPushNotify,
|
||||
MessageSvcPushReaded,
|
||||
MessageSvcRequestPushStatus,
|
||||
|
@ -0,0 +1,38 @@
|
||||
/*
|
||||
* Copyright 2019-2021 Mamoe Technologies and contributors.
|
||||
*
|
||||
* 此源代码的使用受 GNU AFFERO GENERAL PUBLIC LICENSE version 3 许可证的约束, 可以在以下链接找到该许可证.
|
||||
* Use of this source code is governed by the GNU AGPLv3 license that can be found through the following link.
|
||||
*
|
||||
* https://github.com/mamoe/mirai/blob/master/LICENSE
|
||||
*/
|
||||
|
||||
package net.mamoe.mirai.internal.network.protocol.packet.chat.receive
|
||||
|
||||
import kotlinx.io.core.ByteReadPacket
|
||||
import net.mamoe.mirai.internal.QQAndroidBot
|
||||
import net.mamoe.mirai.internal.network.Packet
|
||||
import net.mamoe.mirai.internal.network.protocol.packet.IncomingPacketFactory
|
||||
import net.mamoe.mirai.internal.network.protocol.packet.OutgoingPacket
|
||||
import net.mamoe.mirai.internal.network.protocol.packet.buildResponseUniPacket
|
||||
import net.mamoe.mirai.internal.network.protocol.packet.login.StatSvc
|
||||
import net.mamoe.mirai.internal.network.protocol.packet.login.wtlogin.WtLogin10
|
||||
import net.mamoe.mirai.internal.network.protocol.packet.sendAndExpect
|
||||
|
||||
internal object OnlinePushSidExpired : IncomingPacketFactory<Packet?>("OnlinePush.SidTicketExpired") {
|
||||
|
||||
override suspend fun QQAndroidBot.handle(packet: Packet?, sequenceId: Int): OutgoingPacket {
|
||||
return buildResponseUniPacket(
|
||||
client,
|
||||
sequenceId = sequenceId,
|
||||
key = client.wLoginSigInfo.d2Key
|
||||
) {}.also {
|
||||
WtLogin10(client, mainSigMap = 3554528).sendAndExpect(bot)
|
||||
StatSvc.Register.online(client).sendAndExpect(bot)
|
||||
}
|
||||
}
|
||||
|
||||
override suspend fun ByteReadPacket.decode(bot: QQAndroidBot, sequenceId: Int): Packet? {
|
||||
return null
|
||||
}
|
||||
}
|
@ -433,6 +433,8 @@ internal class WtLogin {
|
||||
} ?: encryptedDownloadSession
|
||||
encryptA1 = tlvMap119.getOrDefault(0x106, encryptA1)
|
||||
noPicSig = tlvMap119.getOrDefault(0x16a, noPicSig)
|
||||
psKeyMap.putAll(outPSKeyMap.orEmpty().toMutableMap())
|
||||
pt4TokenMap.putAll(outPt4TokenMap.orEmpty().toMutableMap())
|
||||
}
|
||||
} else {
|
||||
var a1: ByteArray? = tlvMap119.getOrFail(0x106)
|
||||
|
@ -24,6 +24,8 @@ internal object WtLogin10 : WtLoginExt {
|
||||
const val appId: Long = 16L
|
||||
operator fun invoke(
|
||||
client: QQAndroidClient,
|
||||
subAppId: Long = 100,
|
||||
mainSigMap: Int = client.mainSigMap
|
||||
) = WtLogin.ExchangeEmp.buildLoginOutgoingPacket(client, bodyType = 2, key = ByteArray(16)) { sequenceId ->
|
||||
writeSsoPacket(
|
||||
client,
|
||||
@ -39,7 +41,7 @@ internal object WtLogin10 : WtLoginExt {
|
||||
) {
|
||||
writeShort(11) // subCommand
|
||||
writeShort(17)
|
||||
t100(appId, 100, client.appClientVersion, client.ssoVersion, client.mainSigMap)
|
||||
t100(appId, subAppId, client.appClientVersion, client.ssoVersion, mainSigMap)
|
||||
t10a(client.wLoginSigInfo.tgt)
|
||||
t116(client.miscBitMap, client.subSigMap)
|
||||
t108(client.ksid)
|
||||
|
Loading…
Reference in New Issue
Block a user