2020-11-01 16:09:48 +01:00
|
|
|
package handler
|
2020-10-22 16:54:50 +02:00
|
|
|
|
|
|
|
import (
|
2021-09-01 23:10:18 +02:00
|
|
|
"errors"
|
|
|
|
|
2022-07-14 00:58:22 +02:00
|
|
|
"github.com/demodesk/neko/pkg/types"
|
|
|
|
"github.com/demodesk/neko/pkg/types/event"
|
|
|
|
"github.com/demodesk/neko/pkg/types/message"
|
2020-10-22 16:54:50 +02:00
|
|
|
)
|
|
|
|
|
2020-11-30 17:53:05 +01:00
|
|
|
func (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.ScreenSize) error {
|
2021-03-14 00:45:51 +01:00
|
|
|
if !session.Profile().IsAdmin {
|
2021-09-01 23:10:18 +02:00
|
|
|
return errors.New("is not the admin")
|
2020-10-22 16:54:50 +02:00
|
|
|
}
|
|
|
|
|
2023-02-14 21:18:47 +01:00
|
|
|
size, err := h.desktop.SetScreenSize(types.ScreenSize{
|
|
|
|
Width: payload.Width,
|
|
|
|
Height: payload.Height,
|
|
|
|
Rate: payload.Rate,
|
|
|
|
})
|
|
|
|
|
|
|
|
if err != nil {
|
2020-11-18 20:34:33 +01:00
|
|
|
return err
|
2020-10-22 16:54:50 +02:00
|
|
|
}
|
|
|
|
|
2023-02-14 21:18:47 +01:00
|
|
|
h.sessions.Broadcast(event.SCREEN_UPDATED, message.ScreenSize{
|
|
|
|
Width: size.Width,
|
|
|
|
Height: size.Height,
|
|
|
|
Rate: size.Rate,
|
|
|
|
})
|
2020-11-18 20:30:33 +01:00
|
|
|
return nil
|
2020-10-22 16:54:50 +02:00
|
|
|
}
|