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
734914ad
Commit
734914ad
authored
Feb 29, 2020
by
Him188
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use `ByteArray` than `IoBuffer`
parent
fb5b5241
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
6 additions
and
8 deletions
+6
-8
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/BotConfigurationAndroid.kt
...n/kotlin/net/mamoe/mirai/utils/BotConfigurationAndroid.kt
+2
-3
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
...mmonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
+1
-2
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/BotConfigurationJvm.kt
...mMain/kotlin/net/mamoe/mirai/utils/BotConfigurationJvm.kt
+3
-3
No files found.
mirai-core/src/androidMain/kotlin/net/mamoe/mirai/utils/BotConfigurationAndroid.kt
View file @
734914ad
...
...
@@ -9,7 +9,6 @@
package
net.mamoe.mirai.utils
import
kotlinx.io.core.IoBuffer
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.network.BotNetworkHandler
import
kotlin.coroutines.CoroutineContext
...
...
@@ -104,14 +103,14 @@ inline class FileBasedDeviceInfo @BotConfigurationDsl constructor(val filepath:
* 验证码, 设备锁解决器
*/
actual
abstract
class
LoginSolver
{
actual
abstract
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
IoBuffer
):
String
?
actual
abstract
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
ByteArray
):
String
?
actual
abstract
suspend
fun
onSolveSliderCaptcha
(
bot
:
Bot
,
url
:
String
):
String
?
actual
abstract
suspend
fun
onSolveUnsafeDeviceLoginVerify
(
bot
:
Bot
,
url
:
String
):
String
?
actual
companion
object
{
actual
val
Default
:
LoginSolver
get
()
=
object
:
LoginSolver
()
{
override
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
IoBuffer
):
String
?
{
override
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
ByteArray
):
String
?
{
error
(
"should be implemented manually by you"
)
}
...
...
mirai-core/src/commonMain/kotlin/net.mamoe.mirai/utils/BotConfiguration.kt
View file @
734914ad
...
...
@@ -9,7 +9,6 @@
package
net.mamoe.mirai.utils
import
kotlinx.io.core.IoBuffer
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.network.BotNetworkHandler
import
kotlin.coroutines.CoroutineContext
...
...
@@ -19,7 +18,7 @@ import kotlin.jvm.JvmStatic
* 验证码, 设备锁解决器
*/
expect
abstract
class
LoginSolver
{
abstract
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
IoBuffer
):
String
?
abstract
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
ByteArray
):
String
?
abstract
suspend
fun
onSolveSliderCaptcha
(
bot
:
Bot
,
url
:
String
):
String
?
...
...
mirai-core/src/jvmMain/kotlin/net/mamoe/mirai/utils/BotConfigurationJvm.kt
View file @
734914ad
...
...
@@ -16,10 +16,10 @@ import kotlinx.coroutines.io.ByteWriteChannel
import
kotlinx.coroutines.io.close
import
kotlinx.coroutines.io.jvm.nio.copyTo
import
kotlinx.coroutines.io.reader
import
kotlinx.coroutines.io.writeFully
import
kotlinx.coroutines.sync.Mutex
import
kotlinx.coroutines.sync.withLock
import
kotlinx.coroutines.withContext
import
kotlinx.io.core.IoBuffer
import
kotlinx.io.core.use
import
net.mamoe.mirai.Bot
import
net.mamoe.mirai.network.BotNetworkHandler
...
...
@@ -35,7 +35,7 @@ class DefaultLoginSolver(
private
val
input
:
suspend
()
->
String
,
private
val
overrideLogger
:
MiraiLogger
?
=
null
)
:
LoginSolver
()
{
override
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
IoBuffer
):
String
?
=
loginSolverLock
.
withLock
{
override
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
ByteArray
):
String
?
=
loginSolverLock
.
withLock
{
val
logger
=
overrideLogger
?:
bot
.
logger
val
tempFile
:
File
=
createTempFile
(
suffix
=
".png"
).
apply
{
deleteOnExit
()
}
withContext
(
Dispatchers
.
IO
)
{
...
...
@@ -256,7 +256,7 @@ inline class FileBasedDeviceInfo @BotConfigurationDsl constructor(val filepath:
* 验证码, 设备锁解决器
*/
actual
abstract
class
LoginSolver
{
actual
abstract
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
IoBuffer
):
String
?
actual
abstract
suspend
fun
onSolvePicCaptcha
(
bot
:
Bot
,
data
:
ByteArray
):
String
?
actual
abstract
suspend
fun
onSolveSliderCaptcha
(
bot
:
Bot
,
url
:
String
):
String
?
actual
abstract
suspend
fun
onSolveUnsafeDeviceLoginVerify
(
bot
:
Bot
,
url
:
String
):
String
?
...
...
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