+ CanAccessClipboard.

This commit is contained in:
Miroslav Šedivý 2020-12-06 18:55:24 +01:00
parent 5edd9dc97a
commit e17e2cb606
2 changed files with 10 additions and 2 deletions

View File

@ -6,6 +6,11 @@ import (
)
func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error {
if !session.CanAccessClipboard() {
h.logger.Debug().Str("id", session.ID()).Msg("cannot access clipboard")
return nil
}
if !session.IsHost() {
h.logger.Debug().Str("id", session.ID()).Msg("is not the host")
return nil

View File

@ -121,6 +121,11 @@ func (ws *WebSocketManagerCtx) Start() {
break
}
current = text
if !session.CanAccessClipboard() {
break
}
if err := session.Send(
message.ClipboardData{
Event: event.CLIPBOARD_UPDATED,
@ -128,8 +133,6 @@ func (ws *WebSocketManagerCtx) Start() {
}); err != nil {
ws.logger.Warn().Err(err).Msg("could not sync clipboard")
}
current = text
}
time.Sleep(100 * time.Millisecond)