mirror of
https://github.com/m1k1o/neko.git
synced 2025-06-25 22:18:11 +02:00
+ CanAccessClipboard.
This commit is contained in:
parent
5edd9dc97a
commit
e17e2cb606
2 changed files with 10 additions and 2 deletions
|
@ -6,6 +6,11 @@ import (
|
||||||
)
|
)
|
||||||
|
|
||||||
func (h *MessageHandlerCtx) clipboardSet(session types.Session, payload *message.ClipboardData) error {
|
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() {
|
if !session.IsHost() {
|
||||||
h.logger.Debug().Str("id", session.ID()).Msg("is not the host")
|
h.logger.Debug().Str("id", session.ID()).Msg("is not the host")
|
||||||
return nil
|
return nil
|
||||||
|
|
|
@ -121,6 +121,11 @@ func (ws *WebSocketManagerCtx) Start() {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
current = text
|
||||||
|
if !session.CanAccessClipboard() {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
if err := session.Send(
|
if err := session.Send(
|
||||||
message.ClipboardData{
|
message.ClipboardData{
|
||||||
Event: event.CLIPBOARD_UPDATED,
|
Event: event.CLIPBOARD_UPDATED,
|
||||||
|
@ -128,8 +133,6 @@ func (ws *WebSocketManagerCtx) Start() {
|
||||||
}); err != nil {
|
}); err != nil {
|
||||||
ws.logger.Warn().Err(err).Msg("could not sync clipboard")
|
ws.logger.Warn().Err(err).Msg("could not sync clipboard")
|
||||||
}
|
}
|
||||||
|
|
||||||
current = text
|
|
||||||
}
|
}
|
||||||
|
|
||||||
time.Sleep(100 * time.Millisecond)
|
time.Sleep(100 * time.Millisecond)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue