From c78d797fe788e41eca5357d21432f2ee9c4c1545 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miroslav=20=C5=A0ediv=C3=BD?= Date: Mon, 17 Jun 2024 23:16:48 +0200 Subject: [PATCH] fix typo. --- server/internal/types/event/events.go | 6 +++--- server/internal/websocket/handler/broadcast.go | 16 ++++++++-------- server/internal/websocket/handler/handler.go | 10 +++++----- server/internal/websocket/handler/session.go | 2 +- 4 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/internal/types/event/events.go b/server/internal/types/event/events.go index a091ab67..8032ba90 100644 --- a/server/internal/types/event/events.go +++ b/server/internal/types/event/events.go @@ -46,9 +46,9 @@ const ( ) const ( - BORADCAST_STATUS = "broadcast/status" - BORADCAST_CREATE = "broadcast/create" - BORADCAST_DESTROY = "broadcast/destroy" + BROADCAST_STATUS = "broadcast/status" + BROADCAST_CREATE = "broadcast/create" + BROADCAST_DESTROY = "broadcast/destroy" ) const ( diff --git a/server/internal/websocket/handler/broadcast.go b/server/internal/websocket/handler/broadcast.go index d04b4994..405bfdac 100644 --- a/server/internal/websocket/handler/broadcast.go +++ b/server/internal/websocket/handler/broadcast.go @@ -6,7 +6,7 @@ import ( "m1k1o/neko/internal/types/message" ) -func (h *MessageHandler) boradcastCreate(session types.Session, payload *message.BroadcastCreate) error { +func (h *MessageHandler) broadcastCreate(session types.Session, payload *message.BroadcastCreate) error { broadcast := h.capture.Broadcast() if !session.Admin() { @@ -44,14 +44,14 @@ func (h *MessageHandler) boradcastCreate(session types.Session, payload *message } } - if err := h.boradcastStatus(nil); err != nil { + if err := h.broadcastStatus(nil); err != nil { return err } return nil } -func (h *MessageHandler) boradcastDestroy(session types.Session) error { +func (h *MessageHandler) broadcastDestroy(session types.Session) error { broadcast := h.capture.Broadcast() if !session.Admin() { @@ -70,18 +70,18 @@ func (h *MessageHandler) boradcastDestroy(session types.Session) error { broadcast.Stop() - if err := h.boradcastStatus(nil); err != nil { + if err := h.broadcastStatus(nil); err != nil { return err } return nil } -func (h *MessageHandler) boradcastStatus(session types.Session) error { +func (h *MessageHandler) broadcastStatus(session types.Session) error { broadcast := h.capture.Broadcast() msg := message.BroadcastStatus{ - Event: event.BORADCAST_STATUS, + Event: event.BROADCAST_STATUS, IsActive: broadcast.Started(), URL: broadcast.Url(), } @@ -89,7 +89,7 @@ func (h *MessageHandler) boradcastStatus(session types.Session) error { // if no session, broadcast change if session == nil { if err := h.sessions.AdminBroadcast(msg, nil); err != nil { - h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.BORADCAST_STATUS) + h.logger.Warn().Err(err).Msgf("broadcasting event %s has failed", event.BROADCAST_STATUS) return err } @@ -102,7 +102,7 @@ func (h *MessageHandler) boradcastStatus(session types.Session) error { } if err := session.Send(msg); err != nil { - h.logger.Warn().Err(err).Msgf("sending event %s has failed", event.BORADCAST_STATUS) + h.logger.Warn().Err(err).Msgf("sending event %s has failed", event.BROADCAST_STATUS) return err } diff --git a/server/internal/websocket/handler/handler.go b/server/internal/websocket/handler/handler.go index 6996f8ed..628771ca 100644 --- a/server/internal/websocket/handler/handler.go +++ b/server/internal/websocket/handler/handler.go @@ -148,15 +148,15 @@ func (h *MessageHandler) Message(id string, raw []byte) error { return h.screenSet(id, session, payload) }), "%s failed", header.Event) - // Boradcast Events - case event.BORADCAST_CREATE: + // Broadcast Events + case event.BROADCAST_CREATE: payload := &message.BroadcastCreate{} return errors.Wrapf( utils.Unmarshal(payload, raw, func() error { - return h.boradcastCreate(session, payload) + return h.broadcastCreate(session, payload) }), "%s failed", header.Event) - case event.BORADCAST_DESTROY: - return errors.Wrapf(h.boradcastDestroy(session), "%s failed", header.Event) + case event.BROADCAST_DESTROY: + return errors.Wrapf(h.broadcastDestroy(session), "%s failed", header.Event) // Admin Events case event.ADMIN_LOCK: diff --git a/server/internal/websocket/handler/session.go b/server/internal/websocket/handler/session.go index da2b1bde..b70500d9 100644 --- a/server/internal/websocket/handler/session.go +++ b/server/internal/websocket/handler/session.go @@ -30,7 +30,7 @@ func (h *MessageHandler) SessionCreated(id string, session types.Session) error } // send broadcast status if admin - if err := h.boradcastStatus(session); err != nil { + if err := h.broadcastStatus(session); err != nil { return err } }