mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
remove broadcast from websocket.
This commit is contained in:
parent
def6248ca7
commit
994a91886d
@ -53,8 +53,6 @@ const (
|
||||
|
||||
const (
|
||||
BORADCAST_STATUS = "broadcast/status"
|
||||
BORADCAST_CREATE = "broadcast/create" // TODO: Remove.
|
||||
BORADCAST_DESTROY = "broadcast/destroy" // TODO: Remove.
|
||||
)
|
||||
|
||||
const (
|
||||
|
@ -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(),
|
||||
})
|
||||
}
|
@ -85,15 +85,6 @@ func (h *MessageHandlerCtx) Message(session types.Session, raw []byte) error {
|
||||
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
|
||||
case event.ADMIN_CONTROL:
|
||||
err = h.adminControl(session)
|
||||
|
@ -17,11 +17,6 @@ func (h *MessageHandlerCtx) SessionCreated(session types.Session) error {
|
||||
if err := h.screenConfigurations(session); err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
// send broadcast status if admin
|
||||
if err := h.boradcastStatus(session); err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
return nil
|
||||
|
Loading…
Reference in New Issue
Block a user