fix typo.

This commit is contained in:
Miroslav Šedivý 2024-06-17 23:16:48 +02:00
parent 57596315e9
commit c78d797fe7
4 changed files with 17 additions and 17 deletions

View File

@ -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 (

View File

@ -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
}

View File

@ -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:

View File

@ -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
}
}