mirror of
https://github.com/lwch/natpass.git
synced 2024-04-21 12:41:54 +00:00
修正读取剪贴板内容时无法正确设置返回值
This commit is contained in:
+5
-1
@@ -63,4 +63,8 @@
|
||||
|
||||
1. bootstrap降版到4.6.1
|
||||
2. dashboard页面支持规则类型筛选
|
||||
3. **为遵守中国法律,移除内网穿透功能**,保留shell和vnc功能不变
|
||||
3. **为遵守中国法律,移除内网穿透功能**,保留shell和vnc功能不变
|
||||
|
||||
# v0.7.1
|
||||
|
||||
1. vnc页面支持远程设置或读取剪贴板(仅支持文本内容)
|
||||
@@ -22,6 +22,8 @@ func (v *VNC) getClipboard(pool *pool.Pool, w http.ResponseWriter, r *http.Reque
|
||||
}
|
||||
conn := pool.Get(v.link.id)
|
||||
conn.SendVNCClipboardData(v.link.target, v.link.targetIdx, v.link.id, false, "")
|
||||
data := <-v.chClipboard
|
||||
fmt.Fprint(w, data.GetData())
|
||||
}
|
||||
|
||||
func (v *VNC) setClipboard(pool *pool.Pool, w http.ResponseWriter, r *http.Request) {
|
||||
|
||||
@@ -71,6 +71,8 @@ func (v *VNC) remoteRead(ctx context.Context, ch <-chan *network.Msg, local *web
|
||||
data, err := decodeImage(msg.GetVimg())
|
||||
runtime.Assert(err)
|
||||
replyImage(local, msg.GetVimg(), data, len(msg.GetVimg().GetData()))
|
||||
case network.Msg_vnc_clipboard:
|
||||
v.chClipboard <- msg.GetVclipboard()
|
||||
default:
|
||||
logging.Error("on message: %s", msg.GetXType().String())
|
||||
return
|
||||
|
||||
@@ -5,6 +5,7 @@ import (
|
||||
"natpass/code/client/global"
|
||||
"natpass/code/client/pool"
|
||||
"natpass/code/client/rule"
|
||||
"natpass/code/network"
|
||||
"net"
|
||||
"net/http"
|
||||
"sync"
|
||||
@@ -16,16 +17,18 @@ import (
|
||||
// VNC vnc handler
|
||||
type VNC struct {
|
||||
sync.RWMutex
|
||||
Name string
|
||||
cfg global.Rule
|
||||
link *Link
|
||||
Name string
|
||||
cfg global.Rule
|
||||
link *Link
|
||||
chClipboard chan *network.VncClipboard
|
||||
}
|
||||
|
||||
// New new vnc
|
||||
func New(cfg global.Rule) *VNC {
|
||||
return &VNC{
|
||||
Name: cfg.Name,
|
||||
cfg: cfg,
|
||||
Name: cfg.Name,
|
||||
cfg: cfg,
|
||||
chClipboard: make(chan *network.VncClipboard),
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user