Free, open-source screen sharing for private live streams with friends. Watch together in a browser or self-host Piik. 免费开源的私密屏幕共享,支持游戏直播、一起看电影与自部署。
docs: record initial recovery deployment (#59)
AAA37187ea0cdbe
diff --git a/README.md b/README.mdindex fff1579f..7984d6aa 100644--- a/README.md+++ b/README.md@@ -4,7 +4,7 @@ Screener is a private, low-latency screen-sharing project for one game player anThe first measurable Web proof of concept is implemented. A host captures a screen, window, or browser tab and shares a numeric room code. Rooms default to a private fragment invitation whose capability authorizes only one room; a Host may explicitly choose public watching by room code. During a share, the host can change between three ceiling profiles without reopening the source picker: 1080p60 at 8 Mbps, 1080p30 at 5 Mbps, and 720p30 at 3 Mbps. The host can also temporarily pause the picture or switch sources. Rooms are random and temporary by default. A Host-protected deployment can optionally use SQLite-backed room numbers starting at `1`, reusable links, and a waiting state after sharing stops. Default routing gives each viewer an independent direct WebRTC connection; the exact-room controller can instead use bounded peer descendants and LiveKit SFU roots. The default room capacity is eight viewers and deployments may configure 1 through 16, but that admission limit is not a performance promise.-This is not yet a broadly validated production release. Production runs `bbe4654` with room-scoped Viewer access and the bounded SFU failure-stage diagnostic; it uses self-hosted STUN-only ordinary ICE plus a separate LiveKit SFU/UDP domain. Real cross-network media, game audio, a sustained 1:8 room, mobile browser lifecycle behavior, and latency targets still require the documented manual test matrix.+This is not yet a broadly validated production release. Production runs `89e6d76` with room-scoped Viewer access, bounded SFU diagnostics, and initial-connect recovery; it uses self-hosted STUN-only ordinary ICE plus a separate LiveKit SFU/UDP domain. Real cross-network media, game audio, a sustained 1:8 room, mobile browser lifecycle behavior, and latency targets still require the documented manual test matrix.## Run locallydiff --git a/docs/deployment.md b/docs/deployment.mdindex 6d01f55a..6268e1ef 100644--- a/docs/deployment.md+++ b/docs/deployment.md@@ -14,9 +14,11 @@ current controller's automatic final media fallback. This capacity is dormant unthe peer-assisted experiment, or required STUN discovery. It is configured withICE/UDP only; the candidate has no ordinary TURN or media-TCP configuration.-Production `bbe4654a7a9b` runs this candidate for exact room `1` on the existing-shared public IP. The unchanged `9610032fc5f5` release, v1 database/environment-backup, and coturn relay remain rollback-only. This is a bounded production smoke, not+Production `89e6d7649169` runs this candidate for exact room `1` on the existing+shared public IP. The immediate `bbe4654a7a9b` code rollback uses the current v2+database and `HOST_ADMISSION_PASSWORD` environment. Only the deeper pre-access+`9610032fc5f5` rollback may restore the matching v1 database and old environment.+Coturn relay also remains rollback-only. This is a bounded production smoke, notclean-port or broad-rollout acceptance; the media procedures below still apply.## Topology and prerequisites@@ -54,6 +56,12 @@ copy-on-write reflink is acceptable only after an inode audit confirms that theold and new regular-file sets have zero shared inodes. Do not recursively changepermissions until that check passes.+In a strict-shell deployment, expected service states are data, not command+failures. Do not call `systemctl is-active` bare under `set -e`/`ERR`: an+intentionally stopped service returns a nonzero status and can trigger a false rollback. Read+`ActiveState` with `systemctl show`, compare the returned string explicitly, and+keep stop, symlink switch, start, health check, and rollback as separate steps.+Run `npm start` under a service supervisor that injects the environment, restartson failure, and applies bounded logs. For a simple untracked environment file,the equivalent direct launch is@@ -269,6 +277,15 @@ earlier artifact attempt was rolled back after hard-linked dependencies let apermission change make the rollback release unreadable for 3m11s; the final release has anindependent dependency tree and zero shared regular-file inodes.+The code-only initial-connect recovery deployed at 2026-08-20 09:40 +08 on+exact `89e6d7649169`; its artifact SHA-256 is+`39B62039FCFB05281F78FCF85C964C520E2BB2FE5661ADA4758D598A7DF6CEC1`.+Health returned in 1.09 seconds, the v2 database still contained four rooms and+room `1`, and environment, nginx, and LiveKit state were unchanged. At 09:37 a+bare `systemctl is-active` treated the expected stopped state as an error under+strict shell and caused an immediate healthy rollback; no new application had+failed. The later explicit `ActiveState` sequence completed successfully.+Enabling persistence does not migrate rooms that existed only in memory. Thedeployment restart invalidates those temporary links; the first subsequentlycreated persistent room receives ID `1`.diff --git a/docs/project-memory.md b/docs/project-memory.mdindex 021d3f7d..d8d90005 100644--- a/docs/project-memory.md+++ b/docs/project-memory.md@@ -39,10 +39,10 @@ Last updated: 2026-08-20## Current Implementation- The repository is one npm package using Node.js 24, React, TypeScript, Vite, native WebRTC, `ws`, Zod, Vitest, and separate coturn.-- Production `bbe4654a7a9b10b1bdcc839665932020b7f31e8b` deployed at 2026-08-20 03:06 +08 to `https://share.bonfire.icu`. It enables peer/SFU routing only for persistent room `1`; unlisted rooms remain ordinary P2P. The bounded SFU failure-stage diagnostic stays active, while `9610032` is rollback-only.+- Production `89e6d7649169e43276a604c36fe681ebbed384dc` deployed at 2026-08-20 09:40 +08 to `https://share.bonfire.icu`. It enables peer/SFU routing only for persistent room `1`; unlisted rooms remain ordinary P2P. Initial-connect recovery and bounded SFU diagnostics are active, while `bbe4654` is rollback-only.- Ordinary ICE is process-wide STUN-only. Room `1` may use one LiveKit publication feeding at most two roots while retaining peer descendants; real 1/2-root media and game quality remain unverified.- Production requires an independent `HOST_ADMISSION_PASSWORD` only for creation/Host role. Default private fragment grants and explicit public-watch authorize Viewers; signaling is role-bound and there are no accounts/JWT/session rows. SQLite v2 stores Host and nullable Viewer-grant digests; all four rooms, including room `1`, survived the stopped migration.-- Production uses nginx, Node.js 24.19.0, coturn 4.17.2 for STUN/rollback, and pinned LiveKit 1.13.5 on UDP 7882 with TCP fallback disabled. Screener and LiveKit report `NRestarts=0`; local/public health and `index-uCv4ooZJ.js` return 200, while `/rtc`, `/rtc/validate`, and unauthenticated `/rtc/v1` return 404 outside the SPA. Public TCP 7880/7881 is blocked; LiveKit has a 192/256 MiB cgroup boundary and no automatic restart.+- Production uses nginx, Node.js 24.19.0, coturn 4.17.2 for STUN/rollback, and pinned LiveKit 1.13.5 on UDP 7882 with TCP fallback disabled. Screener and LiveKit report `NRestarts=0`; local/public health and `index-2HASsWrj.js` return 200, while `/rtc`, `/rtc/validate`, and unauthenticated `/rtc/v1` return 404 outside the SPA. Public TCP 7880/7881 is blocked; LiveKit has a 192/256 MiB cgroup boundary and no automatic restart.- Old TURN parser/signer/refresh/UI/SNI artifacts are absent; coturn and the old release are rollback-only, not candidate media.- ADR-0005 is configured with exact `PEER_ASSISTED_ROOM_IDS=1`; unlisted rooms use ordinary P2P. `screener-v2` is the only deployed signaling literal; there is no v1 parser or translator.- Production logs show two root participants and two short Host participants with no service restart or retained track. Their timing is consistent with, but does not directly prove, one fresh-grant retry and Peer failback. The Host exposes only the local current-revision failure stage (`connect|source|video-publish|sender-config|audio-publish|transport`) and uploads no raw error or endpoint data. Browser relays still re-encode; native sharing remains outside product code.diff --git a/docs/status.md b/docs/status.mdindex c0291ad4..4bae8136 100644--- a/docs/status.md+++ b/docs/status.md@@ -4,12 +4,13 @@ Last updated: 2026-08-20## Phase-`https://share.bonfire.icu` runs `bbe4654a7a9b10b1bdcc839665932020b7f31e8b`-since 2026-08-20 03:06 +08 as a shared-IP production smoke. It includes-room-scoped Viewer access and the bounded SFU failure-stage diagnostic.+`https://share.bonfire.icu` runs `89e6d7649169e43276a604c36fe681ebbed384dc`+since 2026-08-20 09:40 +08 as a shared-IP production smoke. It includes+room-scoped Viewer access, bounded SFU diagnostics, and initial-connect recovery.Ordinary ICE is STUN-only process-wide; persistent room `1` alone enables theautomatic peer/SFU-UDP controller with at most two SFU roots. The old-`9610032fc5f5` release, v1 backup, and coturn relay remain rollback-only.+`bbe4654a7a9b` is the immediate code rollback and keeps the current v2 DB/env.+The v1 DB/old env pair is only for the deeper pre-access `9610032` rollback.## Current Snapshot@@ -18,13 +19,13 @@ automatic peer/SFU-UDP controller with at most two SFU roots. The old- SQLite v2 keeps Host and nullable Viewer-grant digests in one checked `STRICT` row. The stopped migration retained four rooms and locked each old room private without minting a raw grant.- PR #44's exact-room STUN-only/SFU-UDP router is enabled only for production room `1`: host/SFU roots <=2, browser relay <=1, bounded failure. HTTPS/WSS stays TLS/TCP.- Fallback prewarm is token-free and limited to room `1`; mobile/iPad viewers are leaves and healthy edges stay sticky.-- Viewer initial-connect: after an answer, a generation-bound 15s deadline enters ICE restart; success/replacement/disposal cancels it. Unit-tested, not mobile-verified.+- After an answer, a generation-bound 15s initial-connect deadline enters ICE restart; success/replacement/disposal cancels it. It is deployed but not mobile-verified.- Room `1` can publish exactly `HIGH+LOW` with Dynacast/backup codec off and subscriber `HIGH` ceilings; it has no retained real media frame.- A+B/P2P C remains read-only. Autonomous BWE is only `suspect`; confirmed fallback evacuates children and loses parent capacity. Root impact remains a default-on gate.## Verified Evidence-- `bbe4654` passed 365 tests/builds and an atomic v1-to-v2 production migration. Local/public health, `index-uCv4ooZJ.js`, nginx, Host admission, and cookie-free private Viewer denial pass; room `1` remains. LiveKit was not restarted; unversioned `/rtc` paths and unauthenticated `/rtc/v1` return 404 outside the SPA.+- `89e6d76` passed 369 tests/builds and a code-only atomic switch. Health recovered in 1.09s; `index-2HASsWrj.js`, DB v2/four rooms/room `1`, access env, nginx and LiveKit remain healthy. Its artifact SHA-256 is `39B62039FCFB05281F78FCF85C964C520E2BB2FE5661ADA4758D598A7DF6CEC1`; new and rollback releases share zero regular-file inodes.- A rejected artifact reused hard-linked dependencies; its permission change made rollback unreadable for 3m11s and restart attempts peaked at 52. Restoring ownership recovered `9610032`; the successful artifact has zero shared regular-file inodes. Immutable releases now forbid this reuse.- On the 960 MiB host, idle LiveKit peaked near 16 MiB with no cgroup high/max/OOM event under `MemoryHigh=192M`, `MemoryMax=256M`, swap disabled and restart disabled. This is containment/idle evidence, not media capacity.- Chrome 151 synthetic `1/3/5/8` and 720p30 quality-change runs kept 2/1 fanout and decoding; slowest first frame was 1.05 seconds and one relay close recovered in 5.32 seconds. This is control evidence only.