feat: 添加webui的初步支持 (#63)

* feat: 添加webui的初步支持

使用gin监听server,前端使用vuecli
目前已支持:
   前端发送信息
   前端获取信息
   获取插件列表
预计实现功能:

改变插件状态
  获取日志
  获取配置信息
  改变配置信息
  获取好友请求列表以及群请求列表
  手动同意申请列表

* feat: 继续实现webui功能

改变插件状态
  获取日志
  获取配置信息
  前端仓库位置更改

* fix: 修复golangLint的提示信息

* 🎨 改进代码样式

* Update gui.go

* fix: 修复golangLint的提示信息

* fix: 修复golangLint的提示信息

* feat: 支持通过命令行参数禁用gui

* fix: 设置gin在非debug模式下禁用日志

* Update gui.go

* Update gui.go

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: 源文雨 <41315874+fumiama@users.noreply.github.com>
This commit is contained in:
huoxue1
2021-09-26 10:35:07 +08:00
committed by GitHub
parent ae6d83c675
commit 21013bde98
4 changed files with 529 additions and 1 deletions

14
main.go
View File

@@ -1,6 +1,7 @@
package main
import (
"flag"
"fmt"
"os"
"strings"
@@ -10,7 +11,7 @@ import (
// 词库类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_chat" // 基础词库
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke" //青云客
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_qingyunke" // 青云客
// 实用类
_ "github.com/FloatTech/ZeroBot-Plugin/plugin_github" // 搜索GitHub仓库
@@ -44,6 +45,8 @@ import (
log "github.com/sirupsen/logrus"
zero "github.com/wdvxdr1123/ZeroBot"
"github.com/wdvxdr1123/ZeroBot/driver"
"github.com/FloatTech/ZeroBot-Plugin/control"
)
var (
@@ -54,9 +57,18 @@ var (
"* Project: https://github.com/FloatTech/ZeroBot-Plugin",
}
banner = strings.Join(contents, "\n")
// 是否禁用gui
disableGui bool
)
func init() {
// 解析命令行参数,输入`-g`即可禁用gui
flag.BoolVar(&disableGui, "g", false, "Disable the gui")
flag.Parse()
if !disableGui {
control.InitGui()
}
log.SetLevel(log.DebugLevel)
}