[core] Fix token not saving after refresh token (#2590)

This commit is contained in:
sandtechnology 2023-03-25 22:08:20 +08:00 committed by GitHub
parent 3b8534468d
commit 0f1bddcb24
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View File

@ -67,5 +67,8 @@ internal class KeyRefreshProcessorImpl(
override suspend fun refreshKeysNow(handler: NetworkHandler) {
handler.sendAndExpect(WtLogin15(handler.context[SsoProcessor].client))
handler.context[SsoProcessor].client.bot.apply {
components[AccountSecretsManager].saveSecrets(account, AccountSecretsImpl(client))
}
}
}

View File

@ -12,6 +12,8 @@ package net.mamoe.mirai.internal.network.protocol.packet.chat.receive
import io.ktor.utils.io.core.*
import net.mamoe.mirai.internal.QQAndroidBot
import net.mamoe.mirai.internal.network.Packet
import net.mamoe.mirai.internal.network.components.AccountSecretsImpl
import net.mamoe.mirai.internal.network.components.AccountSecretsManager
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
@ -23,6 +25,7 @@ internal object OnlinePushSidExpired :
override suspend fun QQAndroidBot.handle(packet: Packet?, sequenceId: Int): OutgoingPacket {
return buildResponseUniPacket(client, sequenceId = sequenceId).also {
bot.network.sendAndExpect(WtLogin10(client, mainSigMap = 1052896, remark = "10:refresh-token"))
bot.components[AccountSecretsManager].saveSecrets(bot.account, AccountSecretsImpl(client))
}
}