2020-11-02 04:09:48 +13:00
|
|
|
package handler
|
2020-10-23 03:54:50 +13:00
|
|
|
|
|
|
|
import (
|
2021-09-02 09:10:18 +12:00
|
|
|
"errors"
|
|
|
|
|
2022-03-20 23:43:00 +13:00
|
|
|
"gitlab.com/demodesk/neko/server/pkg/types"
|
|
|
|
"gitlab.com/demodesk/neko/server/pkg/types/event"
|
|
|
|
"gitlab.com/demodesk/neko/server/pkg/types/message"
|
2020-10-23 03:54:50 +13:00
|
|
|
)
|
|
|
|
|
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")
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|
|
|
|
|
2021-09-21 04:28:13 +12:00
|
|
|
data := types.ScreenSize(*payload)
|
|
|
|
if err := h.desktop.SetScreenSize(data); err != nil {
|
2020-11-19 08:34:33 +13:00
|
|
|
return err
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|
|
|
|
|
2021-09-21 04:28:13 +12:00
|
|
|
h.sessions.Broadcast(event.SCREEN_UPDATED, payload, nil)
|
2020-11-19 08:30:33 +13:00
|
|
|
return nil
|
2020-10-23 03:54:50 +13:00
|
|
|
}
|