mirror of
https://github.com/m1k1o/neko.git
synced 2024-07-24 14:40:50 +12:00
24 lines
561 B
Go
24 lines
561 B
Go
package handler
|
|
|
|
import (
|
|
"demodesk/neko/internal/types"
|
|
"demodesk/neko/internal/types/message"
|
|
)
|
|
|
|
func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error {
|
|
if !session.CanAccessClipboard() {
|
|
h.logger.Debug().Str("session_id", session.ID()).Msg("cannot access clipboard")
|
|
return nil
|
|
}
|
|
|
|
if !session.IsHost() {
|
|
h.logger.Debug().Str("session_id", session.ID()).Msg("is not the host")
|
|
return nil
|
|
}
|
|
|
|
return h.desktop.ClipboardSetText(types.ClipboardText{
|
|
Text: payload.Text,
|
|
// TODO: Send HTML?
|
|
})
|
|
}
|