Revert "new WS ControlRequest data type"
This reverts commit 70e8b215cb
.
This commit is contained in:
parent
8113ce276c
commit
01564a57b5
@ -29,7 +29,6 @@ export type WebSocketPayloads =
|
|||||||
| MemberListPayload
|
| MemberListPayload
|
||||||
| Member
|
| Member
|
||||||
| ControlPayload
|
| ControlPayload
|
||||||
| ControlRequestPayload
|
|
||||||
| ControlClipboardPayload
|
| ControlClipboardPayload
|
||||||
| ControlKeyboardPayload
|
| ControlKeyboardPayload
|
||||||
| ChatPayload
|
| ChatPayload
|
||||||
@ -113,10 +112,6 @@ export interface ControlPayload {
|
|||||||
id: string
|
id: string
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface ControlRequestPayload {
|
|
||||||
keyboard_layout: string
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ControlTargetPayload {
|
export interface ControlTargetPayload {
|
||||||
id: string
|
id: string
|
||||||
target: string
|
target: string
|
||||||
|
@ -64,7 +64,7 @@ export const actions = actionTree(
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (!getters.hosting) {
|
if (!getters.hosting) {
|
||||||
$client.sendMessage(EVENT.CONTROL.REQUEST, { keyboard_layout: accessor.settings.keyboard_layout })
|
$client.sendMessage(EVENT.CONTROL.REQUEST)
|
||||||
} else {
|
} else {
|
||||||
$client.sendMessage(EVENT.CONTROL.RELEASE)
|
$client.sendMessage(EVENT.CONTROL.RELEASE)
|
||||||
}
|
}
|
||||||
|
@ -56,11 +56,6 @@ type Control struct {
|
|||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type ControlRequest struct {
|
|
||||||
Event string `json:"event"`
|
|
||||||
KeyboardLayout string `json:"keyboard_layout"`
|
|
||||||
}
|
|
||||||
|
|
||||||
type ControlTarget struct {
|
type ControlTarget struct {
|
||||||
Event string `json:"event"`
|
Event string `json:"event"`
|
||||||
ID string `json:"id"`
|
ID string `json:"id"`
|
||||||
|
@ -31,13 +31,9 @@ func (h *MessageHandler) controlRelease(id string, session types.Session) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (h *MessageHandler) controlRequest(id string, session types.Session, payload *message.ControlRequest) error {
|
func (h *MessageHandler) controlRequest(id string, session types.Session) error {
|
||||||
// check for host
|
// check for host
|
||||||
if !h.sessions.HasHost() {
|
if !h.sessions.HasHost() {
|
||||||
// keyboard layout change
|
|
||||||
h.logger.Debug().Msgf("change keyboard to %s", payload.KeyboardLayout)
|
|
||||||
h.remote.SetKeyboard(payload.KeyboardLayout)
|
|
||||||
|
|
||||||
// set host
|
// set host
|
||||||
h.sessions.SetHost(id)
|
h.sessions.SetHost(id)
|
||||||
|
|
||||||
|
@ -76,11 +76,7 @@ func (h *MessageHandler) Message(id string, raw []byte) error {
|
|||||||
case event.CONTROL_RELEASE:
|
case event.CONTROL_RELEASE:
|
||||||
return errors.Wrapf(h.controlRelease(id, session), "%s failed", header.Event)
|
return errors.Wrapf(h.controlRelease(id, session), "%s failed", header.Event)
|
||||||
case event.CONTROL_REQUEST:
|
case event.CONTROL_REQUEST:
|
||||||
payload := &message.ControlRequest{}
|
return errors.Wrapf(h.controlRequest(id, session), "%s failed", header.Event)
|
||||||
return errors.Wrapf(
|
|
||||||
utils.Unmarshal(payload, raw, func() error {
|
|
||||||
return h.controlRequest(id, session, payload)
|
|
||||||
}), "%s failed", header.Event)
|
|
||||||
case event.CONTROL_GIVE:
|
case event.CONTROL_GIVE:
|
||||||
payload := &message.Control{}
|
payload := &message.Control{}
|
||||||
return errors.Wrapf(
|
return errors.Wrapf(
|
||||||
|
Reference in New Issue
Block a user