Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
Mirai
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Mirai
Commits
8bdfad96
Commit
8bdfad96
authored
Jan 30, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix build
parent
c49406c2
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
24 additions
and
30 deletions
+24
-30
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/DefaultCaptchaSolverJvm.kt
...n/kotlin/net/mamoe/mirai/utils/DefaultCaptchaSolverJvm.kt
+23
-25
mirai-demos/mirai-demo-android/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
...roid/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
+1
-5
No files found.
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/DefaultCaptchaSolverJvm.kt
View file @
8bdfad96
...
@@ -29,36 +29,34 @@ actual var defaultLoginSolver: LoginSolver = DefaultLoginSolver()
...
@@ -29,36 +29,34 @@ actual var defaultLoginSolver: LoginSolver = DefaultLoginSolver()
class
DefaultLoginSolver
:
LoginSolver
()
{
class
DefaultLoginSolver
:
LoginSolver
()
{
override
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
IoBuffer
):
String
?
{
override
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
IoBuffer
):
String
?
=
loginSolverLock
.
withLock
{
loginSolverLock
.
withLock
{
val
tempFile
:
File
=
createTempFile
(
suffix
=
".png"
).
apply
{
deleteOnExit
()
}
val
tempFile
:
File
=
createTempFile
(
suffix
=
".png"
).
apply
{
deleteOnExit
()
}
withContext
(
Dispatchers
.
IO
)
{
withContext
(
Dispatchers
.
IO
)
{
tempFile
.
createNewFile
()
tempFile
.
createNewFile
()
bot
.
logger
.
info
(
"需要图片验证码登录, 验证码为 4 字母"
)
bot
.
logger
.
info
(
"需要图片验证码登录, 验证码为 4 字母"
)
try
{
try
{
tempFile
.
writeChannel
().
use
{
writeFully
(
data
)
}
tempFile
.
writeChannel
().
use
{
writeFully
(
data
)
}
bot
.
logger
.
info
(
"将会显示字符图片. 若看不清字符图片, 请查看文件 ${tempFile.absolutePath}"
)
bot
.
logger
.
info
(
"将会显示字符图片. 若看不清字符图片, 请查看文件 ${tempFile.absolutePath}"
)
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
bot
.
logger
.
info
(
"无法写出验证码文件(${e.message}), 请尝试查看以上字符图片"
)
bot
.
logger
.
info
(
"无法写出验证码文件(${e.message}), 请尝试查看以上字符图片"
)
}
}
tempFile
.
inputStream
().
use
{
tempFile
.
inputStream
().
use
{
val
img
=
ImageIO
.
read
(
it
)
val
img
=
ImageIO
.
read
(
it
)
if
(
img
==
null
)
{
if
(
img
==
null
)
{
bot
.
logger
.
info
(
"无法创建字符图片. 请查看文件"
)
bot
.
logger
.
info
(
"无法创建字符图片. 请查看文件"
)
}
else
{
}
else
{
bot
.
logger
.
info
(
img
.
createCharImg
())
bot
.
logger
.
info
(
img
.
createCharImg
())
}
}
}
}
}
bot
.
logger
.
info
(
"请输入 4 位字母验证码. 若要更换验证码, 请直接回车"
)
}
return
readLine
()
?.
takeUnless
{
it
.
isEmpty
()
||
it
.
length
!=
4
}.
also
{
bot
.
logger
.
info
(
"请输入 4 位字母验证码. 若要更换验证码, 请直接回车"
)
bot
.
logger
.
info
(
"正在提交[$it]中..."
)
return
readLine
()
?.
takeUnless
{
it
.
isEmpty
()
||
it
.
length
!=
4
}.
also
{
}
bot
.
logger
.
info
(
"正在提交[$it]中..."
)
}
}
}
}
override
suspend
fun
onSolveSliderCaptcha
(
bot
:
Bot
,
url
:
String
):
String
?
{
override
suspend
fun
onSolveSliderCaptcha
(
bot
:
Bot
,
url
:
String
):
String
?
=
loginSolverLock
.
withLock
{
bot
.
logger
.
info
(
"需要滑动验证码"
)
bot
.
logger
.
info
(
"需要滑动验证码"
)
bot
.
logger
.
info
(
"请在任意浏览器中打开以下链接并完成验证码. "
)
bot
.
logger
.
info
(
"请在任意浏览器中打开以下链接并完成验证码. "
)
bot
.
logger
.
info
(
"完成后请输入任意字符 "
)
bot
.
logger
.
info
(
"完成后请输入任意字符 "
)
...
@@ -68,7 +66,7 @@ class DefaultLoginSolver : LoginSolver() {
...
@@ -68,7 +66,7 @@ class DefaultLoginSolver : LoginSolver() {
}
}
}
}
override
suspend
fun
onSolveUnsafeDeviceLoginVerify
(
bot
:
Bot
,
url
:
String
):
String
?
{
override
suspend
fun
onSolveUnsafeDeviceLoginVerify
(
bot
:
Bot
,
url
:
String
):
String
?
=
loginSolverLock
.
withLock
{
bot
.
logger
.
info
(
"需要进行账户安全认证"
)
bot
.
logger
.
info
(
"需要进行账户安全认证"
)
bot
.
logger
.
info
(
"该账户有[设备锁]/[不常用登陆地点]/[不常用设备登陆]的问题"
)
bot
.
logger
.
info
(
"该账户有[设备锁]/[不常用登陆地点]/[不常用设备登陆]的问题"
)
bot
.
logger
.
info
(
"完成以下账号认证即可成功登陆|理论本认证在mirai每个账户中最多出现1次"
)
bot
.
logger
.
info
(
"完成以下账号认证即可成功登陆|理论本认证在mirai每个账户中最多出现1次"
)
...
...
mirai-demos/mirai-demo-android/src/main/kotlin/net/mamoe/mirai/demo/MiraiService.kt
View file @
8bdfad96
...
@@ -57,11 +57,7 @@ class MiraiService : Service() {
...
@@ -57,11 +57,7 @@ class MiraiService : Service() {
TODO
(
"not implemented"
)
TODO
(
"not implemented"
)
}
}
override
suspend
fun
onGetPhoneNumber
():
String
{
override
suspend
fun
onSolveUnsafeDeviceLoginVerify
(
bot
:
Bot
,
url
:
String
):
String
?
{
TODO
(
"not implemented"
)
}
override
suspend
fun
onGetSMSVerifyCode
():
String
{
TODO
(
"not implemented"
)
TODO
(
"not implemented"
)
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment