add new WS keyboard event
This commit is contained in:
@ -119,3 +119,14 @@ func (h *MessageHandler) controlClipboard(id string, session types.Session, payl
|
||||
h.remote.WriteClipboard(payload.Text)
|
||||
return nil
|
||||
}
|
||||
|
||||
func (h *MessageHandler) controlKeyboard(id string, session types.Session, payload *message.Keyboard) error {
|
||||
// check if session is host
|
||||
if !h.sessions.IsHost(id) {
|
||||
h.logger.Debug().Str("id", id).Msg("is not the host")
|
||||
return nil
|
||||
}
|
||||
|
||||
h.remote.SetKeyboard(payload.Layout)
|
||||
return nil
|
||||
}
|
||||
|
@ -93,6 +93,13 @@ func (h *MessageHandler) Message(id string, raw []byte) error {
|
||||
utils.Unmarshal(payload, raw, func() error {
|
||||
return h.controlClipboard(id, session, payload)
|
||||
}), "%s failed", header.Event)
|
||||
case event.CONTROL_KEYBOARD:
|
||||
payload := &message.Keyboard{}
|
||||
return errors.Wrapf(
|
||||
utils.Unmarshal(payload, raw, func() error {
|
||||
return h.controlKeyboard(id, session, payload)
|
||||
}), "%s failed", header.Event)
|
||||
|
||||
|
||||
// Chat Events
|
||||
case event.CHAT_MESSAGE:
|
||||
|
Reference in New Issue
Block a user