mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-08 17:20:11 +08:00
Merge remote-tracking branch 'origin/master'
# Conflicts: # mirai-core-qqandroid/src/commonMain/kotlin/net/mamoe/mirai/qqandroid/network/QQAndroidBotNetworkHandler.kt
This commit is contained in:
commit
2d4e5ae939
@ -34,14 +34,6 @@ internal class QQAndroidBotNetworkHandler(bot: QQAndroidBot) : BotNetworkHandler
|
||||
|
||||
bot.logger.info("Trying login")
|
||||
when (val response: LoginPacket.LoginPacketResponse = LoginPacket.SubCommand9(bot.client).sendAndExpect()) {
|
||||
is UnsafeLogin -> {
|
||||
bot.logger.info("Login unsuccessful, device auth is needed")
|
||||
bot.logger.info("登陆失败, 原因为非常用设备登陆")
|
||||
bot.logger.info("Open the following URL in QQ browser and complete the verification")
|
||||
bot.logger.info("将下面这个链接在QQ浏览器中打开并完成认证后尝试再次登陆")
|
||||
bot.logger.info(response.url)
|
||||
return
|
||||
}
|
||||
is Captcha -> when (response) {
|
||||
is Captcha.Picture -> {
|
||||
bot.logger.info("需要图片验证码")
|
||||
|
@ -15,7 +15,6 @@ import net.mamoe.mirai.utils.MiraiInternalAPI
|
||||
import net.mamoe.mirai.utils.cryptor.ECDH
|
||||
import net.mamoe.mirai.utils.cryptor.contentToString
|
||||
import net.mamoe.mirai.utils.cryptor.decryptBy
|
||||
import net.mamoe.mirai.utils.cryptor.initialPublicKey
|
||||
import net.mamoe.mirai.utils.getValue
|
||||
import net.mamoe.mirai.utils.io.*
|
||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||
@ -54,7 +53,7 @@ internal open class QQAndroidClient(
|
||||
"tgtgtKey" to tgtgtKey,
|
||||
"tgtKey" to wLoginSigInfo.tgtKey,
|
||||
"deviceToken" to wLoginSigInfo.deviceToken,
|
||||
"shareKeyCalculatedByConstPubKey" to ecdh.calculateShareKeyByPeerPublicKey(initialPublicKey)
|
||||
"shareKeyCalculatedByConstPubKey" to ecdh.keyPair.shareKey
|
||||
//"t108" to wLoginSigInfo.t1,
|
||||
//"t10c" to t10c,
|
||||
//"t163" to t163
|
||||
@ -287,8 +286,8 @@ internal fun parsePSKeyMapAndPt4TokenMap(data: ByteArray, creationTime: Long, ex
|
||||
val pt4token = readUShortLVByteArray()
|
||||
|
||||
when {
|
||||
psKey.size > 0 -> outPSKeyMap[domain] = PSKey(psKey, creationTime, expireTime)
|
||||
pt4token.size > 0 -> outPt4TokenMap[domain] = Pt4Token(pt4token, creationTime, expireTime)
|
||||
psKey.isNotEmpty() -> outPSKeyMap[domain] = PSKey(psKey, creationTime, expireTime)
|
||||
pt4token.isNotEmpty() -> outPt4TokenMap[domain] = Pt4Token(pt4token, creationTime, expireTime)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -203,17 +203,24 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
|
||||
) : LoginPacketResponse()
|
||||
|
||||
sealed class Captcha : LoginPacketResponse() {
|
||||
lateinit var answer: String
|
||||
|
||||
class Slider(
|
||||
val data: IoBuffer,
|
||||
val sign: ByteArray
|
||||
) : Captcha()
|
||||
) : Captcha(){
|
||||
override fun toString(): String {
|
||||
return "LoginPacketResponse.Captcha.Slider"
|
||||
}
|
||||
}
|
||||
|
||||
class Picture(
|
||||
val data: IoBuffer,
|
||||
val sign: ByteArray
|
||||
) : Captcha()
|
||||
) : Captcha(){
|
||||
override fun toString(): String {
|
||||
return "LoginPacketResponse.Captcha.Picture"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class UnsafeLogin(val url: String) : LoginPacketResponse()
|
||||
@ -276,7 +283,7 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
|
||||
|
||||
@InternalAPI
|
||||
@UseExperimental(MiraiDebugAPI::class)
|
||||
private suspend fun onSolveLoginCaptcha(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse.Captcha {
|
||||
private suspend fun onSolveLoginCaptcha(tlvMap: Map<Int, ByteArray>, bot: QQAndroidBot): LoginPacketResponse. Captcha {
|
||||
val client = bot.client
|
||||
// val ret = tlvMap[0x104]?.let { println(it.toUHexString()) }
|
||||
println()
|
||||
|
Loading…
Reference in New Issue
Block a user