new room gui

This commit is contained in:
Aynakeya
2022-11-28 18:39:12 -08:00
parent eac8b7b775
commit 0498d2dbf3
38 changed files with 1368 additions and 324 deletions

View File

@@ -24,6 +24,7 @@ func l() *logrus.Entry {
}
type Diange struct {
config.BaseConfig
UserPermission bool
PrivilegePermission bool
AdminPermission bool

View File

@@ -21,6 +21,7 @@ func l() *logrus.Entry {
}
type Qiege struct {
config.BaseConfig
UserPermission bool
PrivilegePermission bool
AdminPermission bool

View File

@@ -55,6 +55,7 @@ type OutInfo struct {
}
type TextInfo struct {
config.BaseConfig
Rendering bool
info OutInfo
templates []*Template

View File

@@ -225,5 +225,8 @@ func (s *WebInfoServer) Stop() error {
s.lock.Lock()
s.Clients = map[*Client]int{}
s.lock.Unlock()
return s.Server.Shutdown(context.TODO())
if s.Server != nil {
return s.Server.Shutdown(context.TODO())
}
return nil
}

View File

@@ -23,14 +23,17 @@ const MODULE_PLGUIN_WEBINFO = "plugin.webinfo"
var lg = logger.Logger.WithField("Module", MODULE_PLGUIN_WEBINFO)
type WebInfo struct {
Port int
server *WebInfoServer
panel fyne.CanvasObject
config.BaseConfig
Enabled bool
Port int
server *WebInfoServer
panel fyne.CanvasObject
}
func NewWebInfo() *WebInfo {
return &WebInfo{
Port: 4000,
Enabled: true,
Port: 4000,
}
}
@@ -49,11 +52,13 @@ func (w *WebInfo) Description() string {
func (w *WebInfo) Enable() error {
config.LoadConfig(w)
w.server = NewWebInfoServer(w.Port)
lg.Info("starting web backend server")
w.server.Start()
w.registerHandlers()
gui.AddConfigLayout(w)
lg.Info("webinfo loaded")
if w.Enabled {
lg.Info("starting web backend server")
w.server.Start()
}
return nil
}
@@ -156,11 +161,15 @@ func (w *WebInfo) CreatePanel() fyne.CanvasObject {
if w.panel != nil {
return w.panel
}
statusText := widget.NewLabel("")
serverStatus := container.NewHBox(
widget.NewLabel(i18n.T("plugin.webinfo.server_status")),
statusText,
)
autoStart := container.NewHBox(
widget.NewLabel(i18n.T("plugin.webinfo.autostart")),
widget.NewCheckWithData("", binding.BindBool(&w.Enabled)))
statusText.SetText(w.getServerStatusText())
serverPort := container.NewBorder(nil, nil,
widget.NewLabel(i18n.T("plugin.webinfo.port")), nil,
@@ -224,6 +233,6 @@ func (w *WebInfo) CreatePanel() fyne.CanvasObject {
widget.NewLabel(i18n.T("plugin.webinfo.server_control")),
startBtn, stopBtn, restartBtn,
)
w.panel = container.NewVBox(serverStatus, serverPreview, serverPort, ctrlBtns)
w.panel = container.NewVBox(serverStatus, autoStart, serverPreview, serverPort, ctrlBtns)
return w.panel
}

View File

@@ -20,6 +20,7 @@ const MODULE_PLGUIN_NETEASELOGIN = "plugin.neteaselogin"
var lg = logger.Logger.WithField("Module", MODULE_PLGUIN_NETEASELOGIN)
type WYLogin struct {
config.BaseConfig
MusicU string
CSRF string
panel fyne.CanvasObject