26 lines
570 B
Go
Raw Normal View History

2020-11-30 17:40:38 +01:00
package handler
import (
"demodesk/neko/internal/types"
"demodesk/neko/internal/types/message"
)
func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) 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().CanAccessClipboard {
2021-08-29 18:23:58 +02:00
logger.Debug().Msg("cannot access clipboard")
2020-12-06 18:55:24 +01:00
return nil
}
2020-11-30 17:40:38 +01:00
if !session.IsHost() {
2021-08-29 18:23:58 +02:00
logger.Debug().Msg("is not the host")
2020-11-30 17:40:38 +01:00
return nil
}
return h.desktop.ClipboardSetText(types.ClipboardText{
Text: payload.Text,
// TODO: Send HTML?
})
2020-11-30 17:40:38 +01:00
}