mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-09 18:00:33 +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")
|
bot.logger.info("Trying login")
|
||||||
when (val response: LoginPacket.LoginPacketResponse = LoginPacket.SubCommand9(bot.client).sendAndExpect()) {
|
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 -> when (response) {
|
||||||
is Captcha.Picture -> {
|
is Captcha.Picture -> {
|
||||||
bot.logger.info("需要图片验证码")
|
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.ECDH
|
||||||
import net.mamoe.mirai.utils.cryptor.contentToString
|
import net.mamoe.mirai.utils.cryptor.contentToString
|
||||||
import net.mamoe.mirai.utils.cryptor.decryptBy
|
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.getValue
|
||||||
import net.mamoe.mirai.utils.io.*
|
import net.mamoe.mirai.utils.io.*
|
||||||
import net.mamoe.mirai.utils.unsafeWeakRef
|
import net.mamoe.mirai.utils.unsafeWeakRef
|
||||||
@ -54,7 +53,7 @@ internal open class QQAndroidClient(
|
|||||||
"tgtgtKey" to tgtgtKey,
|
"tgtgtKey" to tgtgtKey,
|
||||||
"tgtKey" to wLoginSigInfo.tgtKey,
|
"tgtKey" to wLoginSigInfo.tgtKey,
|
||||||
"deviceToken" to wLoginSigInfo.deviceToken,
|
"deviceToken" to wLoginSigInfo.deviceToken,
|
||||||
"shareKeyCalculatedByConstPubKey" to ecdh.calculateShareKeyByPeerPublicKey(initialPublicKey)
|
"shareKeyCalculatedByConstPubKey" to ecdh.keyPair.shareKey
|
||||||
//"t108" to wLoginSigInfo.t1,
|
//"t108" to wLoginSigInfo.t1,
|
||||||
//"t10c" to t10c,
|
//"t10c" to t10c,
|
||||||
//"t163" to t163
|
//"t163" to t163
|
||||||
@ -287,8 +286,8 @@ internal fun parsePSKeyMapAndPt4TokenMap(data: ByteArray, creationTime: Long, ex
|
|||||||
val pt4token = readUShortLVByteArray()
|
val pt4token = readUShortLVByteArray()
|
||||||
|
|
||||||
when {
|
when {
|
||||||
psKey.size > 0 -> outPSKeyMap[domain] = PSKey(psKey, creationTime, expireTime)
|
psKey.isNotEmpty() -> outPSKeyMap[domain] = PSKey(psKey, creationTime, expireTime)
|
||||||
pt4token.size > 0 -> outPt4TokenMap[domain] = Pt4Token(pt4token, creationTime, expireTime)
|
pt4token.isNotEmpty() -> outPt4TokenMap[domain] = Pt4Token(pt4token, creationTime, expireTime)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -203,17 +203,24 @@ internal object LoginPacket : PacketFactory<LoginPacket.LoginPacketResponse>("wt
|
|||||||
) : LoginPacketResponse()
|
) : LoginPacketResponse()
|
||||||
|
|
||||||
sealed class Captcha : LoginPacketResponse() {
|
sealed class Captcha : LoginPacketResponse() {
|
||||||
lateinit var answer: String
|
|
||||||
|
|
||||||
class Slider(
|
class Slider(
|
||||||
val data: IoBuffer,
|
val data: IoBuffer,
|
||||||
val sign: ByteArray
|
val sign: ByteArray
|
||||||
) : Captcha()
|
) : Captcha(){
|
||||||
|
override fun toString(): String {
|
||||||
|
return "LoginPacketResponse.Captcha.Slider"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class Picture(
|
class Picture(
|
||||||
val data: IoBuffer,
|
val data: IoBuffer,
|
||||||
val sign: ByteArray
|
val sign: ByteArray
|
||||||
) : Captcha()
|
) : Captcha(){
|
||||||
|
override fun toString(): String {
|
||||||
|
return "LoginPacketResponse.Captcha.Picture"
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class UnsafeLogin(val url: String) : LoginPacketResponse()
|
class UnsafeLogin(val url: String) : LoginPacketResponse()
|
||||||
|
Loading…
Reference in New Issue
Block a user