neko/internal/websocket/handler/screen.go
2022-03-20 11:43:00 +01:00

24 lines
544 B
Go

package handler
import (
"errors"
"gitlab.com/demodesk/neko/server/pkg/types"
"gitlab.com/demodesk/neko/server/pkg/types/event"
"gitlab.com/demodesk/neko/server/pkg/types/message"
)
func (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.ScreenSize) error {
if !session.Profile().IsAdmin {
return errors.New("is not the admin")
}
data := types.ScreenSize(*payload)
if err := h.desktop.SetScreenSize(data); err != nil {
return err
}
h.sessions.Broadcast(event.SCREEN_UPDATED, payload, nil)
return nil
}