From e2032cdc748b4be74a6700910c6d8a1f805aa67f Mon Sep 17 00:00:00 2001 From: fumiama Date: Tue, 9 Nov 2021 13:01:01 +0800 Subject: [PATCH] =?UTF-8?q?=E2=9C=8F=EF=B8=8F=20=20=E4=BF=AE=E5=A4=8D=20we?= =?UTF-8?q?bgui=20=E6=97=A0=E6=B3=95=E5=90=AF=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- control/web/gui.go | 6 +++--- control/web/init.go | 11 ----------- main.go | 10 +++++++++- 3 files changed, 12 insertions(+), 15 deletions(-) delete mode 100644 control/web/init.go diff --git a/control/web/gui.go b/control/web/gui.go index 2b085e0c..d2a677a0 100644 --- a/control/web/gui.go +++ b/control/web/gui.go @@ -1,4 +1,4 @@ -package web +package webctrl import ( "encoding/json" @@ -36,8 +36,8 @@ var ( type logWriter struct { } -// initGui 初始化gui -func initGui() { +// InitGui 初始化gui +func InitGui() { // 将日志重定向到前端hook writer := io.MultiWriter(l, os.Stderr) log.SetOutput(writer) diff --git a/control/web/init.go b/control/web/init.go deleted file mode 100644 index 7e257e3d..00000000 --- a/control/web/init.go +++ /dev/null @@ -1,11 +0,0 @@ -// Package web 网页管理后端 -package web - -import "flag" - -func init() { - // 解析命令行参数,输入 `-g` 即可启用 gui - if *flag.Bool("g", false, "Enable web gui.") { - initGui() - } -} diff --git a/main.go b/main.go index 7f041823..c259ef61 100644 --- a/main.go +++ b/main.go @@ -10,7 +10,7 @@ import ( // 下列插件可与 wdvxdr1123/ZeroBot v1.1.2 以上配合单独使用 // 插件控制 - // _ "github.com/FloatTech/ZeroBot-Plugin/control/web" // web 后端控制 + // webctrl "github.com/FloatTech/ZeroBot-Plugin/control/web" // web 后端控制 // 词库类 _ "github.com/FloatTech/ZeroBot-Plugin/plugin_atri" // ATRI词库 @@ -74,10 +74,14 @@ func init() { d := flag.Bool("d", false, "Enable debug level log and higher.") w := flag.Bool("w", false, "Enable warning level log and higher.") h := flag.Bool("h", false, "Display this help.") + // 解析命令行参数,输入 `-g` 即可启用 gui + // g := flag.Bool("g", false, "Enable web gui.") + // 直接写死 AccessToken 时,请更改下面第二个参数 token = flag.String("t", "", "Set AccessToken of WSClient.") // 直接写死 URL 时,请更改下面第二个参数 url = flag.String("u", "ws://127.0.0.1:6700", "Set Url of WSClient.") + flag.Parse() if *h { printBanner() @@ -92,6 +96,10 @@ func init() { logrus.SetLevel(logrus.WarnLevel) } } + // 解析命令行参数,输入 `-g` 即可启用 gui + // if *g { + // webctrl.InitGui() + // } } func printBanner() {