2020-12-01 05:40:38 +13:00
|
|
|
package handler
|
|
|
|
|
|
|
|
import (
|
|
|
|
"demodesk/neko/internal/types"
|
|
|
|
"demodesk/neko/internal/types/message"
|
|
|
|
)
|
|
|
|
|
|
|
|
func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error {
|
2020-12-07 06:55:24 +13:00
|
|
|
if !session.CanAccessClipboard() {
|
|
|
|
h.logger.Debug().Str("id", session.ID()).Msg("cannot access clipboard")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2020-12-01 05:40:38 +13:00
|
|
|
if !session.IsHost() {
|
|
|
|
h.logger.Debug().Str("id", session.ID()).Msg("is not the host")
|
|
|
|
return nil
|
|
|
|
}
|
|
|
|
|
2021-01-30 08:05:13 +13:00
|
|
|
return h.desktop.ClipboardSetText(types.ClipboardText{
|
|
|
|
Text: payload.Text,
|
|
|
|
// TODO: Send HTML?
|
|
|
|
})
|
2020-12-01 05:40:38 +13:00
|
|
|
}
|