35 lines
741 B
Go
Raw Normal View History

2020-11-01 16:09:48 +01:00
package handler
import (
2020-10-28 19:15:48 +01:00
"demodesk/neko/internal/types"
"demodesk/neko/internal/types/event"
"demodesk/neko/internal/types/message"
)
2020-11-30 17:53:05 +01:00
func (h *MessageHandlerCtx) screenSet(session types.Session, payload *message.ScreenSize) error {
2021-08-29 18:23:58 +02:00
logger := h.logger.With().Str("session_id", session.ID()).Logger()
2021-03-14 00:45:51 +01:00
if !session.Profile().IsAdmin {
2021-08-29 18:23:58 +02:00
logger.Debug().Msg("is not the admin")
return nil
}
2021-01-15 17:30:19 +01:00
if err := h.desktop.SetScreenSize(types.ScreenSize{
2021-02-14 14:40:17 +01:00
Width: payload.Width,
2021-01-15 17:30:19 +01:00
Height: payload.Height,
2021-02-14 14:40:17 +01:00
Rate: payload.Rate,
2021-01-15 17:30:19 +01:00
}); err != nil {
2020-11-18 20:34:33 +01:00
return err
}
2020-11-18 20:30:33 +01:00
h.sessions.Broadcast(
2020-11-30 17:53:05 +01:00
message.ScreenSize{
Event: event.SCREEN_UPDATED,
2020-11-16 17:48:10 +01:00
Width: payload.Width,
Height: payload.Height,
Rate: payload.Rate,
2020-11-16 18:12:25 +01:00
}, nil)
2020-11-18 20:30:33 +01:00
return nil
}