Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
G
go-cqhttp
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
nanahira
go-cqhttp
Commits
a5958e08
Commit
a5958e08
authored
Oct 03, 2020
by
Mrs4s
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix typo.
parent
cc1093ff
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
13 deletions
+13
-13
global/config.go
global/config.go
+1
-1
server/apiAdmin.go
server/apiAdmin.go
+12
-12
No files found.
global/config.go
View file @
a5958e08
...
...
@@ -82,7 +82,7 @@ type GoCQReverseWebsocketConfig struct {
type
GoCqWebUi
struct
{
Enabled
bool
`json:"enabled"`
WebUiPort
uint64
`json:"web_ui_port"`
WebInput
bool
`json:"webinput"`
WebInput
bool
`json:"web
_
input"`
}
func
DefaultConfig
()
*
JsonConfig
{
...
...
server/apiAdmin.go
View file @
a5958e08
...
...
@@ -26,7 +26,7 @@ var WebInput = make(chan string, 1) //长度1,用于阻塞
var
Console
=
make
(
chan
os
.
Signal
,
1
)
var
Json
c
onfig
*
global
.
JsonConfig
var
Json
C
onfig
*
global
.
JsonConfig
type
webServer
struct
{
engine
*
gin
.
Engine
...
...
@@ -59,7 +59,7 @@ func Failed(code int, msg string) coolq.MSG {
func
(
s
*
webServer
)
Run
(
addr
string
,
cli
*
client
.
QQClient
)
*
coolq
.
CQBot
{
s
.
Cli
=
cli
s
.
Conf
=
GetConf
()
Json
c
onfig
=
s
.
Conf
Json
C
onfig
=
s
.
Conf
gin
.
SetMode
(
gin
.
ReleaseMode
)
s
.
engine
=
gin
.
New
()
...
...
@@ -205,8 +205,8 @@ func (s *webServer) admin(c *gin.Context) {
// 获取当前配置文件信息
func
GetConf
()
*
global
.
JsonConfig
{
if
Json
c
onfig
!=
nil
{
return
Json
c
onfig
if
Json
C
onfig
!=
nil
{
return
Json
C
onfig
}
conf
:=
global
.
Load
(
"config.json"
)
return
conf
...
...
@@ -261,8 +261,8 @@ func AuthMiddleWare() gin.HandlerFunc {
}
}
func
(
s
*
webServer
)
DoRe
login
()
{
Json
c
onfig
=
nil
func
(
s
*
webServer
)
DoRe
Login
()
{
// TODO: 协议层的 ReLogin
Json
C
onfig
=
nil
conf
:=
GetConf
()
OldConf
:=
s
.
Conf
cli
:=
client
.
NewClient
(
conf
.
Uin
,
conf
.
Password
)
...
...
@@ -339,7 +339,7 @@ func (s *webServer) ReloadServer() {
func
AdminDoRestart
(
s
*
webServer
,
c
*
gin
.
Context
)
{
s
.
bot
=
nil
s
.
Cli
=
nil
s
.
DoRe
l
ogin
()
s
.
DoRe
L
ogin
()
c
.
JSON
(
200
,
coolq
.
OK
(
coolq
.
MSG
{}))
return
}
...
...
@@ -390,7 +390,7 @@ func AdminDoConfigBase(s *webServer, c *gin.Context) {
log
.
Fatalf
(
"保存 config.json 时出现错误: %v"
,
err
)
c
.
JSON
(
200
,
Failed
(
502
,
"保存 config.json 时出现错误:"
+
fmt
.
Sprintf
(
"%v"
,
err
)))
}
else
{
Json
c
onfig
=
nil
Json
C
onfig
=
nil
c
.
JSON
(
200
,
coolq
.
OK
(
coolq
.
MSG
{}))
}
}
...
...
@@ -415,7 +415,7 @@ func AdminDoConfigHttp(s *webServer, c *gin.Context) {
log
.
Fatalf
(
"保存 config.json 时出现错误: %v"
,
err
)
c
.
JSON
(
200
,
Failed
(
502
,
"保存 config.json 时出现错误:"
+
fmt
.
Sprintf
(
"%v"
,
err
)))
}
else
{
Json
c
onfig
=
nil
Json
C
onfig
=
nil
c
.
JSON
(
200
,
coolq
.
OK
(
coolq
.
MSG
{}))
}
}
...
...
@@ -435,7 +435,7 @@ func AdminDoConfigWs(s *webServer, c *gin.Context) {
log
.
Fatalf
(
"保存 config.json 时出现错误: %v"
,
err
)
c
.
JSON
(
200
,
Failed
(
502
,
"保存 config.json 时出现错误:"
+
fmt
.
Sprintf
(
"%v"
,
err
)))
}
else
{
Json
c
onfig
=
nil
Json
C
onfig
=
nil
c
.
JSON
(
200
,
coolq
.
OK
(
coolq
.
MSG
{}))
}
}
...
...
@@ -457,7 +457,7 @@ func AdminDoConfigReverse(s *webServer, c *gin.Context) {
log
.
Fatalf
(
"保存 config.json 时出现错误: %v"
,
err
)
c
.
JSON
(
200
,
Failed
(
502
,
"保存 config.json 时出现错误:"
+
fmt
.
Sprintf
(
"%v"
,
err
)))
}
else
{
Json
c
onfig
=
nil
Json
C
onfig
=
nil
c
.
JSON
(
200
,
coolq
.
OK
(
coolq
.
MSG
{}))
}
}
...
...
@@ -476,7 +476,7 @@ func AdminDoConfigJson(s *webServer, c *gin.Context) {
log
.
Fatalf
(
"保存 config.json 时出现错误: %v"
,
err
)
c
.
JSON
(
200
,
Failed
(
502
,
"保存 config.json 时出现错误:"
+
fmt
.
Sprintf
(
"%v"
,
err
)))
}
else
{
Json
c
onfig
=
nil
Json
C
onfig
=
nil
c
.
JSON
(
200
,
coolq
.
OK
(
coolq
.
MSG
{}))
}
}
...
...
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