neko/server/internal/websocket/handler/screen.go

27 lines
571 B
Go
Raw Normal View History

2020-11-02 04:09:48 +13:00
package handler
import (
2021-09-02 09:10:18 +12:00
"errors"
"github.com/demodesk/neko/pkg/types"
"github.com/demodesk/neko/pkg/types/event"
"github.com/demodesk/neko/pkg/types/message"
)
2020-12-01 05:53:05 +13:00
func (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.ScreenSize) error {
2021-03-14 12:45:51 +13:00
if !session.Profile().IsAdmin {
2021-09-02 09:10:18 +12:00
return errors.New("is not the admin")
}
size, err := h.desktop.SetScreenSize(payload.ScreenSize)
if err != nil {
2020-11-19 08:34:33 +13:00
return err
}
h.sessions.Broadcast(event.SCREEN_UPDATED, message.ScreenSizeUpdate{
ID: session.ID(),
ScreenSize: size,
})
2020-11-19 08:30:33 +13:00
return nil
}