diff --git a/server/internal/broadcast/manager.go b/server/internal/broadcast/manager.go index 0cb5185..753b53b 100644 --- a/server/internal/broadcast/manager.go +++ b/server/internal/broadcast/manager.go @@ -2,6 +2,7 @@ package broadcast import ( "github.com/rs/zerolog" + "github.com/rs/zerolog/log" "n.eko.moe/neko/internal/gst" "n.eko.moe/neko/internal/types/config" ) @@ -14,8 +15,8 @@ type BroadcastManager struct { func New(config *config.Broadcast) *BroadcastManager { return &BroadcastManager{ - logger: log.With().Str("module", "remote").Logger(), - config: config + logger: log.With().Str("module", "remote").Logger(), + config: config, } } @@ -28,13 +29,15 @@ func (manager *BroadcastManager) Start() { ) if err != nil { manager.logger.Panic().Err(err).Msg("unable to create rtmp pipeline") - } + } - manager.pipeline.Start() + manager.pipeline.Start() } func (manager *BroadcastManager) Shutdown() error { - if (manager.pipeline != nil) { - manager.pipeline.Stop() - } + if manager.pipeline != nil { + manager.pipeline.Stop() + } + + return nil } diff --git a/server/internal/websocket/admin.go b/server/internal/websocket/admin.go index 192d4c1..1063f27 100644 --- a/server/internal/websocket/admin.go +++ b/server/internal/websocket/admin.go @@ -230,7 +230,7 @@ func (h *MessageHandler) adminKick(id string, session types.Session, payload *me return nil } - if err := target.Kick("You have been kicked"); err != nil { + if err := target.Kick("kicked"); err != nil { return err } @@ -280,7 +280,7 @@ func (h *MessageHandler) adminBan(id string, session types.Session, payload *mes h.banned[address[0]] = true - if err := target.Kick("You have been banned"); err != nil { + if err := target.Kick("banned"); err != nil { return err } diff --git a/server/internal/websocket/handler.go b/server/internal/websocket/handler.go index f52a95f..7ad21d3 100644 --- a/server/internal/websocket/handler.go +++ b/server/internal/websocket/handler.go @@ -29,7 +29,7 @@ func (h *MessageHandler) Connected(id string, socket *WebSocket) (bool, string, ok, banned := h.banned[address] if ok && banned { h.logger.Debug().Str("address", address).Msg("banned") - return false, "This IP has been banned", nil + return false, "banned", nil } } @@ -37,7 +37,7 @@ func (h *MessageHandler) Connected(id string, socket *WebSocket) (bool, string, session, ok := h.sessions.Get(id) if !ok || !session.Admin() { h.logger.Debug().Msg("server locked") - return false, "Server is currently locked", nil + return false, "locked", nil } } diff --git a/server/internal/websocket/websocket.go b/server/internal/websocket/websocket.go index fc6b4e3..c7d8523 100644 --- a/server/internal/websocket/websocket.go +++ b/server/internal/websocket/websocket.go @@ -131,7 +131,7 @@ func (ws *WebSocketHandler) Upgrade(w http.ResponseWriter, r *http.Request) erro if err = connection.WriteJSON(message.Disconnect{ Event: event.SYSTEM_DISCONNECT, - Message: "invalid password", + Message: "invalid_password", }); err != nil { ws.logger.Error().Err(err).Msg("failed to send disconnect") }