neko/internal/websocket/handler/screen.go
Miroslav Šedivý babddacbf3
Go generics and changes in v1.18 (#5)
* ArrayIn to use generics.

* interface{} -> any.
2022-07-28 12:20:20 +02:00

24 lines
518 B
Go

package handler
import (
"errors"
"github.com/demodesk/neko/pkg/types"
"github.com/demodesk/neko/pkg/types/event"
"github.com/demodesk/neko/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)
return nil
}