mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-03 01:39:35 +08:00
修改设备锁验证方式,改为通过点击超链接弹出页面
This commit is contained in:
parent
9f4e24ca9e
commit
9b53fb99ad
@ -0,0 +1,26 @@
|
||||
package net.mamoe.mirai.utils
|
||||
|
||||
import java.awt.Desktop
|
||||
import java.awt.event.MouseAdapter
|
||||
import java.awt.event.MouseEvent
|
||||
import java.net.URI
|
||||
import javax.swing.JLabel
|
||||
|
||||
/**
|
||||
* 构造方法中url指代用户需要点击的链接, text为显示的提示内容
|
||||
*/
|
||||
class HyperLinkLabel constructor(url :String, text :String) : JLabel() {
|
||||
init {
|
||||
super.setText("<html><a href='$url'>$text</a></html>");
|
||||
addMouseListener(object : MouseAdapter() {
|
||||
|
||||
override fun mouseClicked(e: MouseEvent) {
|
||||
try {
|
||||
Desktop.getDesktop().browse(URI(url))
|
||||
} catch (ex: Exception) {
|
||||
ex.printStackTrace()
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
@ -38,18 +38,8 @@ object SwingSolver : LoginSolver() {
|
||||
|
||||
override suspend fun onSolveUnsafeDeviceLoginVerify(bot: Bot, url: String): String? {
|
||||
return openWindow("Mirai UnsafeDeviceLoginVerify(${bot.id})") {
|
||||
JLabel(
|
||||
"""
|
||||
<html>
|
||||
需要进行账户安全认证<br>
|
||||
该账户有[设备锁]/[不常用登录地点]/[不常用设备登录]的问题<br>
|
||||
完成以下账号认证即可成功登录|理论本认证在mirai每个账户中最多出现1次<br>
|
||||
请将该链接在QQ浏览器中打开并完成认证<br>
|
||||
成功后请关闭该窗口<br>
|
||||
这步操作将在后续的版本中优化
|
||||
""".trimIndent()
|
||||
).last()
|
||||
JTextField(url).append()
|
||||
HyperLinkLabel(url, "设备锁验证").last()
|
||||
JTextField("点击下方链接进行设备锁验证, 验证通过后关闭本窗口").append()
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user