Commit Graph
274 Commits
  • feat!: expand media controls and simplify App connections
    ## Problem and outcome / 问题与结果
    
    Piik's media settings were coupled to a small preset list, and using native App capture on a Site required a separate launcher mode. This release separates numeric media requests from presets and bounded runtime admission, remembers successfully applied settings, and lets a running App serve an explicitly approved Site independently of Local/public room startup.
    
    The same phase repairs confirmed capture-retirement, ICE discovery, media-recovery and storage failures. P2P-first routing, one room authority and the existing Browser/Native media owners remain. This phase targets **v2.0.0** with incompatible Web/App contracts. The owner authorized publication after final acceptance; the verified package and deployment records own delivery completion.
    
    ## Release notes
    
    ### 中文
    
    Piik 2.0 扩展了画质设置,简化了 App 与站点的连接,并集中修复采集和断线恢复问题。**本次升级调整了通信协议,App 与所用站点需要一起升级。**
    
    #### 新功能与改进
    
    - **自定义画面设置:** 保留三档推荐预设,支持填写分辨率上限、1–240 帧的帧率上限和 0.1–240 Mbps 的视频码率上限。滑动条沿用常用范围,更高数值可直接填写并显示为“自定义”。帧率范围随画幅变化,可请求 1080p240、1440p144、4K60 和超宽画面;输出保留来源比例。
    - **自定义音频质量:** 在原有三档音频预设之外,可填写 6–320 kbps 的来源音频码率上限。
    - **双端 App 协同连接:** 启用增强 NAT 穿透后,适用的重试可协调双方 App 准备 UDP 连接;首次连接仍走普通 ICE,不适用时继续现有流程。已通过受控网络验证,实际连通性仍取决于双方网络。
    - **记住分享设置:** 下次打开时恢复已应用的画面与音频质量。仅用浏览器时按站点保存;通过新版 App 使用时,更换临时公网邀请网址也能保留设置。
    - **更直接地连接 App:** 启动页提供本地房间和公网邀请,首次默认选择公网邀请。使用已有站点时,保持 App 运行,在站点点击 **App** 并确认授权即可。App 打开的本地房主页自动获得授权,站点按钮会显示 App 就绪状态。启动页可查看或取消授权;从另一个站点连接并批准,会替换原授权。
    - **置顶聊天窗口:** 支持的桌面浏览器可将聊天移入独立置顶窗口,保留当前消息、草稿和阅读位置;关闭窗口后回到原页面。
    
    #### 修复
    
    - **连接与恢复:** 完善备用 STUN 与 NAT 采样信息的处理;重新收集 ICE 候选时刷新网卡地址。修正观众重连的机会计数、本机媒体连接恢复,以及恢复后遗留的发送队列和带宽统计问题。保留视频编码对应的标准重传能力,改善网络地址变化后的画面恢复。
    - **采集稳定性:** 修正 Windows 停止采集或预览时的异步资源释放问题,保留采集边框偏好,更快跳过无法正常输出的编码器。采集与应用音频能力按实际接口探测,不再按 Windows 版本号排除;修正 Linux Portal 来源识别和早期采集失败通知,改善摄像头与原生采集的画面比例处理。
    - **状态与清理:** 房间失效时及时释放 App 连接和待完成的选源请求;本地或公网房间启动失败时,App 保持待机并保留其他已授权站点的连接;公网邀请启动失败保留底层错误。修正启动页旧查询覆盖新设置的问题,并限制原生连接准备的待完成任务。SFU 诊断区分房主发布和观众接收状态。
    - **其他维护:** 收到尚不支持的表情时跳过该效果;修正 SQLite 写入失败后的事务恢复。Gitee 镜像可独立重试,官网交互、指南和依赖同步更新。App 连接失败时提供重试与下载入口;统一选源设置与自定义数值的反馈。减少重复的随机短语,仅在持续等待时定时轮换。
    
    #### 升级须知
    
    **2.0 与 1.x 不能混用。** 自建站点请更新 Server 和连接该站点的 App,并刷新所有分享与观看页面。本地房间或公网邀请用户请停止分享、关闭旧 App,完整解压新版程序包后重新发送邀请链接。
    
    本次不变更房间数据库结构。重启会中断正在进行的分享;麦克风、采集权限和设备选择不会自动恢复。4K60 等设置是输出上限,实际清晰度与帧率取决于来源、设备和网络。macOS/Linux 采集及部分移动设备仍需更多实机反馈。
    
    ### English
    
    Piik 2.0 adds more control over sharing quality, simplifies connecting the App to a Site, and fixes capture and connection-recovery failures. **The communication contracts change in this release: update the App and its Site together.**
    
    #### Highlights
    
    - **Custom picture settings:** Keep the three recommended presets or enter a resolution ceiling, a 1–240 fps limit and a 0.1–240 Mbps video bitrate limit. Sliders retain their familiar ranges; higher entered values are clearly marked as custom. Frame-rate limits depend on picture size, admitting requests such as 1080p240, 1440p144, 4K60 and ultrawide pictures while preserving source proportions.
    - **Custom audio quality:** Enter a 6–320 kbps source-audio bitrate limit alongside the three existing audio presets.
    - **Coordinated App connections:** With enhanced NAT traversal enabled, eligible retries can coordinate UDP preparation between two Apps. The first attempt remains ordinary ICE, and ineligible preparation continues through the existing path. Controlled network checks pass; real-world connectivity still depends on both networks.
    - **Remember sharing settings:** Restore successfully applied picture and audio quality next time. Browser-only use saves settings per site; an updated App can retain them across changing temporary public-invitation addresses.
    - **Connect the App from a Site:** The launcher offers Local room and Public invite, with Public invite selected on first use. For an existing Site, keep the App running, click **App** on the Site and confirm its authorization. Host pages opened locally by App are authorized automatically, and the Site button reflects verified App readiness. View or revoke approval in the launcher. Connecting and approving another Site replaces the previous approval.
    - **Always-on-top chat:** Supported desktop browsers can move chat into a separate always-on-top window while retaining messages, drafts and reading position. Closing the window returns chat to the page.
    
    #### Fixes
    
    - **Connections and recovery:** Improve fallback STUN discovery and NAT survey handling, and refresh interface addresses during ICE gathering. Fix Viewer recovery-opportunity accounting, local media-connection recovery, stale send queues and bandwidth accounting after recovery. Preserve standard video retransmission when selecting a codec to improve picture recovery after network-address changes.
    - **Capture stability:** Fix asynchronous Windows resource retirement after capture or preview ends, retain the capture-border preference, and reject non-performing encoder candidates earlier. Detect capture and process-audio support through actual APIs rather than Windows-version gates. Correct Linux Portal target identification and early capture-failure delivery; improve source-aspect handling for camera and native capture.
    - **State and cleanup:** Release App connections and pending source selection when room authority ends. Keep the App on standby and preserve other authorized Site connections when interactive Local/public room startup fails. Retain underlying public-invitation startup errors. Prevent stale launcher reads from replacing newer settings, bound pending native connection-preparation work, and distinguish Host publication from Viewer reception in SFU diagnostics.
    - **Maintenance:** Skip unsupported incoming reaction effects, recover SQLite transactions after write failures, and retry Gitee mirroring independently. Update website interactions, guides and dependencies; clarify App connection recovery, source-selection settings and custom-value feedback. Reduce repeated playful captions, with timed rotation reserved for ongoing waits.
    
    #### Upgrading
    
    **2.0 and 1.x cannot be mixed.** For a hosted Site, update its Server and connected Apps, then refresh every Host and Viewer page. For Local rooms or Public invites, stop sharing, close the old App, extract the complete new package and send a fresh invitation.
    
    The room database schema is unchanged. Restarting interrupts active shares; microphone activation, capture permission and device selection are not restored automatically. Settings such as 4K60 are output ceilings: actual resolution and frame rate depend on the source, device and network. macOS/Linux capture and some mobile devices still need more physical-device feedback.
    
    ## Verification / 验证
    
    - Product candidate: `24a28738241b9012c0476386356a515aab21f1a5`, built as `v2.0.0`. [Final full candidate CI](https://github.com/TNTcraftHIM/Piik/actions/runs/38555494851) covers core validation, vulnerabilities, races, five App packages and both Server/container targets without publishing. Later commits extend race coverage, correct the capture test fixture's inherited Go race-exit delay, and update documentation/staged website screenshots; shipped product code is unchanged. [Additional control/loopback race checks](https://github.com/TNTcraftHIM/Piik/actions/runs/38561191343) use that updated collector. Product shutdown deadlines and test assertions are unchanged.
    - Local Web acceptance passes **91 files / 1,612 tests**, type checking and production build. Full Go/native checks, Windows capture compilation, five-repeat control regressions, website/documentation build and repository checks pass. Existing documentation-size and bundle-size warnings remain visible.
    - The Windows candidate's original descriptor, revision and SHA-256 are checked before extraction and packaged Local/control acceptance. All candidate packages pass the release publisher's read-only identity/checksum verification.
    - Serial Windows native H.264 Host acceptance passes live/paused/custom/4K settings, background/source recovery and stop/re-share. VP8 two-room SFU and H.264 SFU-only checks pass live quality/audio changes, subscription/page-reload recovery and retirement; stopping one room preserves the other room's media. Browser-to-App fanout and App-exit fallback also pass. Gates clean their processes, profiles and listeners. These checks do not establish sustained game/4K performance.
    - The final network run passes **37 cases and six negative controls**, with **32 actual media outcomes and five unavailable observations**. It covers all Browser/App pairings, IPv6, remapping, STUN backup, outages, quality recovery, healthy siblings and SFU policies. Sequential-NAT App/App preparation delivers media; a mixed sequential case also connects in this run, without a claim of deterministic benefit. Fault controls reject absent faults/frozen video and verify cancellation/cleanup. No public success percentage is inferred.
    - Twenty Viewer topology acceptance delivers increasing decoded frames to all Viewers, preserves the two-copy bound and recovers from relay loss. Invitation privacy checks find no grant leakage in requests, cookies, persistent storage or logs. Both are bounded synthetic-source checks, not public-network endurance.
    - Current UI checks cover Chinese/English/visual, both themes and 320/360/768/1366-pixel layouts, numeric limits, source selection, App approval/revocation, architecture downloads and reader navigation. Chat/PiP retains draft/history/scroll and returns to the page on close; retirement and refused opening clean up. Real Host/Viewer UI chat continues after capture stops and while the Host is absent. Film controls, mute/seek/end/replay, mobile containment and pointer-close unloading pass. README stills and the staged launcher now use current navigation. Scoped axe checks report no violations; contrast and physical assistive-technology coverage are not certified.
    - Physical macOS/Linux capture, limited decoders, mixed HDR displays, mobile permissions and sustained game/4K use retain their [evidence limits](https://github.com/TNTcraftHIM/Piik/blob/ci/gitee-mirror/docs/verification-status.md). Unmatched field reports remain open. Gitee activation and public-domain checks are publication postflight; original v1.9.2 artifact/mirror recovery already passed without remote writes.
    
    ## Boundaries and contributor credit / 边界与贡献
    
    The candidate uses Browser/server v24 and Native control v10; capture v7 and SQLite schema 2 are unchanged. Numeric wire values remain separate from codec/allocation admission. H.264/VP8, framework-owned adaptation and automatic P2P-first routing remain; this candidate adds neither codecs, room voice, end-to-end HDR, surround audio nor Magicsock.
    
    Local controls confirm specific repairs, not the causes of unmatched user reports or a measured increase in NAT success rate. The STUN report in #471 remains subject to paired endpoint/network evidence. Gitee's separate workflow activation still needs post-merge verification; its original-artifact and anonymous-download path has passed against v1.9.2.
    
    The Linux Portal fix from @AkazaAkali in #470 is incorporated with original commit authorship and the co-author trailer below. #462 and #469 propose higher audio rates and 4K; neither patch is merged. Their preset-expansion implementation is superseded by the independently established numeric-media contract, so overlapping functionality alone does not warrant merging or co-authorship. #475 identifies the Linux desktop entry’s missing terminal controls; that defect is independently corrected without accepting tray or Browser-owned process-exit additions. The settings request in #460 is implemented; issue/PR closure remains part of release follow-up.
    
    Co-authored-by: AkazaAkalin <478080766@qq.com>
  • fix(rooms): reclaim empty rooms on public sites (#456)
    Public sites can exhaust the four-digit room-code pool because retained room authority has no default expiry. Add an opt-in empty-room timeout and reclaim the oldest eligible empty room when capacity is exhausted. Connected Hosts and Viewers retain their rooms through sharing, pause and idle chat; the existing reconnect grace protects early reclamation.
    
    The default remains disabled, including App Local and the internal deployment. The public Demo will use `ROOM_EMPTY_TIMEOUT_SECONDS=3600`. Retirement reuses the storage-first deletion and signaling cleanup owners; no protocol or SQLite schema changes are required.
    
    Validation: Web type-check, 81 test files / 1372 tests and production build; Go core tests, formatting, vet and target builds; documentation/project hygiene; access-privacy gate; live server expiry/occupied-room check. Regression coverage includes all 9000 codes, restart, stale credentials, reconnects, revocation and atomic storage failure. Native device behavior is unchanged; physical macOS/Linux acceptance retains its documented limits.
    
    ## Release notes
    
    ### 中文
    
    这是一次面向公共站点的维护更新,解决长期保留的空房间占满房间号的问题。
    
    - 管理员可配置空房间回收时长;号码用满时,优先回收过期空房间,再按创建顺序回收符合条件的空房间。在线分享、暂停和聊天均会保留。
    - 房间号确实已用满时,界面会显示更明确的提示。
    - 自动回收默认关闭。公共站点可设置 `ROOM_EMPTY_TIMEOUT_SECONDS=3600`,在房间连续无人在线一小时后回收;未配置的站点保持原有行为。
    
    ### English
    
    This maintenance release helps public sites avoid exhausting room codes through indefinitely retained empty rooms.
    
    - Operators can configure an empty-room timeout. When all codes are in use, allocation reclaims expired empty rooms first, then the oldest eligible empty room. Connected sharing, paused sessions and chat remain protected.
    - Capacity errors now provide clearer guidance when no room code is available.
    - Automatic reclamation is disabled by default. Public sites can set `ROOM_EMPTY_TIMEOUT_SECONDS=3600` to retire rooms after one continuous hour with no connected participants. Unconfigured sites retain their existing behavior.
  • feat: add room interactions and media sharing improvements
    ## Problem and outcome / 问题与结果
    
    This phase adds lightweight room interaction without making media depend on chat,
    and adds Windows source-audio exclusion and optional SFU-only hosting at their
    existing owners. It also corrects confirmed encoder/capture ownership and native
    color-conversion defects. Host microphone commentary remains on the shared media
    path; room voice and 4K are outside this phase.
    
    ## Release notes
    
    ### 中文
    
    这是一次功能更新:Piik 加入了文字聊天与表情互动,并完善了 Windows 声音采集、画面颜色和自部署选项。
    
    #### 新功能
    
    - **边看边聊。** 在可移动、可缩放的聊天窗口中发送消息,或开启弹幕。停止分享后,房间中的朋友仍可继续聊天。
    - **表情互动。** 点击沙发上的人物,给自己发表情,或把番茄等表情送给朋友;各端按同一事件显示动画。
    - **排除应用声音。** Windows App 分享整个屏幕时,可排除一个应用及其子进程的声音,适合同时使用语音软件。所选应用退出后,来源声音停止,避免恢复为未过滤的系统声音。
    - **可选的纯 SFU 模式。** 自部署管理员可让共享画面和声音统一通过媒体服务器转发。默认仍为优先 P2P;App 公网邀请保持纯 P2P。
    - **Windows HDR 转 SDR。** 原生采集与缩略图自动将 HDR 来源转换为 SDR,沿用现有观看链路。
    
    #### 修复与改进
    
    - 修复原生颜色转换的范围与矩阵处理,避免已复现的暗部丢失、高光裁切和颜色偏差。
    - 修复共享编码器切换时使用过期需求或过期帧信息的问题,保护正在观看的画面;修复换源后旧采集事件可能影响新来源的问题。
    - 统一新控件、浮窗与来源选择文案,补充中英文使用说明。
    
    #### 使用与升级
    
    聊天与表情需要新版站点页面和 Server;声音排除需要新版页面与支持此能力的 Windows App。聊天只保留本页最近收到的消息,刷新后清空,不补发历史,且不提供端到端加密。
    
    HDR 转换输出为 SDR,不代表端到端 HDR 或多声道支持。既有房主麦克风与立体声能力保留。
    
    ### English
    
    This feature update brings text chat and reactions to Piik, alongside improvements to Windows audio capture, picture colors and self-hosting options.
    
    #### New features
    
    - **Chat while watching.** Send messages in a movable, resizable window, or enable on-screen chat. Friends can keep chatting after the host stops sharing.
    - **Reactions.** Select a person on the sofa to react above yourself or send a tomato and other reactions to a friend. Participants animate the same shared event.
    - **Exclude application audio.** When sharing a whole screen with Windows App, exclude one application and its child processes, useful when using a separate voice app. Source audio stops if the selected app exits, preventing a return to unfiltered system sound.
    - **Optional SFU-only hosting.** Site operators can require shared video and audio to pass through the media server. P2P-first remains the default; App Public invite remains P2P-only.
    - **Windows HDR-to-SDR conversion.** Native capture and source thumbnails automatically convert HDR sources to SDR for the existing viewing path.
    
    #### Fixes and improvements
    
    - Correct native color-conversion ranges and matrices, addressing reproduced crushed shadows, clipped highlights and color shifts.
    - Correct stale demand and frame evidence during shared-encoder handoffs to protect the current picture. Prevent events from a replaced capture from affecting its successor.
    - Align new controls, floating panels and source-picker copy, with updated Chinese and English guides.
    
    #### Using this update
    
    Chat and reactions require updated site pages and Server. Audio exclusion requires updated pages and a Windows App that supports the capability. Chat retains only recent messages received by the current page, clears on refresh and does not replay history. It is not end-to-end encrypted.
    
    HDR conversion produces SDR; it does not add end-to-end HDR or surround sound. Existing host microphone commentary and stereo support remain available.
    
    ## Verification / 验证
    
    - Web type checks, 78 test files / 1275 tests and production build: PASS.
    - Go core tests, formatting/vet and target builds: PASS; Darwin cgo remains platform-limited on this Windows runner.
    - Native build/check/color probes and synthetic HDR-to-SDR H.264/VP8 browser reception: PASS.
    - Access/privacy gate, Native H.264 SFU-only media gate and local Auto/H.264 Host gate: PASS.
    - Three real production pages: chat/reactions, stop/resume, idle-room join, host departure/return, offline draft recovery and invitation revocation: PASS.
    - Synthetic parent/child process-audio exclusion and target lifetime: PASS; no raw audio retained.
    - Windows candidate archive extraction and packaged Local startup/shutdown: PASS.
    - Documentation and website build: PASS.
    - [Candidate CI](https://github.com/TNTcraftHIM/Piik/actions/runs/36873766646) at
      `f26cd208d03bc0dcbe353f8cac217f993216b0a3`: Go core and race checks, Web tests,
      Server/container checks and Windows/macOS/Linux App packaging all PASS.
      Publication was skipped as intended.
    
    The owner accepted the UI/model and bounded local walkthrough for phase closure.
    Physical HDR/mixed displays, mobile keyboard,
    real voice applications across output devices and macOS/Linux capture remain
    unverified. Existing field reports without matched evidence are not claimed
    resolved. The owner authorized v1.7.0 publication on 2026-10-02. The final
    documentation-only commit records that authorization; product code matches
    the verified candidate above.
    
    ## Impact / 影响
    
    Authorized version: **v1.7.0**, matching the local release planner. Current wire
    contracts remain Browser/server 23, Native control 9 and capture 7. Optional
    capabilities gate new functionality; existing room/media authority remains owned
    by the existing services. No new ports, message persistence, room voice or
    automatic room creation on page visit. Updated README, guides, standards,
    research evidence and TODO stay with the candidate phase.
  • fix(app): improve capture selection and media recovery (#433)
    ## Problem and outcome / 问题与结果
    
    This maintenance phase fixes failures around native capture startup, room reconnection and media handoffs. Capture mutations stay cancellable, relayed-content failures remain request-scoped, and failed media connections return to the existing route controller. Windows Auto codec selection measures delivered cadence instead of timer-sensitive per-frame work estimates.
    
    The phase preserves P2P-first routing, one committed graph and one route operation. It adds no signaling replay mechanism, changes no wire/schema version, and includes no interaction prototype or 4K feature work.
    
    ## Release notes
    
    ### 中文
    
    Piik v1.6.8 是一次稳定性修复,重点改善 Windows 原生采集、断线恢复和分享过程中的控制响应。
    
    #### 修复与改善
    
    - **更准确地选择编码器。** Windows 的自动模式按实际出帧表现评估 H.264,并正确区分启动预热和持续性能不足,减少计时误差导致的不必要 VP8 回退。硬件编码事件改为异步等待。
    - **改善断线与线路切换。** 房间信令短暂断开后保留观众成员身份 20 秒;修复线路切换、SFU 订阅恢复及声音重协商卡住的问题。失效连接及时交回现有路由控制器处理,原生 SFU 发送端不再把短暂断连直接判为终止。
    - **保持 App 控制响应。** 开始分享和更换来源时仍可取消操作;合法消息突发不再直接关闭控制连接。中继信令的单条内容错误不会连带结束整场原生分享。
    - **修正设备列表与配置保存。** 来源或麦克风数量达到上限时保留可用列表;配置替换失败时保留原有设置。
    - **改善紧凑布局和辅助功能。** 调整手机横屏下的画面与播控布局、画质预设标签和长邀请链接显示,修正部分提示与辅助功能语义。
    - **加强站点访问保护。** 站点登录 Cookie 使用独立随机签名密钥,应用自身阻止被其他页面嵌套。发布说明也会在合并前检查。
    
    #### 升级说明
    
    通信协议和持久化格式保持不变。设置了站点密码时,App 或 Server 重启后需要重新输入站点密码;持久化房间和邀请授权不受这项 Cookie 调整影响。Piik 操作页面不再支持嵌入 iframe。
    
    ### English
    
    Piik v1.6.8 is a stability update focused on Windows native capture, connection recovery and responsive sharing controls.
    
    #### Fixes and improvements
    
    - **More accurate codec selection.** Windows Auto mode evaluates H.264 using delivered frames and distinguishes startup warmup from sustained performance limits, reducing unnecessary VP8 fallback caused by timing noise. Hardware encoder events now use asynchronous waiting.
    - **Improved reconnection and route handoffs.** Viewer membership survives brief signaling outages for 20 seconds. Fixes cover route activation, SFU subscription recovery and stalled audio renegotiation. Failed connections return to the existing route controller, and the native SFU publisher no longer treats a transient disconnect as immediate termination.
    - **Responsive App controls.** Starting a share and replacing its source remain cancellable. Valid message bursts no longer close the control connection, and an invalid relayed payload cannot terminate the entire native sharing session.
    - **Device lists and saved settings.** Source and microphone enumeration retain a usable list at their limits. Failed configuration replacement preserves the previous settings.
    - **Compact layouts and accessibility.** Improved picture and playback-control layout on landscape phones, quality preset labels and long invitation links, with corrected tooltip and accessibility semantics.
    - **Stronger site-access protection.** Login cookies use an independent random signing key, and the application prevents embedding by other pages. Release notes are also checked before merge.
    
    #### Upgrade notes
    
    Wire protocols and persistent formats are unchanged. If a site password is configured, restarting the App or Server requires entering it again; this cookie change does not revoke persisted rooms or invitation grants. Piik operation pages can no longer be embedded in an iframe.
    
    ## Verification / 验证
    
    - `npm run check`: passed, 76 test files / 1,171 tests, TypeScript and production Web build.
    - `npm run check:go-core`: passed; full Go/native checks also passed during integration of the capture changes. macOS cgo builds remain native-runner checks.
    - Windows native Host gates: Auto, H.264 and VP8 passed during the phase; final control changes rechecked with Auto, including live/paused quality, source replacement, failure retirement and subsequent sharing.
    - Embedded SFU browser VP8 recovery: passed with production Host/Viewer route owners.
    - Embedded SFU native H.264, two rooms: passed, including recovered decoded video/audio, independent room retirement and resource cleanup.
    - Documentation, repository hygiene and diff checks: passed. Final follow-up changes only align operations documentation with the PR note check.
    - Go race checks could not run locally because no cgo/GCC toolchain is available; the existing Linux CI race job remains required. AMD/Intel hardware, broader device combinations, public-NAT field reports and long endurance are not established by these local checks.
    
    ## Impact / 影响
    
    Compatible patch release after v1.6.7. The cookie and frame-protection effects are disclosed in the public upgrade notes. No automatic retry budget, room-code admission policy, room lifetime or media topology is replaced. Reports without matched diagnostics and unmeasured native performance costs remain in the TODO ledger.
  • fix(media): contain connection failures and preserve stereo preferences
    An individually rejected ICE candidate could abort the App's local media bridge, an SFU publication or a Browser encoding probe. Separately, a retiring native downstream edge could propagate its closed transport into the shared source and stop capture. This phase keeps those failures at their existing resource owners, fences late bridge signaling after disposal, and corrects native Opus receive preferences.
    
    Existing candidate handling is reused across sibling paths. No route policy, retry budget, protocol version, configuration or UI is added. Browser ingress stereo normalization remains necessary for already-published Apps.
    
    Validation: `npm run check` (74 files, 1081 tests, type-check and Web build), `npm run check:go` (including Windows native compilation), documentation and repository hygiene passed. Windows Chrome H264 and VP8 gates passed candidate fault injection, resize/fullscreen/minimize transitions, live/paused settings, source replacement and re-sharing; Auto whole-display capture also passed. A real Chrome codec-probe comparison reproduces the old false H264 rejection and verifies the correction. Regression tests reproduce the downstream retirement and receive-preference defects. Linux CI owns the Go race check because the local Windows environment lacks cgo.
    
    Reported game/device failures remain unconfirmed without matched diagnostics. These fixes do not claim to resolve every share-start or game-entry failure. Interaction/voice/HDR work remains outside this release; its next steps are recorded in the existing TODO ledger.
    
    ## Release notes
    
    ### 中文
    
    这是一次分享稳定性修复更新,重点避免局部连接错误影响整场分享,并修正原生音频接收协商。
    
    - 修复单条 ICE 候选被拒绝时可能导致开播失败、SFU 发布中断,或自动编码检测误判的问题;连接会继续使用其他有效候选。
    - 修复原生下游连接关闭时可能误停整场分享的竞态,并阻止已关闭的本机媒体连接继续发送过期信令。
    - 修正原生接收端的 Opus 立体声偏好,首次连接和重新协商均会明确请求立体声。
    
    保持现有版本兼容,无需修改配置。具体游戏、显卡或网络环境中的异常仍需结合诊断记录确认。
    
    ### English
    
    This maintenance update improves sharing stability by containing local connection failures and correcting native audio receive negotiation.
    
    - Fixed cases where a rejected ICE candidate could prevent sharing, interrupt an SFU publication, or incorrectly rule out H264 during automatic codec detection. Other valid candidates remain usable.
    - Fixed a race where closing a native downstream connection could stop the entire share, and prevented disposed local media connections from sending stale signaling.
    - Corrected native Opus receive preferences to request stereo on both initial connection and renegotiation.
    
    Existing version compatibility is preserved; no configuration changes are required. Failures specific to a game, GPU or network still need matching diagnostics to establish their cause.
  • feat(app): add camera sharing and Host microphone controls
    ## Problem and outcome / 问题与结果
    
    Add camera sharing and Host microphone commentary to the existing Host workflow,
    with shared source cards, device selection, input gain and grouped sharing settings.
    Browser and native capture keep one outgoing audio track and the existing room/media
    owners. Include optional password-free invitations, public-tunnel protocol fallback,
    capture retirement and App-discovery feedback fixes. This is the complete capture
    maintenance phase; interaction, x86 capture and 4K experiments are excluded.
    
    ## Release notes
    
    ### 中文
    
    这次更新让分享多了两种表达方式:用摄像头展示现场,用麦克风边分享边讲解。
    分享设置也重新整理,并修复了公网邀请、音视频切换和采集退出中的一些问题。
    
    #### 新功能与使用改进
    
    - **摄像头分享**:在原有选源器中选择摄像头,支持设备选择和画面预览;支持摄像头访问的手机浏览器也可使用。
    - **房主麦克风**:浏览器分享和 App 原生采集均可混入房主声音,支持选择麦克风、静音和输入音量调节。观众仍使用原有音量控件收听。
    - **更集中的分享设置**:画质、声音和详细连接选项集中在画面下方,常用操作保持直接可用,并调整了窄屏播控与等待提示的布局。
    - **邀请链接可选择是否免密加入**:关闭后,链接不再附带免密邀请;接收者按当前站点和房间的准入设置加入。
    - **更清晰的启动设置**:可选站点口令默认收起,已有站点地址提供 `demo.piik.tv` 建议,并澄清 NAT 增强选项的含义。
    
    #### 修复
    
    - 公网邀请在 UDP 受限但 TCP 可用的网络中,可使用隧道组件原有的协议回退,减少这类启动失败。
    - 调整音频时保留健康的视频发送;修复旧采集事件干扰当前分享的情况。
    - 停止或取消原生采集时,先正常释放采集会话,超时才强制退出;修复本地复现的强制终止后 Windows 黄框残留问题。
    - 从 App 打开的页面无法连接 App 时,选源器保留明确提示,不再只剩浏览器和摄像头选项而缺少原因说明。
    
    #### 使用说明
    
    摄像头和音频能力取决于系统、浏览器与设备。Windows 仍可能因权限或其他采集要求显示边框。
    使用新增的 App 麦克风功能,请更新 App;连接自部署站点时,也请更新站点以获得对应页面功能。
    
    ### English
    
    This update adds camera sharing and Host microphone commentary, alongside a
    clearer sharing-settings layout. It also fixes several public-invitation,
    audio/video transition and capture-shutdown issues.
    
    #### Features and usability
    
    - **Camera sharing:** choose a camera in the existing source picker, with device selection and thumbnail previews. Phone browsers with camera access can share too.
    - **Host microphone:** add commentary to Browser sharing or App-native capture, with device selection, mute and input gain. Viewers listen through their existing volume controls.
    - **Grouped sharing settings:** picture quality, sound and detailed connection options sit below the picture, while frequent actions remain directly available. Narrow-screen playback and waiting layouts are refined.
    - **Optional password-free invitations:** turn this off to copy a link without an invitation credential. Recipients then follow the site's and room's current admission settings.
    - **Clearer startup settings:** optional site-password settings are collapsed, the existing-site field suggests `demo.piik.tv`, and the NAT enhancement option has a clearer description.
    
    #### Fixes
    
    - Public invitations can use the tunnel component's existing protocol fallback when UDP is blocked but TCP is available, reducing startup failures on those networks.
    - Audio changes preserve healthy video sending. Retired capture events no longer affect an active share.
    - Stopping or cancelling native capture releases the capture session before enforcing the shutdown deadline. This fixes a locally reproduced case where forced termination left a Windows capture border behind.
    - Pages opened from the App keep a clear connection warning in the source picker when the App cannot be reached, instead of showing only Browser and Camera without an explanation.
    
    #### Usage notes
    
    Camera and audio support depend on the OS, browser and device. Windows may still
    require a border because of permissions or another active capture.
    Update the App to use its new microphone feature; update self-hosted sites as
    well to receive the matching page controls.
    
    ## Verification / 验证
    
    - npm run check: 74 files / 1054 tests passed, TypeScript and production Web build passed.
    - npm run check:go: Go tests, vet, target builds and Windows native compile/regressions passed.
    - npm run gate:app-native-host: actual Windows H264 Host/Viewer, live/paused profile changes,
      quiet-source recovery, source replacement/failure, subsequent share and cleanup passed.
    - Windows 11 capture-border check: parent cancellation retires the actual WGC session and
      clears its border; subprocess tests verify normal, concurrent and timed-out retirement.
    - Website build, scripts typecheck, documentation and repository hygiene passed.
    - Native macOS/Linux packaging and Linux race checks run in CI before publication.
      Physical phone camera and real audio-level/echo/multiple-device coverage remain recorded
      limits; the owner authorized release with those limits. No universal NAT/border fix is claimed.
    
    ## Impact / 影响
    
    Compatible feature release **v1.6.0**, explicitly approved by the owner. Browser/Server v23,
    Native control v9 and capture v7 stay unchanged; new App microphone commands use capability
    negotiation. No new dependency, port, media route, room lifecycle or storage migration.
    Published Server cutover retains configuration and room storage and uses bounded health
    checks with the previous executable available for rollback. Source, tests and owned
    documentation ship together; exact artifact/deployment identities remain outside the repo.
  • feat: improve feedback and App lifecycle reliability (#404)
    Waiting feedback and tooltips now share consistent presentation lifecycles, while App shutdown and native-media operation failures stay within their owning session or output. This phase also consolidates the project standards and publishes searchable English/Chinese reader documentation alongside the homepage.
    
    Validation: repository hygiene and Markdown links; TypeScript, 971 Web tests and production build; website/documentation build; Go tests, vet and Windows/Linux builds with Windows capture checks; desktop/mobile UI and documentation review. Linux race, container and three-platform packaging checks run in the release pipeline. Physical macOS/Linux capture and broader network coverage remain outside this acceptance.
    
    The owner approved v1.4.0 publication. Existing empty-source, Windows URL-handler and public-invitation timeout reports remain tracked; this release makes no claim to resolve those device/network reports. The Windows capture-border request is next-phase work.
    
    ## Release notes
    
    ### 中文
    
    这是一次以稳定性和交互一致性为重点的功能更新。等待与提示更有反馈,App 启动、原生分享和连接恢复的边界处理得到改善,使用与部署指南也有了统一的文档中心。
    
    #### 新增与改进
    
    - 欢迎语、等待短句和六类可轮换的标签页标题共用一致的显示规则。等待短句从一开始就出现,并在停留时轮换;明确的错误与操作提示保持固定。
    - 房间准入等漫画采用更克制的小人物与循环动效。改进 tooltip 的定位与指向,减少对播放器的遮挡;状态、图标和文案保持相同含义。
    - 新增中英文文档中心,提供搜索、手机目录、使用教程、问题排查与自部署指南。官网 FAQ 聚焦开始使用前的问题,详细排查统一进入文档中心。
    
    #### 修复
    
    - 使用 `--local` 启动不再清空已保存的 Piik 站点地址。
    - 打开系统浏览器不再阻塞 App 的退出流程;改进临时公网邀请、终端和诊断导出在关闭时的清理及错误反馈。
    - 单条原生媒体连接的操作失败不再被误判为整个会话的协议错误;重复停止分享保持幂等。
    - 修复连接替换、转发停止和异常退出时的部分资源清理问题,避免迟到结果影响当前连接。
    - Windows 原生采集中,单个输出的编码错误只结束对应输出;共享采集源本身的错误仍会结束分享。
    
    #### 升级与已知边界
    
    本次保持现有协议版本与配置格式。更新 App 或自托管 Server 后,重新打开页面即可使用对应的新界面。
    
    个别设备的空窗口列表、Windows 浏览器启动异常,以及 Linux 编码输出的故障隔离仍在跟进。macOS/Linux 的物理采集和更广泛的公网网络场景仍需实机验证;本次不宣称这些问题已经解决,也不承诺所有网络都能直连。
    
    ### English
    
    This feature update focuses on stability and consistent feedback. Waiting states are easier to follow, App startup and native sharing handle several failure cases more reliably, and the new documentation center brings usage and deployment guides together.
    
    #### New and improved
    
    - Welcome lines, waiting captions and six groups of rotating tab titles follow one presentation lifecycle. Waiting captions appear immediately and rotate while visible; actionable errors and instructions remain fixed.
    - Room-admission comics use restrained characters and looping motion. Tooltips point more accurately to their controls and interfere less with the player, with consistent meanings across illustrations, icons and copy.
    - A new English/Chinese documentation center includes search, mobile navigation, usage guides, troubleshooting and self-hosting. The homepage FAQ covers questions before getting started and links to the documentation for detailed help.
    
    #### Fixes
    
    - Starting with `--local` no longer clears a saved Piik site address.
    - Opening the system browser no longer blocks App shutdown. Temporary public invitations, the terminal and diagnostic exports handle cleanup and exit errors more consistently.
    - An operation failure on one native media connection no longer becomes a protocol failure for the entire session. Repeated stop-sharing requests are safe.
    - Fixed cleanup cases during connection replacement, relay shutdown and unexpected exits, preventing late results from affecting the current connection.
    - On Windows, an encoder failure for one native output stops that output only. A failure of the shared capture source still ends sharing.
    
    #### Updating and known limits
    
    Protocol versions and configuration formats are unchanged. After updating the App or your self-hosted Server, reopen the page to use its updated interface.
    
    Empty source lists on some devices, Windows browser-launch failures and Linux output-failure isolation remain under investigation. Physical macOS/Linux capture and broader public-network coverage still need device testing; this update does not claim to resolve those cases or guarantee a direct connection on every network.
  • feat: launch Piik with a unified interface and public website
    Piik now has one public presentation and a coordinated App/Server release path. This phase unifies the room UI, rewrites the bilingual README and guides, adds a static website with an inline product film, and prepares matching GitHub/Gitee packages and update links.
    
    The film uses the current homepage and shared product controls on one seekable timeline. Runtime fixes preserve presentation when the App opens a room, normalize Site origins, and keep capture and media-recovery status in the television indicator. New visits use Chinese for a Chinese system language and English otherwise; explicit language and visual-mode choices remain available. An optional site passphrase controls site entry, while room authorization remains enforced.
    
    GitHub is the release authority. Gitee mirrors verified packages and provides update metadata when GitHub is unavailable. Reviewed PR release notes become the GitHub Release description. The separate public demo uses P2P only, with HTTPS and STUN verified.
    
    Validation: 756 Web tests, TypeScript and production build; Go core tests, formatting, vet and available target builds; bounded Windows capture and App/Site interoperability; browser film checks, audible playback and narrow layouts; anonymous Gitee Windows-package download, checksum and launcher/update-link checks. Public demo acceptance covers authenticated WebSocket signaling, synthetic P2P video and room cleanup on one network. macOS/Linux physical capture and the wider device/network/endurance matrix remain explicitly deferred.
    
    Publication builds every package from the merged source SHA. The repository is public, main protection is active, and Pages is configured for piik.tv. CI/publisher and Pages deployment records own publication results.
    
    ## Release notes
    
    ### 中文
    
    Piik 是免费开源的屏幕共享工具。开个房间,发出邀请,最多 20 位朋友就能用浏览器加入观看。
    
    - 使用浏览器或 Piik App 分享游戏、窗口和整个屏幕。
    - 优先建立直连;自托管站点可开启媒体转发作为备用线路。
    - Piik App 支持本地房间、临时公网邀请和已有站点。
    - Piik Server 内置网页界面、房间管理和连接服务,方便自行部署。
    - 提供中英文界面与使用指南,以及 GitHub、Gitee 两条下载线路。
    
    [官网](https://piik.tv) · [在线体验](https://demo.piik.tv) · [使用指南](https://github.com/TNTcraftHIM/Piik/blob/main/docs/guide/getting-started.zh-CN.md) · [自行部署](https://github.com/TNTcraftHIM/Piik/blob/main/docs/operations/self-hosting.zh-CN.md) · [Gitee 下载](https://gitee.com/TNTcraftHIM/Piik/releases)
    
    Windows App 和桌面浏览器是本次主要验证的平台。macOS 和 Linux 尚未经过实机测试,欢迎有设备的朋友测试并反馈。演示站和 App 公网邀请使用 P2P,受限网络下可能无法连接;自托管站点可开启媒体转发。
    
    ### English
    
    Piik is free, open-source screen sharing for you and up to 20 viewers. Start a room, send an invitation, and your friends can join in a browser.
    
    - Share games, windows or a whole screen from your browser or Piik App.
    - Direct connections come first, with optional media forwarding on self-hosted sites.
    - Piik App supports local rooms, temporary public invitations and existing sites.
    - Piik Server includes the web interface, rooms and connection services for self-hosting.
    - English and Chinese interfaces and guides are available, with GitHub and Gitee downloads.
    
    [Website](https://piik.tv) · [Online demo](https://demo.piik.tv) · [User guide](https://github.com/TNTcraftHIM/Piik/blob/main/docs/guide/getting-started.md) · [Self-hosting](https://github.com/TNTcraftHIM/Piik/blob/main/docs/operations/self-hosting.md) · [Gitee downloads](https://gitee.com/TNTcraftHIM/Piik/releases)
    
    Windows App and desktop browsers are the primary validated paths. macOS and Linux have not yet been tested on physical devices; testing and feedback are welcome. The demo and App public invitations rely on P2P and may not connect on restrictive networks. Self-hosted sites can enable media forwarding.
  • feat: rename product and runtime to Piik
    Rename the active product, Go module, binaries, configuration, protocols and documentation to Piik while retaining the TV mascot and existing media/room behavior.
    
    Use one current private contract without old-name aliases. Preserve SQLite authority and copy compatible local settings once; other settings start fresh. Git-message cleanup and the infrastructure name cutover are coordinated with this phase, with original history and deployment data archived externally.
    
    Validated locally with Web and Go checks, Windows capture compilation, matched Client/Server builds, packaged Client control handshake and history-rewrite integrity checks. Skip duplicate hosted CI for this owner-authorized local release.
    
    [skip ci]
  • fix: preserve room authority and repair Browser/Client recovery (#386)
    * fix: preserve room authority and recover current media connections
    
    * docs: close room authority and recovery integration
  • feat(media): share Browser encoding and complete local diagnostics
    * fix: allow Linux interface discovery in embedded media service
    
    * feat: expand local diagnostic reports
    
    * research: validate independent Browser encoding producers
    
    * feat: prototype Browser pool ownership and record remaining media gates
    
    * feat: refine Browser shared encoders and native output reuse
    
    * Refine carrier costs and simplify release entry points
    
    * Close media phase and prepare piik design handoff
  • feat(media): integrate embedded media services and shared native encoding
    Embed STUN and SFU in the shared Go process, reuse native encoding pipelines with independent adaptation, and complete Client lifecycle, settings, diagnostics and packaging fixes. Retain standard Browser senders after measured encoded-reuse limitations.
  • refactor: unify Go runtime and audited frontend
    Squash integration of the reviewed Go core, frontend audit fixes, release tooling, and deployment hygiene. CI passed all Server/Client jobs.
  • fix: finish native client lifecycle and capture aspect
    Accepted native Client lifecycle and Windows capture aspect phase. All Web/Server and three-platform Client checks passed.
  • feat(client): complete native source and release boundary
    Complete the Native Client source/audio boundary, strict v5 loopback contract, Browser media lifecycle handling, and non-blocking release checks. Keep unverified platform/physical gates explicit; do not rewrite the Go Server.
  • feat(nat): make NAT prediction deployment-configurable (#372)
    * Make NAT prediction deployment-configurable
    
    * Ignore optional predicted candidate rejection
  • perf(media): optimize browser media pipeline evidence (#359)
    Measured Browser-pipeline improvements, bounded SFU observability, and one-commit release ownership. Local repository hygiene, 860 tests, client/server builds, and the 20-Viewer seven-check gate passed. GitHub Actions did not start because of the account billing/spending-limit annotation.
  • fix(route): fix degraded edge recovery with same-parent regeneration
    Merged after local npm run check, 20-Viewer Chromium loopback gate, and documentation validation. GitHub Actions validation was not started because the repository account billing/spending limit prevented runner start.
  • feat(route): enable topology convergence by default (#311)
    Default new Host shares to native-edge topology convergence while preserving the pre-share opt-out and peer-only default.
  • docs: document guarded SFU convergence release (#302)
    Records the exact deployed artifact and postflight state. Documentation checks passed; the GitHub job did not start any steps.
  • fix(route): guard SFU quality convergence (#301)
    Fixes the production-proven P2P-to-SFU quality misrouting. Local full checks and independent P0/P1 review passed; the GitHub job did not start any steps.
  • docs: document native-edge production release (#300)
    Records the exact deployed artifact and postflight state. Documentation and repository hygiene checks passed; the GitHub job did not start any steps.
  • feat(route): implement native-edge topology convergence (#299)
    Implements the accepted opt-in native-edge local convergence controller and the pre-share topology optimization and peer-only policies. Local full checks and independent P0/P1 reviews passed; the GitHub job did not start any steps.
  • docs: accept per-share route policy gates (#298)
    Accept default-off peer-only and topology-convergence gates bound to one share generation. Current source and production remain unchanged.
  • docs: accept native-edge route convergence (#297)
    Accept availability-first local topology convergence from WebRTC and LiveKit native edge state. Current source and production remain observation-only.
  • docs: simplify repository truth architecture (#295)
    Modularize durable truth, bound always-loaded instructions, and keep domain-document size checks advisory. Local cross-platform repository hygiene checks pass; GitHub-hosted steps were not started because of the account billing state.
  • fix(media): align quality presets (#264)
    * fix(media): default screen audio to saver
    
    * fix(media): align screen audio tiers