Commit 13460b93 authored by jiahua.liu's avatar jiahua.liu

Mirai Console Fix

parent bb244a8e
......@@ -117,7 +117,8 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
}
}
pushLog(0, "[Login Solver]请输入 4 位字母验证码. 若要更换验证码, 请直接回车")
return requestInput("[Login Solver]请输入 4 位字母验证码. 若要更换验证码, 请直接回车")!!.takeUnless { it.isEmpty() || it.length != 4 }
return requestInput("[Login Solver]请输入 4 位字母验证码. 若要更换验证码, 请直接回车")!!
.takeUnless { it.isEmpty() || it.length != 4 }
.also {
pushLog(0, "[Login Solver]正在提交[$it]中...")
}
......@@ -133,7 +134,6 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
}
}
override suspend fun onSolveUnsafeDeviceLoginVerify(bot: Bot, url: String): String? {
pushLog(0, "[Login Solver]需要进行账户安全认证")
pushLog(0, "[Login Solver]该账户有[设备锁]/[不常用登陆地点]/[不常用设备登陆]的问题")
......@@ -235,6 +235,7 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
var lastJob: Job? = null
terminal.addResizeListener(TerminalResizeListener { terminal1: Terminal, newSize: TerminalSize ->
lastJob = GlobalScope.launch {
try {
delay(300)
if (lastJob == coroutineContext[Job]) {
terminal.clearScreen()
......@@ -243,6 +244,9 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
redrawCommand()
redrawLogs(log[screens[currentScreenId]]!!)
}
} catch (e: Exception) {
pushLog(0, "[UI ERROR] ${e.message}")
}
}
})
......@@ -264,11 +268,16 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
System.setErr(System.out)
try {
update()
} catch (e: Exception) {
pushLog(0, "[UI ERROR] ${e.message}")
}
val charList = listOf(',', '.', '/', '@', '#', '$', '%', '^', '&', '*', '(', ')', '_', '=', '+', '!', ' ')
thread {
while (true) {
try {
var keyStroke: KeyStroke = terminal.readInput()
when (keyStroke.keyType) {
......@@ -304,6 +313,9 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
}
}
}
} catch (e: Exception) {
pushLog(0, "[UI ERROR] ${e.message}")
}
}
}
}
......@@ -542,6 +554,7 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
terminal.flush()
} else {
lastEmpty = GlobalScope.launch {
try {
delay(100)
if (lastEmpty == coroutineContext[Job]) {
terminal.clearScreen()
......@@ -550,6 +563,9 @@ object MiraiConsoleTerminalUI : MiraiConsoleUI {
redrawCommand()
redrawLogs(log[screens[currentScreenId]]!!)
}
} catch (e: Exception) {
pushLog(0, "[UI ERROR] ${e.message}")
}
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment