## Problem and outcome Connection recovery and packet repair could leave stale pictures, missing sound or unreliable remote input. This maintenance release repairs media/route ownership, H.264 negotiation, voice forwarding and Windows input recovery, and makes shared mobile controls and popovers easier to use. ## Release notes **Piik, now in your pocket.** Piik App supports Android screen sharing, with touch controls for a friend's computer. **手机,也能开播。** Piik App 支持 Android 屏幕分享,也能用手机控制朋友的电脑。 ### English Piik v2.5.1 improves sharing recovery, voice playback and remote control, with clearer mobile controls. It keeps the existing 2.x compatibility baseline. - Improve H.264 selection and picture recovery after reconnecting, changing sources or recovering lost packets; keep a working share when a replacement source fails. - Keep audio and room voice continuous, and prevent duplicate sound when switching playback windows. - Improve Windows input recovery and release remote-control permissions when their connection ends. - Keep mobile controls together and popovers usable after layout changes or in short viewports. - Open the appropriate Android update download, including the Gitee ZIP containing the APK. Self-hosted SFU servers refresh public addresses for new connections without a restart. - Add macOS source-thumbnail support. Update the App and self-hosted site together to receive all fixes. Browser settings and existing room data are retained. ### 中文 Piik v2.5.1 改善分享恢复、语音播放与远程控制的稳定性,让手机操作更顺手,沿用现有 2.x 兼容基线。 - 改善 H.264 编码选择,以及重连、切换分享源和丢包后的画面恢复;新分享源切换失败时保留正常分享。 - 保持声音与房间语音连续,避免切换播放窗口时出现双重声音。 - 改善 Windows 输入恢复,并在连接结束时释放远程控制授权。 - 手机控件保持成组,浮层在布局变化或可见高度较小时仍可操作。 - Android 更新打开对应下载入口,Gitee 提供内含 APK 的 ZIP;自部署 SFU 为新连接刷新公网地址,无需重启服务。 - 补齐 macOS 选源缩略图支持。 请一起更新 App 与自部署站点,以获得全部修复。浏览器设置与已有房间数据保留。 ## Validation - Full frontend typecheck, test and production-build acceptance; current Windows App/Server packaging, extracted-file checks and exact served JavaScript verified locally. - Existing Go, vulnerability, native media and controlled-network results retained at their tested revisions. The final production delta from the fully checked candidate is the shared short-viewport popover correction. - The diagnostic report supplied for #502 informed the Windows input fixes. #500 sharing is confirmed working; its missing source previews are implemented. Original-device follow-up remains separate from this release's verified local fixes. ## Compatibility and scope Preserves the published 2.x Browser/server, Native control, capture and SQLite contracts. No 3.0 or iOS implementation or external contributor patch is included. Related: #500, #502, #510, #512.
149 lines
5.3 KiB
Go
149 lines
5.3 KiB
Go
package remoteinput
|
|
|
|
import (
|
|
"errors"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
type textReleaseSink struct {
|
|
*recordedInput
|
|
reject bool
|
|
}
|
|
|
|
func (s *textReleaseSink) Apply(b bounds, event inputEvent) error {
|
|
if s.reject && event.Type == "key" && !event.Down {
|
|
return errors.New("text key release rejected")
|
|
}
|
|
return s.recordedInput.Apply(b, event)
|
|
}
|
|
|
|
func TestPartialTextOnlyRetriesRelease(t *testing.T) {
|
|
sink := &textReleaseSink{recordedInput: &recordedInput{events: make(chan inputEvent, 32), resets: make(chan struct{}, 16), focused: true}, reject: true}
|
|
m := &Manager{sink: sink, connections: map[endpointKey]*connection{}}
|
|
_, peers := coPlaySession(t, m, true)
|
|
c := peers[0]
|
|
sendTestInput(m, c, inputEvent{Type: "request"})
|
|
grant := c.grant
|
|
sendTestInput(m, c, inputEvent{Type: "text", Text: "once\nnever"})
|
|
if c.grant != grant || !c.inputFailed || !m.pendingKeys["Enter"] {
|
|
t.Fatal("text failure changed grant or lost release debt")
|
|
}
|
|
if event := <-sink.events; event.Text != "once" {
|
|
t.Fatal("text prefix was not delivered")
|
|
}
|
|
if event := <-sink.events; event.Code != "Enter" || !event.Down {
|
|
t.Fatal("text did not execute newline press")
|
|
}
|
|
sink.reject = false
|
|
m.retryReleases()
|
|
if len(sink.events) != 1 {
|
|
t.Fatal("text failure replayed a text fragment")
|
|
}
|
|
if event := <-sink.events; event.Code != "Enter" || event.Down {
|
|
t.Fatal("text recovery did not restrict itself to release")
|
|
}
|
|
}
|
|
|
|
func TestRejectedInputKeepsGrantAndDoesNotReplay(t *testing.T) {
|
|
for _, shared := range []bool{false, true} {
|
|
t.Run(map[bool]string{false: "ordinary", true: "shared"}[shared], func(t *testing.T) {
|
|
sink := &recordedInput{events: make(chan inputEvent, 32), resets: make(chan struct{}, 16), focused: true}
|
|
m := &Manager{sink: sink, connections: map[endpointKey]*connection{}}
|
|
s, peers := coPlaySession(t, m, true)
|
|
s.coPlay = shared
|
|
c := peers[0]
|
|
sendTestInput(m, c, inputEvent{Type: "request"})
|
|
grant := c.grant
|
|
sink.applyErr = errors.New("temporarily rejected")
|
|
sendTestInput(m, c, inputEvent{Type: "key", Code: "KeyA", Down: true})
|
|
if grant == "" || c.grant != grant || !c.inputFailed || len(c.keys) != 0 {
|
|
t.Fatal("failed press changed grant or became held")
|
|
}
|
|
sink.applyErr = nil
|
|
m.retryReleases()
|
|
if len(sink.events) != 0 {
|
|
t.Fatal("failed press was replayed")
|
|
}
|
|
sendTestInput(m, c, inputEvent{Type: "key", Code: "KeyB", Down: true})
|
|
if c.grant != grant || c.inputFailed || !c.keys["KeyB"] {
|
|
t.Fatal("new input did not recover within grant")
|
|
}
|
|
<-sink.events
|
|
sink.applyErr = errors.New("release rejected")
|
|
sendTestInput(m, c, inputEvent{Type: "key", Code: "KeyB"})
|
|
if c.grant != grant || !m.pendingKeys["KeyB"] || c.keys["KeyB"] {
|
|
t.Fatal("failed release lost cleanup debt or grant")
|
|
}
|
|
if err := m.applyHeld(c, bounds{}, inputEvent{Type: "move", X: .7, Y: .4}); !errors.Is(err, sink.applyErr) || !strings.Contains(err.Error(), "key release retry") {
|
|
t.Fatalf("cleanup hid the rejected release: %v", err)
|
|
}
|
|
if len(sink.events) != 0 {
|
|
t.Fatal("new action ran before cleanup")
|
|
}
|
|
sink.resetErr = errors.New("reset blocked")
|
|
m.releaseConnection(c)
|
|
if c.grant != "" || !m.pendingKeys["KeyB"] {
|
|
t.Fatal("retirement lost pending release")
|
|
}
|
|
sink.applyErr = nil
|
|
sink.resetErr = nil
|
|
m.retryReleases()
|
|
if len(m.pendingKeys) != 0 || len(sink.events) != 1 {
|
|
t.Fatal("retired release did not recover")
|
|
}
|
|
if event := <-sink.events; event.Type != "key" || event.Code != "KeyB" || event.Down {
|
|
t.Fatalf("cleanup replayed action: %+v", event)
|
|
}
|
|
})
|
|
}
|
|
}
|
|
|
|
func TestPlayerCleanupFailurePreservesSiblingGrant(t *testing.T) {
|
|
sink := &recordedInput{events: make(chan inputEvent, 32), resets: make(chan struct{}, 16), focused: true}
|
|
m := &Manager{sink: sink, connections: map[endpointKey]*connection{}}
|
|
s, peers := coPlaySession(t, m, true, true)
|
|
a, b := peers[0], peers[1]
|
|
for _, c := range peers {
|
|
sendTestInput(m, c, inputEvent{Type: "request"})
|
|
}
|
|
grant := b.grant
|
|
sendTestInput(m, a, inputEvent{Type: "button", Button: 0, Down: true})
|
|
<-sink.events
|
|
sink.applyErr = errors.New("release blocked")
|
|
sendTestInput(m, a, inputEvent{Type: "reset"})
|
|
if a.grant == "" || b.grant != grant || !a.inputFailed || !m.pendingButtons[0] {
|
|
t.Fatal("personal reset changed authority or lost release")
|
|
}
|
|
m.releaseConnection(a)
|
|
if b.grant != grant || m.owner != s {
|
|
t.Fatal("disconnect cleanup revoked sibling")
|
|
}
|
|
if err := m.applyHeld(b, bounds{}, inputEvent{Type: "move", X: .5, Y: .5}); !errors.Is(err, sink.applyErr) || !strings.Contains(err.Error(), "button release retry") {
|
|
t.Fatalf("shared cleanup hid the rejected button release: %v", err)
|
|
}
|
|
sink.applyErr = nil
|
|
m.retryReleases()
|
|
if event := <-sink.events; event.Type != "button" || event.Down {
|
|
t.Fatal("cleanup replayed press")
|
|
}
|
|
sendTestInput(m, b, inputEvent{Type: "key", Code: "KeyW", Down: true})
|
|
<-sink.events
|
|
sink.resetErr = errors.New("focus cleanup blocked")
|
|
sink.focused = false
|
|
m.refreshActive()
|
|
if b.grant != grant || !b.suspended || !m.pendingKeys["KeyW"] {
|
|
t.Fatal("focus cleanup lost grant or release debt")
|
|
}
|
|
m.retryReleases()
|
|
if event := <-sink.events; event.Code != "KeyW" || event.Down {
|
|
t.Fatal("focus cleanup replayed press")
|
|
}
|
|
sink.resetErr = nil
|
|
sink.focused = true
|
|
m.refreshActive()
|
|
if b.grant != grant || b.suspended || len(sink.events) != 0 {
|
|
t.Fatal("focus return changed grant or replayed action")
|
|
}
|
|
}
|