Piik can now let one invited Viewer control the Host's shared desktop or window, using the existing media route and explicit source-scoped consent. This phase also finishes Viewer playback settings, the combined interaction window, the shared control/theme/icon polish, and concrete forwarding-feedback recovery fixes. Remote input stays off by default, uses one controller and releases held input on revocation, retirement or loss. Existing 2.x sharing remains compatible; new capabilities are negotiated with supporting App/Site/relay peers. No virtual input driver, new media listener or route planner is added. Validation: full Web check (97 files / 1,677 tests), Windows Go/native checks; seven real Browser/App lifecycle scenarios covering P2P, SFU and fallback-to-direct continuity; existing cross-version and physical Windows routed-input evidence; native macOS/Linux packaging, Go race/security and container checks through the publishing pipeline. Physical macOS/Linux permissions, mobile devices, mixed DPI and commercial games retain their documented limits. README/wiki keep deployment under the optional self-hosted Server chapters. Refs #472, #477, #479, #480. Issue follow-up happens after publication; unmatched field reports remain open. ## Release notes ### 中文 这是一次功能更新:一起看屏幕时,可以把键鼠交给一位朋友操作,聊天和表情也整合进了同一个互动窗口。本次还整理了分享与播放设置,并修复部分连接恢复和中转画质停滞的问题。 #### 新功能与体验 - **可选键鼠远控**:房主可以让一位朋友操作当前分享的桌面或窗口,随时撤回授权;换源或停播后关闭远控。提供手机触控、缩放和小键盘。当前实机验证覆盖 Windows App。 - **观众播放设置**:新增完整显示、等比铺满、拉伸铺满,以及自动/仅 P2P/仅 SFU 线路选择;站点和房主的线路限制仍然生效。 - **互动窗口**:聊天、参与者和表情放在同一窗口;可以从聊天头像选择接收者,新增点赞、倒彩等表情。支持的浏览器可以独立置顶,继续查看聊天和互动。全屏保留弹幕开关。 - **分享与播放设置更清楚**:暂停与停止相邻,画面、声音、连接和远控各有对应入口。观众播控在移动鼠标时显现,远控时收进画面边缘的小抽屉;点击画面不再意外暂停。没有声音输入时播控给出明确反馈,恢复输入后保留观众的音量设置。 #### 修复 - **连接与播放修复**:修正部分中转路径的媒体时钟、往返时间与重复反馈统计,改善这些错误导致的画质恢复停滞;重新进入房间后,SFU 连接仍可继续尝试直连。同步底层握手恢复修复。 - **界面修复**:修复浮窗返回后遮挡全屏、无法操作,窄屏控件错位、菜单超出边界等问题。虚拟键盘长按不会选中文字,拖出、取消或失焦后释放按键。页面和选源面板统一中性底色;App 图标与 favicon 保留小电视轮廓,精修对比度与底板层次。 - **兼容性修复**:新表情按站点支持情况显示,避免旧站点拒收后断开连接。补齐旧浏览器的浮层支持;修正 macOS `.app` 对包外启动文件的依赖。macOS 的 Finder、权限和远控仍需实机验证。 #### 更新说明 沿用 2.x 兼容边界。使用远控需要更新房主 App 和所连接的站点;要获得完整的中转修复,请同时更新 App 与自部署 Server。 ### English This feature update lets a Host hand keyboard and mouse control to one friend while sharing a screen. Chat and reactions now share one interaction window. It also clarifies sharing and playback settings and fixes specific connection-recovery and server-forwarding quality stalls. #### Features and experience - **Optional keyboard and mouse control:** the Host can let one friend control the shared desktop or window and revoke access at any time. Changing sources or stopping sharing disables control. Touch controls, zoom and an on-screen keyboard are included. Physical validation currently covers the Windows App. - **Viewer playback settings:** choose fit, crop or stretch, and Auto, P2P-only or SFU-only routing. Site and Host restrictions still apply. - **One interaction window:** chat, participants and reactions stay together. Choose a recipient from their chat avatar and use new reactions, including thumbs up and down. Supported browsers can detach the window and keep chat and reactions visible on top. Fullscreen retains the chat-overlay toggle. - **Clearer sharing and playback controls:** pause and stop stay together, with separate picture, sound, connection and remote-control settings. Pointer movement reveals the playback bar during viewing; remote control uses a small drawer at the picture edge. Clicking the picture no longer pauses it accidentally. Sound controls reflect missing input and retain the Viewer's volume when it returns. #### Fixes - **Connection and playback fixes:** correct media clocks, round-trip-time updates and duplicate feedback accounting on affected forwarding paths, improving recovery from the quality stalls caused by those errors. Rejoining a room restores direct-connection attempts while SFU playback continues. Incorporate upstream handshake-recovery fixes. - **Interface fixes:** returning a detached tool during fullscreen no longer leaves an inaccessible panel over the picture. Fix compact-layout shifts and overflowing menus. Holding a virtual key no longer selects its label; release, cancellation and focus loss clear held keys. Pages and the source picker use shared neutral surfaces. Refine App icons and favicons while retaining the familiar television outline. - **Compatibility fixes:** show new reactions only when the site supports them, preventing disconnects on older sites. Support popovers on older browsers and remove the macOS `.app` launcher's dependency on files outside the bundle. Finder, permissions and remote input still need physical macOS validation. #### Updating The existing 2.x compatibility boundary is retained. Remote control needs an updated Host App and site; update both App and self-hosted Server for the complete forwarding fix.
251 lines
12 KiB
Markdown
251 lines
12 KiB
Markdown
# Server Release And Recovery
|
|
|
|
This file owns routine immutable Server releases. Initial service setup is
|
|
in [self-hosting operations](./operations/self-hosting.md); environment and ports
|
|
are in [configuration reference](./standards/configuration.md). Exact production
|
|
identity is owned by the immutable release descriptor, runtime `REVISION`, and
|
|
deployment record. [Status](./status.md) owns only the compact current product
|
|
and operational snapshot; it is not a per-release ledger.
|
|
|
|
The tracked `release-server.sh` updates an existing Go deployment with embedded
|
|
media, bare-metal nginx, nftables, and application port 8787. It requires an
|
|
existing running Go release. Another proxy, firewall owner, application port,
|
|
first installation, or initial embedded-media cutover needs its own scoped
|
|
bootstrap/updater; do not call this wrapper generic.
|
|
Its firewall check compares the nftables ruleset without traffic counters; it
|
|
does not depend on a particular table name. Coordinate other firewall writers
|
|
outside the cutover window. See [nft output options](https://netfilter.org/projects/nftables/manpage.html).
|
|
|
|
## Release Boundary
|
|
|
|
A routine Server release changes only the built Piik server binary and
|
|
the Browser assets it embeds. It does not change infrastructure,
|
|
service units, proxy/firewall rules, secrets, media listener configuration, or
|
|
persistent room state.
|
|
|
|
Any task that touches one of those excluded surfaces must first record its exact
|
|
pre-change value and a recovery procedure for that surface. Do not complicate the
|
|
routine Server wrapper with one-off infrastructure branches.
|
|
|
|
The pre-cutover Server release is guaranteed only through bounded health
|
|
and postflight. It has no retention contract afterward and is not a maintained
|
|
backup; Git and immutable artifacts own history.
|
|
|
|
## Build Host
|
|
|
|
Start from a clean exact revision using Node from [`.node-version`](../.node-version),
|
|
npm from [`package.json`](../package.json), and Go from [`go.mod`](../go.mod):
|
|
|
|
```sh
|
|
npm ci
|
|
npm run check
|
|
node scripts/package-server-release.mjs <output-directory-outside-repository>
|
|
```
|
|
|
|
The packager refuses a dirty tree, builds the Browser assets and the
|
|
linux/amd64 server binary (or linux/arm64 with `--arch arm64`) from that exact revision without cgo, records the
|
|
full revision, emits a runtime archive plus path/size/SHA-256 manifest and release descriptor, and
|
|
extracts its own artifact to verify it. The archive contains exactly
|
|
`piik-server`, `LICENSE`, `THIRD-PARTY-NOTICES.txt`, and `REVISION`. Upload
|
|
the archive, manifest, and descriptor together to `/opt/piik/uploads`.
|
|
ARM64 file names include `-linux-arm64` after the revision; x64 names stay
|
|
unchanged. The deployment wrapper rejects a package for another host architecture.
|
|
|
|
Public Release pages expose the runnable packages and put package checksums in
|
|
the release body. Retain the original complete build output outside the checkout
|
|
for later managed deployment or mirror retries: descriptors and manifests are
|
|
available in CI artifacts for 14 days and are not public Release attachments.
|
|
Do not rebuild an existing published version to replace missing metadata or bytes.
|
|
|
|
The same Server descriptor is also the App assembly input. On each
|
|
target platform, provide that platform's Go toolchain:
|
|
|
|
```sh
|
|
PIIK_GO=/path/to/go node scripts/assemble-app.mjs \
|
|
/outside/repository/server-release/piik-<revision>.release.json \
|
|
/outside/repository/piik-app \
|
|
--target windows-amd64 \
|
|
--capture /path/to/platform-capture \
|
|
--tunnel /path/to/cloudflared
|
|
```
|
|
|
|
Assembly refuses a dirty or different revision and emits one directory with the
|
|
App executable, the Browser assets taken from that release and embedded in
|
|
it, the selected sidecars, notices, and matching `REVISION`. Its required target
|
|
is one of `windows-amd64`, `linux-amd64`, `linux-arm64`, `darwin-arm64` or `darwin-amd64`; every supplied
|
|
binary input must match it. It does not create an installer, auto-updater,
|
|
release tag, or compatibility bundle.
|
|
|
|
Darwin App assembly runs on macOS with its SDK and cgo enabled: the pinned
|
|
LiveKit dependency's [Darwin CPU statistics](https://github.com/mackerelio/go-osstat/blob/v0.2.8/cpu/cpu_darwin_cgo.go)
|
|
call Mach APIs. Windows and Linux
|
|
App builds keep cgo disabled. A core check on those hosts explicitly skips
|
|
the Darwin binaries; macOS build and package verification belong to the existing
|
|
native runner. Server builds for both Linux architectures remain cgo-free.
|
|
|
|
The platform package also carries its native presentation metadata: Windows
|
|
embeds the icon in the Go executable, Linux emits a freedesktop desktop entry
|
|
under `share/`, and macOS emits a self-contained `.app` with an ICNS resource.
|
|
The macOS `CFBundleExecutable` names the real Mach-O App binary in
|
|
`Contents/MacOS`; its relative `runtime/`, license notices and `REVISION` live
|
|
beside it. Moving the `.app` must retain every runtime dependency. This follows
|
|
[Apple's bundle relocation guidance](https://developer.apple.com/forums/thread/724969)
|
|
and avoids a shell entry that reaches outside the bundle. Package checks execute
|
|
the extracted entry and helpers; Finder/Gatekeeper and desktop permissions still
|
|
need macOS acceptance.
|
|
|
|
CI and local release-candidate builds use the same wrapper on the target's
|
|
native operating system:
|
|
|
|
```sh
|
|
node scripts/package-app-candidate.mjs \
|
|
/outside/repository/server-release \
|
|
windows-amd64 \
|
|
/outside/repository/app-candidate
|
|
```
|
|
|
|
The wrapper downloads the pinned public-link sidecar, verifies its digest,
|
|
builds the target App and available capture process, executes every packaged
|
|
runtime from the extracted ZIP, and emits one `.zip` plus its SHA-256 file.
|
|
|
|
App ZIPs use ordinary Store/Deflate compression and relative entry names without
|
|
`.` or `..` path segments; include hidden files and preserve executable modes on
|
|
Unix. Windows packaging also checks every entry through Windows Explorer's ZIP
|
|
reader. A successful extraction by the writer's own library does not establish
|
|
compatibility with the user's default archive tool.
|
|
|
|
Retain the descriptor and successful deployment output as release metadata. Do
|
|
not create a follow-up source commit solely to duplicate their revision, asset,
|
|
or hashes.
|
|
|
|
Manual `app_checks=true` dispatch packages both Server architectures and all App
|
|
candidates after validation. Once [automatic publication](./operations/github.md)
|
|
is explicitly enabled, accepted main merges run that same pipeline and publish
|
|
the verified artifacts. Candidate artifacts are retained for 14 days. Ordinary
|
|
branch pushes stay quiet; PRs run only the read-only release-note check. No
|
|
release-record commit is written back to main.
|
|
The workflow does not deploy into a running application service.
|
|
|
|
Do not build or run the full repository check on a constrained production host.
|
|
That host runs only the packaged binary and needs no Node, npm, or dependency
|
|
install.
|
|
|
|
## Update Check
|
|
|
|
Builds carry a product version plus full source revision. Packagers use one
|
|
release plan or exact Git tag and inject its identity into Server, App and Web;
|
|
untagged local candidates use `development`. Schema-2 package descriptors carry
|
|
the same pair and artifact hashes. The [version policy](./standards/versioning.md)
|
|
owns ordering and first-public-release readiness.
|
|
|
|
The default App launcher starts immediately, then checks GitHub Releases in the
|
|
background, falling back to the Gitee mirror if GitHub is unavailable. The
|
|
[release-source policy](./standards/versioning.md#release-sources) owns selection
|
|
and provenance checks. It shows a link only when
|
|
the latest stable release is newer, the same version has a known different source
|
|
SHA, or a development build can choose the official release. These notices are
|
|
distinct; a different SHA alone is not called newer.
|
|
The request sends no current revision, credentials, room data, or media data;
|
|
network errors, private-repository responses, and missing releases are treated
|
|
as no notice. Checking does not download an archive, replace files, or interrupt
|
|
a running share; the user can follow the update link to download the App ZIP.
|
|
|
|
An operator can perform the corresponding read-only Server check:
|
|
|
|
```sh
|
|
bash deploy/check-release.sh
|
|
```
|
|
|
|
The Server also checks once in the background after startup and logs an available
|
|
release with its download URL. It does not delay startup, periodically poll,
|
|
notify room participants or install anything.
|
|
|
|
The script runs the deployed binary's `--check-release`, using that binary's
|
|
injected identity, and prints one JSON result with versions, available source
|
|
SHAs and the release URL. Exit `0` means no newer/different official build,
|
|
`10` means `update-available`, `different-build` or `official-release`, and `20`
|
|
means the check is unavailable. It does not accept a separate revision file.
|
|
For a private repository, inject a short-lived `GITHUB_TOKEN`
|
|
through the operator environment; never place it in the repository or command
|
|
line. The command does not mutate files, services, containers, or persistent
|
|
state.
|
|
|
|
## Atomic Cutover
|
|
|
|
The wrapper requires an already running packaged Go release and the service
|
|
layout described above. For a new installation, use the
|
|
[self-hosting guide](./operations/self-hosting.md). Infrastructure changes need
|
|
their own scoped recovery procedure under [CONTRIBUTING](../CONTRIBUTING.md).
|
|
|
|
Run the tracked server entry with the uploaded descriptor:
|
|
|
|
```sh
|
|
sudo env PIIK_PUBLIC_ORIGIN=https://share.example.com \
|
|
bash /path/to/repository/deploy/release-server.sh \
|
|
/opt/piik/uploads/piik-<revision>.release.json
|
|
```
|
|
|
|
The wrapper:
|
|
|
|
1. takes a deployment lock and validates the descriptor, revision, archive,
|
|
manifest, current Go process, Piik/nginx service state, and public origin;
|
|
2. rejects unexpected archive paths, links, file types, or duplicate inodes;
|
|
3. extracts to a new release directory and verifies every file hash and size;
|
|
4. validates production configuration by running the packaged binary's
|
|
configuration check as the service user under a bounded runtime;
|
|
5. proves the old and new releases share no regular-file inode;
|
|
6. atomically switches `/opt/piik/current`, starts the service, and polls
|
|
bounded local/public health; and
|
|
7. restores the exact prior symlink and service when cutover or health fails.
|
|
|
|
Never hard-link release files or recursively mutate permissions before the
|
|
inode audit: metadata changes would violate both releases. Expected service
|
|
states should be read as data (`systemctl show`), not used as bare commands under
|
|
strict-shell error traps.
|
|
|
|
## Persistent State
|
|
|
|
Stable mode stores only room authority at the configured SQLite path. The
|
|
systemd service owns its state directory and file permissions. Application
|
|
restart retains room ownership, invitations, policy and password verifier;
|
|
participants, signaling, routes, SFU state and media reconnect from fresh
|
|
process state.
|
|
|
|
Lightweight mode has no persistent room state and starts empty. A release does
|
|
not add a migration or compatibility reader for either mode; current exact
|
|
schema validation fails closed before accepting signaling or media admission.
|
|
|
|
## Postflight
|
|
|
|
Verify only the surfaces relevant to the release:
|
|
|
|
- local and public `/healthz` return `{"status":"ok"}`;
|
|
- the public HTML references the new immutable main asset;
|
|
- Piik and nginx have expected active/restart state;
|
|
- Piik owns each configured STUN/SFU UDP listener and public reachability
|
|
matches the configuration;
|
|
- the current symlink and served revision match the descriptor;
|
|
- room creation, Host authentication, one direct Viewer, and configured SFU
|
|
fallback complete the scoped smoke; and
|
|
- infrastructure, config, secrets, ports, and persistent state not named by the
|
|
task are unchanged.
|
|
|
|
Representative network, mobile, audio, 20-Viewer, and endurance evidence belongs
|
|
to [verification status](./verification-status.md), not routine postflight.
|
|
|
|
## Recovery
|
|
|
|
Before cutover, the wrapper keeps the exact prior release path. On failure after
|
|
the switch begins, it stops Piik, restores that path atomically, restarts the
|
|
service, and waits for health. A failed recovery exits distinctly and requires
|
|
operator intervention; it must not silently report the new release as active.
|
|
|
|
Infrastructure or persistent-state recovery is separate and limited to the
|
|
surfaces changed by that task. Do not restore an entire server, old firewall, or
|
|
old secret set for an application-only failure.
|
|
|
|
If a task changes persistent room data, prepare and verify a separate
|
|
[SQLite backup](https://www.sqlite.org/backup.html) and recover matching data,
|
|
configuration and application together. Restoring old data can revive revoked
|
|
credentials; account for later authority changes before reopening ingress.
|