remove broadcast from websocket.

This commit is contained in:
Miroslav Šedivý 2020-11-30 17:29:05 +01:00
parent def6248ca7
commit 994a91886d
4 changed files with 0 additions and 60 deletions

View File

@ -53,8 +53,6 @@ const (
const ( const (
BORADCAST_STATUS = "broadcast/status" BORADCAST_STATUS = "broadcast/status"
BORADCAST_CREATE = "broadcast/create" // TODO: Remove.
BORADCAST_DESTROY = "broadcast/destroy" // TODO: Remove.
) )
const ( const (

View File

@ -1,44 +0,0 @@
package handler
import (
"demodesk/neko/internal/types"
"demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message"
)
func (h *MessageHandlerCtx) boradcastCreate(session types.Session, payload *message.BroadcastCreate) error {
if !session.Admin() {
h.logger.Debug().Msg("user not admin")
return nil
}
if err := h.capture.StartBroadcast(payload.URL); err != nil {
return err
}
return h.boradcastStatus(session)
}
func (h *MessageHandlerCtx) boradcastDestroy(session types.Session) error {
if !session.Admin() {
h.logger.Debug().Msg("user not admin")
return nil
}
h.capture.StopBroadcast()
return h.boradcastStatus(session)
}
func (h *MessageHandlerCtx) boradcastStatus(session types.Session) error {
if !session.Admin() {
h.logger.Debug().Msg("user not admin")
return nil
}
return session.Send(
message.BroadcastStatus{
Event: event.BORADCAST_STATUS,
IsActive: h.capture.BroadcastEnabled(),
URL: h.capture.BroadcastUrl(),
})
}

View File

@ -85,15 +85,6 @@ func (h *MessageHandlerCtx) Message(session types.Session, raw []byte) error {
return h.screenSizeChange(session, payload) return h.screenSizeChange(session, payload)
}) })
// Boradcast Events
case event.BORADCAST_CREATE:
payload := &message.BroadcastCreate{}
err = utils.Unmarshal(payload, raw, func() error {
return h.boradcastCreate(session, payload)
})
case event.BORADCAST_DESTROY:
err = h.boradcastDestroy(session)
// Admin Events // Admin Events
case event.ADMIN_CONTROL: case event.ADMIN_CONTROL:
err = h.adminControl(session) err = h.adminControl(session)

View File

@ -17,11 +17,6 @@ func (h *MessageHandlerCtx) SessionCreated(session types.Session) error {
if err := h.screenConfigurations(session); err != nil { if err := h.screenConfigurations(session); err != nil {
return err return err
} }
// send broadcast status if admin
if err := h.boradcastStatus(session); err != nil {
return err
}
} }
return nil return nil