mirror of
https://github.com/mamoe/mirai.git
synced 2025-02-27 12:40:10 +08:00
[core] enable qrcode login for macos
This commit is contained in:
parent
c514f0f739
commit
10814f2b3c
@ -38,7 +38,7 @@ internal interface QRCodeLoginProcessor {
|
||||
fun parse(ssoContext: SsoProcessorContext, logger: MiraiLogger): QRCodeLoginProcessor {
|
||||
if (!ssoContext.bot.configuration.doQRCodeLogin) return NOOP
|
||||
check(ssoContext.bot.configuration.protocol.asInternal.canDoQRCodeLogin) {
|
||||
"The login protocol must be ANDROID_WATCH while enabling qrcode login." +
|
||||
"The login protocol must be ANDROID_WATCH or MACOS while enabling qrcode login." +
|
||||
"Set it by `bot.configuration.protocol = BotConfiguration.MiraiProtocol.ANDROID_WATCH`."
|
||||
}
|
||||
return QRCodeLoginProcessorPreLoaded(ssoContext, logger)
|
||||
|
@ -685,9 +685,9 @@ internal class WtLogin {
|
||||
t1b()
|
||||
t1d(client.miscBitMap)
|
||||
|
||||
// TODO macos
|
||||
if (client.bot.configuration.protocol == BotConfiguration.MiraiProtocol.MACOS) {
|
||||
t1f(
|
||||
val protocol = client.bot.configuration.protocol
|
||||
when(protocol) {
|
||||
BotConfiguration.MiraiProtocol.MACOS -> t1f(
|
||||
false,
|
||||
"Mac OSX".toByteArray(),
|
||||
"10".toByteArray(),
|
||||
@ -695,8 +695,7 @@ internal class WtLogin {
|
||||
client.device.apn,
|
||||
2
|
||||
)
|
||||
} else {
|
||||
t1f(
|
||||
BotConfiguration.MiraiProtocol.ANDROID_WATCH -> t1f(
|
||||
false,
|
||||
client.device.osType,
|
||||
"7.1.2".toByteArray(),
|
||||
@ -704,11 +703,15 @@ internal class WtLogin {
|
||||
client.device.apn,
|
||||
2
|
||||
)
|
||||
else -> error("protocol $protocol doesn't support qrcode login.")
|
||||
}
|
||||
|
||||
t33(client.device.guid)
|
||||
// TODO macos
|
||||
t35(if (client.bot.configuration.protocol == BotConfiguration.MiraiProtocol.MACOS) 5 else 8)
|
||||
t35(when(protocol) {
|
||||
BotConfiguration.MiraiProtocol.MACOS -> 5
|
||||
BotConfiguration.MiraiProtocol.ANDROID_WATCH -> 8
|
||||
else -> error("protocol $protocol doesn't support qrcode login.")
|
||||
})
|
||||
}
|
||||
writeByte(0)
|
||||
writeShort(code2dPacket.remaining.toShort())
|
||||
|
@ -96,6 +96,7 @@ internal class MiraiProtocolInternal(
|
||||
"com.tencent.qq".encodeToByteArray().toUHexString(" "),
|
||||
0L,
|
||||
7,
|
||||
canDoQRCodeLogin = true,
|
||||
)
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user