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
b7fd77b6
Commit
b7fd77b6
authored
Feb 15, 2020
by
jiahua.liu
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mirai Console UI
parent
d4321152
Changes
3
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
325 additions
and
7 deletions
+325
-7
mirai-console/build.gradle.kts
mirai-console/build.gradle.kts
+1
-0
mirai-console/src/main/kotlin/net/mamoe/mirai/MiraiConsole.kt
...i-console/src/main/kotlin/net/mamoe/mirai/MiraiConsole.kt
+6
-7
mirai-console/src/main/kotlin/net/mamoe/mirai/MiraiConsoleUI.kt
...console/src/main/kotlin/net/mamoe/mirai/MiraiConsoleUI.kt
+318
-0
No files found.
mirai-console/build.gradle.kts
View file @
b7fd77b6
...
@@ -42,5 +42,6 @@ dependencies {
...
@@ -42,5 +42,6 @@ dependencies {
api
(
group
=
"com.alibaba"
,
name
=
"fastjson"
,
version
=
"1.2.62"
)
api
(
group
=
"com.alibaba"
,
name
=
"fastjson"
,
version
=
"1.2.62"
)
api
(
group
=
"org.yaml"
,
name
=
"snakeyaml"
,
version
=
"1.25"
)
api
(
group
=
"org.yaml"
,
name
=
"snakeyaml"
,
version
=
"1.25"
)
api
(
group
=
"com.moandjiezana.toml"
,
name
=
"toml4j"
,
version
=
"0.7.2"
)
api
(
group
=
"com.moandjiezana.toml"
,
name
=
"toml4j"
,
version
=
"0.7.2"
)
api
(
group
=
"com.googlecode.lanterna"
,
name
=
"lanterna"
,
version
=
"3.0.2"
)
// classpath is not set correctly by IDE
// classpath is not set correctly by IDE
}
}
\ No newline at end of file
mirai-console/src/main/kotlin/net/mamoe/mirai/MiraiConsole.kt
View file @
b7fd77b6
...
@@ -17,6 +17,7 @@ import net.mamoe.mirai.plugins.withDefaultWriteSave
...
@@ -17,6 +17,7 @@ import net.mamoe.mirai.plugins.withDefaultWriteSave
import
net.mamoe.mirai.api.http.MiraiHttpAPIServer
import
net.mamoe.mirai.api.http.MiraiHttpAPIServer
import
net.mamoe.mirai.api.http.generateSessionKey
import
net.mamoe.mirai.api.http.generateSessionKey
import
net.mamoe.mirai.contact.sendMessage
import
net.mamoe.mirai.contact.sendMessage
import
net.mamoe.mirai.utils.MiraiLogger
import
java.io.File
import
java.io.File
import
kotlin.concurrent.thread
import
kotlin.concurrent.thread
...
@@ -37,7 +38,7 @@ object MiraiConsole {
...
@@ -37,7 +38,7 @@ object MiraiConsole {
get
()
=
PluginManager
get
()
=
PluginManager
var
logger
:
MiraiConsoleLogger
=
var
logger
:
MiraiConsoleLogger
=
DefaultLogger
UIPushLogger
()
var
path
:
String
=
System
.
getProperty
(
"user.dir"
)
var
path
:
String
=
System
.
getProperty
(
"user.dir"
)
...
@@ -254,14 +255,11 @@ object MiraiConsole {
...
@@ -254,14 +255,11 @@ object MiraiConsole {
}
}
}
}
interface
MiraiConsoleLogger
{
class
UIPushLogger
(
override
val
identity
:
String
?,
override
var
follower
:
MiraiLogger
?)
:
MiraiLogger
{
operator
fun
invoke
(
any
:
Any
?
=
null
)
}
object
DefaultLogger
:
MiraiConsoleLogger
{
override
fun
invoke
(
any
:
Any
?)
{
override
fun
invoke
(
any
:
Any
?)
{
MiraiConsoleUI
.
start
()
if
(
any
!=
null
)
{
if
(
any
!=
null
)
{
println
(
"[Mirai$version $build]: "
+
any
.
toString
()
)
MiraiConsoleUI
.
pushLog
(
0
,
"[Mirai$version $build]: $any"
)
}
}
}
}
}
}
...
@@ -287,6 +285,7 @@ class MiraiConsoleLoader {
...
@@ -287,6 +285,7 @@ class MiraiConsoleLoader {
Runtime
.
getRuntime
().
addShutdownHook
(
thread
(
start
=
false
)
{
Runtime
.
getRuntime
().
addShutdownHook
(
thread
(
start
=
false
)
{
MiraiConsole
.
stop
()
MiraiConsole
.
stop
()
})
})
}
}
}
}
}
}
...
...
mirai-console/src/main/kotlin/net/mamoe/mirai/MiraiConsoleUI.kt
0 → 100644
View file @
b7fd77b6
This diff is collapsed.
Click to expand it.
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