neko/internal/websocket/handler/clipboard.go
2021-09-01 23:10:18 +02:00

24 lines
484 B
Go

package handler
import (
"errors"
"demodesk/neko/internal/types"
"demodesk/neko/internal/types/message"
)
func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error {
if !session.Profile().CanAccessClipboard {
return errors.New("cannot access clipboard")
}
if !session.IsHost() {
return errors.New("is not the host")
}
return h.desktop.ClipboardSetText(types.ClipboardText{
Text: payload.Text,
// TODO: Send HTML?
})
}