Files
Piik/docs/operations/self-hosting.zh-CN.md
T
AAA 799d6efb4a fix: improve sharing recovery and UI feedback
## Problem and outcome / 问题与结果

Browser sharing can remain connected to a local encoding transport that never becomes usable, leaving viewers without frames. This phase bounds that startup at eight seconds and restores ordinary encoding through the existing failure path. It also keeps ready App services running after a browser-open failure, preserves user presentation/playback choices, and aligns room feedback, illustrated hints, metrics and documentation.

部分环境下,本机编码连接一直无法建立会让观众收不到画面。本轮在八秒后进入现有降级流程,同时修复客户端启动移交、播放状态和前端反馈的一致性问题,并更新官网与中英文教程。

Closes #399.

Related: #396. The release contains relevant startup/error-handling repairs, but the reporting machine has not been retested. Keep this issue open for a current-build result. #401 (optional Windows capture-border hiding) remains deferred.

Release / 发布版本:**v1.3.1**.

## Release notes

### 中文

- 客户端记住上次确认的启动模式;启动移交保留已保存的语言、纯视觉模式和主题选择。
- 系统浏览器未能自动打开时,客户端继续运行,并在终端保留页面地址、重试入口和具体错误。
- 改善浏览器共享画面的启动兜底,避免 App 媒体因短暂信令中断被误判为失败。
- 音轨变化保持现有视频与观众的本机暂停状态;连接恢复和暂停恢复不再重复播放电视开机动画。
- 修复昵称编辑及长昵称查看,减少重复的角色提示,统一人物选择和连接状态的区别。
- 完善房间准入、密码和邀请说明;复制反馈对应当前链接及当前操作,避免迟到结果覆盖新反馈。
- 修正采集参数、统计单位与采样区间的展示,未知参数不再用配置上限代替。
- 统一提示漫画、状态图标与动效,改善选源器还焦、键盘操作、剧场布局和触控目标尺寸。
- 服务端默认支持 20 位观众,可在配置中设为 1–20 位,房主不占观众名额。
- 更新官网、教程入口和中英文说明,清理过时预览及失用代码。

兼容说明:使用旧版 App 连接更新后的站点时,站点会优先保留自己的显示偏好。如需更改语言或主题,请在进入后的页面调整。

### English

- Remember the last confirmed App launch mode and preserve saved language, visual-mode and theme choices during launch handoff.
- Keep the App running if the system browser fails to open, with the page address, retry action and error details available in the terminal.
- Improve the browser sharing startup fallback and avoid treating brief signaling outages as App media failures.
- Keep existing video and local pause state when audio tracks change. Reconnecting and resuming no longer replay the television startup animation over the picture.
- Fix nickname editing and full-name access, remove redundant role hints, and distinguish participant selection from connection state.
- Clarify room access, passwords and invitations. Copy feedback now belongs to the current link and operation, so late results cannot replace newer feedback.
- Correct capture details, metric units and observation intervals. Unknown capture values are no longer replaced with configured ceilings.
- Align illustrated hints, status icons and motion. Improve source-picker focus, keyboard operation, theater layout and touch targets.
- Default the Server to 20 viewers, configurable from 1 to 20. The host does not count toward that limit.
- Update the website, guide links and bilingual instructions, and remove obsolete previews and unused code.

Compatibility: when an older App connects to an updated Site, the Site keeps its saved presentation preferences. Change language or theme on the destination page when using an older launcher.

## Verification / 验证

Non-publishing [CI candidate run 34919320511](https://github.com/TNTcraftHIM/Piik/actions/runs/34919320511) passed Go core, race, Web checks, Server/container verification and all three native App package checks at source 188376e8. Subsequent commits only update deployment documentation, status and TODO; documentation/hygiene checks passed. Product inputs are unchanged.

- `npm run check`: TypeScript, 64 test files / 854 tests, and the Web production build passed.
- `npm run check:client-core`: final Go source passed tests, formatting, vet and core target builds. Windows capture compilation and geometry checks passed earlier in this phase; later edits did not change native capture.
- Website build, documentation checks, repository hygiene and diff checks passed. Existing documentation-size and bundle-size warnings remain.
- Actual browser flows covered sharing, source changes, pause/resume, late audio, brief signaling loss, invitation/copy feedback, entry preferences, source-picker focus, and narrow layouts.
- A local three-viewer P2P relay check covered quality-report expiry, recovery and cleanup without interrupting video. A controlled browser-helper failure returning `0xc0000005` left the real App launcher and Local service available.
- Homepage checks covered Chinese/English, light/dark preferences and inline-film open/close after removing the separate-page entry.

Limits: no new reporter-machine confirmation for #396 or the Windows URL-handler crash; physical Safari/mobile, macOS/Linux capture and wider public-network/endurance coverage remain deferred. Formal release artifacts will be built from the approved squash-merge revision. Hero-loop controls and video-adjacent tooltip placement remain open design items in TODO.

## Impact / 影响

Compatible patch; signaling, Native control and capture contracts are unchanged. Older App launch handoff keeps the updated Site's saved presentation preferences. The Server's default viewer limit is corrected to 20; an explicit 1–20 configuration remains valid.

Service updates retain persisted room authority but restart active media sessions. Deploy the verified immutable Server artifact through the existing bounded health/recovery process. Public Demo remains open and P2P-only; deployment does not enable SFU or change infrastructure/configuration.
2026-09-15 10:13:29 +08:00

4.5 KiB
Raw Blame History

部署 Piik Server

English · 简体中文 · 文档导航

Piik Server 将网页、房间管理和可选的媒体转发打包在一个服务端程序中。 解压后即可运行,房间数据保存在 SQLite 中。

先在本机试用

以下服务端操作在 Linux x64 环境中执行。

从 GitHub Releases 或 Gitee 镜像下载 piik-<revision>-runtime.tar.gz,即 Linux x64 服务端程序包。 解压后,在该目录运行:

./piik-server

打开 http://localhost:8787 即可试用。需要让朋友通过互联网访问时, 继续完成下方配置。如果只想在自己的电脑上临时开房间,可直接使用 Piik App。

使用 Docker Compose

在已安装 Docker Compose v2 的 Linux x64 服务器上,将两个部署文件下载到空目录中:

curl -fsSLo compose.yaml https://raw.githubusercontent.com/TNTcraftHIM/Piik/main/deploy/container/compose.yaml
curl -fsSLo .env https://raw.githubusercontent.com/TNTcraftHIM/Piik/main/deploy/container/.env.example

将 .env 中的 share.example.com 换成自己的域名,然后启动:

docker compose run --rm piik --check-config
docker compose up -d

ghcr.io/tntcrafthim/piik:latest 镜像包含网页、信令、STUN 和可选 SFU。 接着完成下方的 HTTPS 配置和端口放行。 默认使用 P2P;如需 SFU 兜底,按 .env 中的说明启用即可。 请保留 piik-data 数据卷,房间数据和可选诊断文件都保存在其中。 更新与备份见容器维护说明。

对外提供服务

准备一台 Linux x64 服务器,以及一个指向服务器公网 IP 的域名。 下文以 share.example.com 为例,请替换成自己的域名。

1. 配置并启动 Piik

在程序旁新建 .env 文件:

PIIK_ENV=production
LISTEN_HOST=127.0.0.1
PUBLIC_BASE_URL=https://share.example.com
STUN_URLS=stun:share.example.com:3478
MAX_VIEWERS_PER_ROOM=20
SITE_ACCESS_PASSWORD=

使用普通用户,在该目录执行:

./piik-server --check-config
./piik-server

程序会自动读取 .env,并将房间数据保存在工作目录的 rooms.sqlite 中。 SITE_ACCESS_PASSWORD 留空时,进入站点无须口令; 如需设置口令,填写你想使用的口令即可。房间邀请与加入权限仍由房主管理。

MAX_VIEWERS_PER_ROOM 可设置每房观众上限,不含房主,支持 1..20,修改后重启生效。 人数越多,对网络和转发资源的需求也可能增加。默认值及 App 房间的区别见 人数限制。

2. 配置 HTTPS

如果已有 HTTPS 反向代理,将请求转发到 127.0.0.1:8787,并启用 WebSocket 支持。 如果还没有,可以安装 Caddy,在 Caddyfile 中加入:

share.example.com {
    reverse_proxy 127.0.0.1:8787
}

重新加载 Caddy。域名解析正确且 TCP 80/443 可访问时,它会自动申请和续期证书。 具体操作见 Caddy 的 HTTPS 代理说明。

3. 放行端口并检查

在服务器防火墙和云平台安全组中放行 TCP 80/443(HTTPS)和 UDP 3478(STUN)。 TCP 8787 仅供本机反向代理访问。STUN 域名需要直接解析到服务器,不能只经过 CDN 的 HTTP 代理。

打开 https://share.example.com/healthz,应返回 {"status":"ok"}。 随后打开站点,分享一个画面,并用另一台设备加入验证。 上述基础配置使用 P2P 传输,参与者之间需要可用的 UDP 通路。

可选:启用媒体兜底

在 .env 中添加 SFU_UDP_PORT=7882,放行 UDP 7882,再重启 Piik,即可启用自动 SFU 兜底。 如果服务器处于 NAT 后方,还需将 SFU_PUBLIC_IP 设置为外部可达的公网 IPv4 地址。 这项功能由同一个服务端程序提供。

长期运行与更新

需要开机启动时,参阅 systemd 与容器配置。 更新时保留 .env 和 rooms.sqlite:停止服务、备份房间数据、替换新版程序,再启动并检查健康状态和房间访问。 涉及数据格式变化的版本,请先阅读发布说明。

全部配置与端口 · 维护者发版工具