Compare commits
No files matched your search
@@ -27,8 +27,7 @@ jobs:
|
||||
github.repository == 'TNTcraftHIM/Piik' && github.ref == 'refs/heads/main' &&
|
||||
(github.event_name == 'workflow_dispatch' ||
|
||||
(github.event.workflow_run.event == 'push' &&
|
||||
github.event.workflow_run.head_branch == 'main' &&
|
||||
github.event.workflow_run.conclusion == 'success'))
|
||||
github.event.workflow_run.head_branch == 'main'))
|
||||
runs-on: ubuntu-latest
|
||||
timeout-minutes: 30
|
||||
steps:
|
||||
|
||||
@@ -224,6 +224,26 @@ schema validation fails closed before accepting signaling or media admission.
|
||||
|
||||
## Postflight
|
||||
|
||||
Package publication, the website, and running Piik services are separate delivery
|
||||
targets. CI publishes packages and the website; it does not update the managed
|
||||
Demo or private service. Complete their authorized deployment before reporting
|
||||
the release as deployed, and verify each service against the release descriptor:
|
||||
|
||||
```sh
|
||||
node --env-file=.env.maintenance.demo.local scripts/release-maintenance.mjs server-check --revision FULL_SOURCE_SHA
|
||||
node --env-file=.env.maintenance.private.local scripts/release-maintenance.mjs server-check --revision FULL_SOURCE_SHA
|
||||
```
|
||||
|
||||
The website's latest-version card reads GitHub metadata and cannot establish
|
||||
which release either service is running.
|
||||
|
||||
Download mirrors have a separate completion check: the AtomGit stable/latest
|
||||
release must match the published version and source, and every package must pass
|
||||
the mirror publisher's anonymous download and checksum verification. A green
|
||||
workflow that skipped its upload step is not mirror completion. Keep a failed
|
||||
mirror in the active TODO ledger until recovery and postflight succeed; source
|
||||
synchronization alone does not publish download attachments.
|
||||
|
||||
Verify only the surfaces relevant to the release:
|
||||
|
||||
- local and public `/healthz` return `{"status":"ok"}`;
|
||||
|
||||
@@ -28,8 +28,8 @@ Choose a guide to start sharing, use room tools or solve a problem.
|
||||
|
||||
## Get help
|
||||
|
||||
- **App, sharing or sound problems:** start with the [symptom index](./troubleshooting.md#common-problems).
|
||||
- **Campus networks, media connections or virtual LANs:** use [network checks](./network.md) to choose a connection option.
|
||||
- **Cannot join, share or hear a friend:** [find the checks for your problem](./troubleshooting.md#common-problems).
|
||||
- **The page opens, but picture or voice still will not connect:** after the basic checks, use [network checks](./network.md) to compare browsers, networks or a virtual LAN.
|
||||
|
||||
Still stuck? [Report a problem](https://github.com/TNTcraftHIM/Piik/issues/new/choose)
|
||||
with your version, system, browser and reproduction steps. Follow the
|
||||
|
||||
@@ -28,8 +28,8 @@
|
||||
|
||||
## 遇到问题
|
||||
|
||||
- **App、分享或声音异常:** 从[问题排查的症状索引](./troubleshooting.zh-CN.md#常见问题)开始。
|
||||
- **校园网、画面连不上或虚拟局域网:** 查看[进阶网络排查](./network.zh-CN.md),按现象选择连接方案。
|
||||
- **进不了房间、无法分享或听不到朋友:** 先看[对应的排查步骤](./troubleshooting.zh-CN.md#常见问题)。
|
||||
- **网页能打开,基本检查后画面或语音仍连不上:** 再看[进阶网络排查](./network.zh-CN.md),对照浏览器、网络或虚拟局域网。
|
||||
|
||||
仍然没解决?可以[反馈问题](https://github.com/TNTcraftHIM/Piik/issues/new/choose),
|
||||
附上版本、系统、浏览器和复现步骤。需要收集报告时,按[反馈说明](./troubleshooting.zh-CN.md#反馈问题)导出。
|
||||
|
||||
@@ -40,6 +40,10 @@ you do not need to create a room in your App to watch them.
|
||||
second device or send it to a friend.
|
||||
4. Select **Stop sharing** when finished.
|
||||
|
||||
On iPhone/iPad, screen sharing requires **Safari on iOS/iPadOS 27 or later**.
|
||||
See [iPhone and iPad screen sharing](./sharing.md#iphone-and-ipad-screen-sharing)
|
||||
for sound support and the separate requirements for watching and cameras.
|
||||
|
||||
The online version is provided by the project. Media travels only between participants (P2P);
|
||||
restrictive networks may load the page but block video.
|
||||
|
||||
|
||||
@@ -36,6 +36,9 @@ Piik 支持一位房主分享屏幕,最多 20 位受邀观众观看。先选
|
||||
3. 确认预览后,点击 **复制邀请链接**,用另一台设备打开,或发送给朋友。
|
||||
4. 分享结束后,点击 **停止分享**。
|
||||
|
||||
iPhone/iPad 屏幕分享需使用 **iOS/iPadOS 27 及以上的 Safari**。
|
||||
声音支持及观看、摄像头的区别,见 [iPhone 与 iPad 屏幕分享](./sharing.zh-CN.md#iphone-与-ipad-屏幕分享)。
|
||||
|
||||
在线版由项目提供,画面仅通过设备间直连(P2P)传输。
|
||||
在受限网络下,可能出现页面能打开、画面无法连接的情况。
|
||||
|
||||
|
||||
+13
-12
@@ -2,22 +2,21 @@
|
||||
|
||||
English · [简体中文](./network.zh-CN.md) · [Troubleshooting](./troubleshooting.md)
|
||||
|
||||
Use this page when **the page opens, but picture or voice will not connect**.
|
||||
Choose the relevant check:
|
||||
Start with the [basic connection checks](./troubleshooting.md#common-problems).
|
||||
If you still cannot connect, choose what matches:
|
||||
|
||||
- **Campus/work network, or the same invite works on a hotspot:** [connection options](#campus-networks-and-strict-nat).
|
||||
- **The same invite works in another browser:** [browser restrictions](#browser-webrtc-restrictions).
|
||||
- **The same invite works on a hotspot:** [connection options](#campus-networks-and-strict-nat).
|
||||
- **Friends in another location cannot reach your local invitation:** [connect through a virtual LAN](#optional-a-virtual-lan).
|
||||
- **Logs mention STUN, or you manage the router:** [discovery and router checks](#stun-ipv6-and-router-checks).
|
||||
- **Using Tailscale, ZeroTier or UU:** [virtual LAN steps](#optional-a-virtual-lan).
|
||||
|
||||
Web pages and chat use a separate connection from picture and sound.
|
||||
For media failures, check WebRTC UDP and the route options below.
|
||||
If a [public-invitation page will not open](./troubleshooting.md#public-invitation-fails-or-shows-1033)
|
||||
or [video plays but blurs or stutters](./troubleshooting.md#picture-blurs-stutters-or-stops), follow that symptom instead.
|
||||
|
||||
Web pages and chat use a separate connection from picture and sound:
|
||||
|
||||

|
||||
|
||||
If the [invitation page will not open](./troubleshooting.md#public-invitation-fails-or-shows-1033),
|
||||
or [video already plays but blurs or stutters](./troubleshooting.md#picture-blurs-stutters-or-stops), start with that symptom instead.
|
||||
|
||||
## Campus networks and strict NAT
|
||||
|
||||
**Open the same invitation on a phone hotspot first.** If it works there but not
|
||||
@@ -26,7 +25,7 @@ on the original network, investigate that network's shared gateway or firewall.
|
||||
For regular use, choose an option that fits your group:
|
||||
|
||||
- **You have a Piik site:** ask its operator to [enable server media forwarding (SFU)](../operations/self-hosting.md#optional-media-fallback). The Host turns off **Privacy mode** so forwarding can be tried if direct connections fail. For App capture, [approve the new site](./getting-started.md#use-app-with-an-existing-site), then send its invitation.
|
||||
- **Everyone can install a networking tool:** use the [virtual LAN steps](#optional-a-virtual-lan) below with the App's **Local room**.
|
||||
- **No usable forwarding site, and direct media still will not connect:** a [virtual LAN](#optional-a-virtual-lan) offers another path. Everyone joins the same virtual network, then uses the App's **Local room**.
|
||||
- **The required connections are blocked:** use an available network or ask its administrator to review access.
|
||||
|
||||
> **Media requires UDP.** `demo.piik.tv` and App **Public invite** use P2P-only media.
|
||||
@@ -102,8 +101,10 @@ and [double NAT](https://www.tp-link.com/us/support/faq/3113/).
|
||||
|
||||
## Optional: a virtual LAN
|
||||
|
||||
A virtual LAN connects devices in different places, so you can share through
|
||||
Piik App's **Local room**. The tool must provide reachable virtual IPv4 addresses
|
||||
If friends elsewhere cannot reach your local invitation, or direct media still
|
||||
will not connect after the basic checks, try a virtual LAN. It connects your
|
||||
devices so you can use Piik App's **Local room** instead of the public-invite path.
|
||||
The tool must provide reachable virtual IPv4 addresses
|
||||
and carry both web traffic and WebRTC UDP; acceleration limited to one game does
|
||||
not suffice. Choose a tool available to everyone in your group:
|
||||
|
||||
|
||||
@@ -2,19 +2,20 @@
|
||||
|
||||
[English](./network.md) · 简体中文 · [问题排查](./troubleshooting.zh-CN.md)
|
||||
|
||||
本页用于排查 **网页能打开,但画面或语音连接不上**。按你的情况选择:
|
||||
先做[连接问题的基本检查](./troubleshooting.zh-CN.md#常见问题)。
|
||||
仍然连不上时,再按现象选择:
|
||||
|
||||
- **校园网、公司网络,或换成热点就能看:** [选择连接方案](#校园网或严格-nat)。
|
||||
- **同一邀请在别的浏览器里正常:** [检查浏览器限制](#浏览器限制了-webrtc)。
|
||||
- **换成热点就能看:** [选择连接方案](#校园网或严格-nat)。
|
||||
- **异地朋友打不开你的本地邀请:** [通过虚拟局域网连接](#可选虚拟局域网)。
|
||||
- **日志提到 STUN,或准备检查自家路由器:** [地址发现与路由器](#stunipv6-与路由器检查)。
|
||||
- **准备使用 UU、Tailscale 或 ZeroTier:** [虚拟局域网使用步骤](#可选虚拟局域网)。
|
||||
|
||||
网页与聊天、画面与声音使用不同的连接。媒体连接失败时,检查 WebRTC UDP 和下方的连接方案。
|
||||
如果是[公网邀请网页打不开](./troubleshooting.zh-CN.md#公网邀请创建失败或出现-1033),或[有画面但模糊、卡顿](./troubleshooting.zh-CN.md#画面模糊卡顿或中断),先按对应症状排查。
|
||||
|
||||
网页与聊天、画面与声音使用不同的连接:
|
||||
|
||||

|
||||
|
||||
如果是[邀请网页打不开](./troubleshooting.zh-CN.md#公网邀请创建失败或出现-1033),或[画面已经出现但模糊、卡顿](./troubleshooting.zh-CN.md#画面模糊卡顿或中断),先按对应症状排查。
|
||||
|
||||
## 校园网或严格 NAT
|
||||
|
||||
**先用手机热点打开同一邀请。** 热点能看、原网络不能看时,原网络的共享出口或防火墙限制更值得检查。
|
||||
@@ -22,7 +23,7 @@
|
||||
需要长期使用时,可以选择以下方案:
|
||||
|
||||
- **有可用的 Piik 站点:** 请管理员[启用服务器媒体转发(SFU)](../operations/self-hosting.zh-CN.md#可选启用媒体兜底),房主关闭 **隐私模式**,直连失败时即可尝试转发。使用 App 采集时,[授权新站点](./getting-started.zh-CN.md#通过已有站点使用-app),再发送该站点的邀请。
|
||||
- **朋友们可以安装组网工具:** 按下方[虚拟局域网步骤](#可选虚拟局域网),通过 App 的 **本地房间** 分享。
|
||||
- **没有可用的转发站点,直连仍然失败:** 可尝试[虚拟局域网](#可选虚拟局域网)。朋友们加入同一个虚拟网络,再通过 App 的 **本地房间** 分享。
|
||||
- **所需的连接被网络阻断:** 换用可用网络,或请网络管理员检查放行。
|
||||
|
||||
> **媒体需要 UDP。** `demo.piik.tv` 和 App 的 **公网邀请** 使用纯 P2P。
|
||||
@@ -89,7 +90,8 @@ STUN 服务会接收到参与者的公网 IP,请选择信任的服务。
|
||||
|
||||
## 可选:虚拟局域网
|
||||
|
||||
虚拟局域网让异地设备像在同一网络中一样互访,再通过 Piik App 的 **本地房间** 分享。
|
||||
异地朋友打不开本地邀请,或基本检查后画面、语音仍然连不上时,可以尝试虚拟局域网。
|
||||
它让设备像在同一网络中一样互访,改用 Piik App 的 **本地房间** 分享。
|
||||
工具必须提供可互访的虚拟 IPv4 地址,同时支持网页访问和 WebRTC UDP;只加速某个游戏的功能不适用。
|
||||
选择朋友们都能使用的工具即可:
|
||||
|
||||
|
||||
@@ -41,6 +41,18 @@ sharing. Viewers hear it through the picture's sound without joining room voice.
|
||||
Room voice remains independent. If you enable both microphones, listeners may
|
||||
hear you twice; Piik warns you and leaves the choice to you.
|
||||
|
||||
## iPhone and iPad screen sharing
|
||||
|
||||
Use **Safari on iOS/iPadOS 27 or later** and select **Browser** to share your screen.
|
||||
Watching a friend and camera sharing use the browser's existing capabilities
|
||||
and do not require this screen-sharing version.
|
||||
|
||||
Safari screen sharing does **not** capture system audio. To speak with the picture,
|
||||
explicitly enable [Include my microphone](#include-your-microphone).
|
||||
MDN's [verified Safari 27 support](https://github.com/mdn/browser-compat-data/pull/30732)
|
||||
and [screen/audio compatibility data](https://github.com/mdn/browser-compat-data/blob/main/api/MediaDevices.json)
|
||||
distinguish screen capture from audio capture.
|
||||
|
||||
## Cameras and virtual audio inputs
|
||||
|
||||
Picture sound and conversation use separate controls. Muting one does not mute the other.
|
||||
|
||||
@@ -34,6 +34,15 @@
|
||||
每次开始新的分享时默认关闭,停止分享也会停止这路麦克风。观众通过画面声音收听,无须加入房间语音。
|
||||
房间语音独立运行。如果同时开启两路麦克风,听众可能听到两次你的声音;Piik 会提示,由你决定保留哪一路。
|
||||
|
||||
## iPhone 与 iPad 屏幕分享
|
||||
|
||||
请使用 **iOS/iPadOS 27 及以上的 Safari**,选择 **浏览器** 分享屏幕。
|
||||
观看朋友的画面和分享摄像头使用浏览器已有能力,不受此屏幕分享版本门槛限制。
|
||||
|
||||
Safari 屏幕分享**不采集系统声音**。需要随画面讲话时,可主动开启[分享麦克风](#分享麦克风)。
|
||||
依据 MDN 的 [Safari 27 实测记录](https://github.com/mdn/browser-compat-data/pull/30732)
|
||||
及[屏幕/音频兼容数据](https://github.com/mdn/browser-compat-data/blob/main/api/MediaDevices.json),两者支持情况不同。
|
||||
|
||||
## 摄像头与虚拟音频输入
|
||||
|
||||

|
||||
|
||||
@@ -516,7 +516,8 @@ Read discovery logs or check a router you manage. [View steps](./network.md#stun
|
||||
|
||||
### Optional: a virtual LAN
|
||||
|
||||
Use Local room over Tailscale, ZeroTier or UU. [View steps](./network.md#optional-a-virtual-lan).
|
||||
Friends elsewhere cannot reach a local invitation, or direct media still will not
|
||||
connect? A virtual LAN provides another connection option. [View steps](./network.md#optional-a-virtual-lan).
|
||||
|
||||
## Reporting a problem
|
||||
|
||||
|
||||
@@ -425,7 +425,8 @@ Piik 的麦克风静音不会关闭这条独立来源。
|
||||
|
||||
### 可选:虚拟局域网
|
||||
|
||||
通过 UU 等组网工具使用本地房间。 [查看步骤](./network.zh-CN.md#可选虚拟局域网)。
|
||||
异地朋友打不开本地邀请,或直连始终失败时,可尝试通过虚拟局域网连接。
|
||||
[查看步骤](./network.zh-CN.md#可选虚拟局域网)。
|
||||
|
||||
## 反馈问题
|
||||
|
||||
|
||||
@@ -97,9 +97,11 @@ the **AtomGit mirror** GitHub workflow separately copies published binary assets
|
||||
Its repository Actions secret is `ATOMGIT_TOKEN`. Never put this token in source,
|
||||
a remote URL or a distributed package. GitHub publication keeps its scoped token.
|
||||
|
||||
After a successful main-push CI run, the workflow downloads that run's complete
|
||||
After a completed main-push CI run, the workflow checks whether that run published
|
||||
the current stable GitHub release. A later failed container step does not prevent
|
||||
mirroring already-published packages. It downloads the matching run's complete
|
||||
original Server and App artifacts and invokes `scripts/mirror-release.mjs`.
|
||||
It skips runs that did not publish the current GitHub release. GitHub publication
|
||||
Runs without the current published release are skipped. GitHub publication
|
||||
and **Website** do not depend on mirror success. An unfinished mirror remains a
|
||||
prerelease until every package passes anonymous full-download SHA-256 validation.
|
||||
This includes the original signed APK and its already-built ZIP wrapper.
|
||||
|
||||
@@ -104,6 +104,8 @@ node --env-file=.env.maintenance.local scripts/release-maintenance.mjs server-ch
|
||||
root/index asset references. `website-purge` clears those entry points from
|
||||
Cloudflare; visitors' Browser caches remain separate. `server-check` is a read-only
|
||||
SSH check of the Linux `piik` service, running package and public health.
|
||||
After deployment, pass `--revision FULL_SOURCE_SHA` from the release descriptor;
|
||||
an older healthy service then fails the check.
|
||||
Keep separate ignored env files or SSH aliases for different Server targets;
|
||||
keep private connection details out of scripts. For package upload, cutover
|
||||
and recovery, follow [Server deployment](../deployment.md).
|
||||
|
||||
@@ -66,6 +66,35 @@ Keep existing controls in their established positions as a room becomes active.
|
||||
Represent missing room identity with a passive placeholder in its own slot;
|
||||
do not move unrelated controls into that space to fill an empty state.
|
||||
|
||||
### Space Priority
|
||||
|
||||
Assign space by meaning before choosing a breakpoint. The containing row or
|
||||
toolbar owns its layout; the shared control declares whether its caption may
|
||||
collapse. Primary styling, a quiet appearance or a particular icon does not
|
||||
determine that priority.
|
||||
|
||||
| Content or action | Behavior when space is limited |
|
||||
| --- | --- |
|
||||
| A name, selected device or other object being acted on | Give the value space before its supporting action's caption. After that, keep the group together where possible; long names may use the full available line and then ellipsis with their existing full-value hint. |
|
||||
| Exact short values, units, entry fields and validation | Keep the value and unit together; preserve usable editing width. Wrap the field group or explanation instead of clipping the value or shrinking its type. |
|
||||
| Contextual actions with a familiar icon, such as Edit or Copy | Explicitly allow the caption to collapse first. Retain the same icon, accessible name, hint and normal click target. |
|
||||
| Primary, destructive or unfamiliar choices | Keep enough visible identity to distinguish the action and its scope; retain wording when an icon would be ambiguous. Wrap complete actions or their group. |
|
||||
| Secondary utilities and detail settings | Reuse the surface's existing More/settings disclosure when needed. Keep frequent playback, mute and stop/release controls directly reachable. |
|
||||
|
||||
Use this order: remove surplus spacing, collapse eligible supporting captions,
|
||||
reflow coherent groups, then shorten long descriptive values. Do not reduce all
|
||||
children equally or use blanket `nowrap` to force a row to fit. For example,
|
||||
the nickname gets space before the word **Edit**; the pencil remains beside it
|
||||
until the whole identity group needs its own line.
|
||||
|
||||
`Btn` owns optional caption collapse and button geometry. Layout owners select
|
||||
the applicable container state; they must not copy per-page glyph sizes or hide
|
||||
all captions indiscriminately. Header overflow remains its existing single
|
||||
disclosure and focus owner. The website and room UI follow these same priorities
|
||||
while keeping their distinct layouts. Check real short/long values, translated
|
||||
labels, active/editing states and text zoom; fitting inside the viewport alone
|
||||
does not prove the important content stayed readable.
|
||||
|
||||
### Control Selection
|
||||
|
||||
Choose by the user's task, then reuse its interaction and visual primitive.
|
||||
@@ -817,6 +846,11 @@ stationary and manually scrollable instead of discarding the hidden words.
|
||||
|
||||
## Interaction References
|
||||
|
||||
[Fluent toolbars](https://fluent2.microsoft.design/components/web/react/core/toolbar/usage)
|
||||
and [Atlassian navigation layout](https://atlassian.design/components/navigation-system/layout/code)
|
||||
distinguish directly available actions from overflow. Piik applies those priorities
|
||||
through its existing controls and layout owners, not a second toolbar framework.
|
||||
|
||||
[Radix colour roles](https://www.radix-ui.com/colors/docs/palette-composition/understanding-the-scale)
|
||||
separate surfaces, interaction states, borders and text instead of tinting every
|
||||
layer with the accent. Native [text selection](https://developer.mozilla.org/en-US/docs/Web/CSS/user-select)
|
||||
|
||||
+6
-1
@@ -1,12 +1,17 @@
|
||||
# Current TODO Ledger
|
||||
|
||||
Last reviewed: 2026-11-04
|
||||
Last reviewed: 2026-11-07
|
||||
|
||||
This ledger contains unfinished work and explicit owner holds. Product modules
|
||||
own behavior; research and Git/PRs own evidence and completed history.
|
||||
|
||||
## Now
|
||||
|
||||
- [ ] **Blue-tinted sharing (#529).** Identify the source and affected receive
|
||||
path from [#529](https://github.com/TNTcraftHIM/Piik/issues/529): Piik version,
|
||||
platform, capture choice and matching source/Viewer screenshots. Compare
|
||||
those pixels with the existing colour controls; increased bitrate did not
|
||||
resolve the reported tint.
|
||||
- [ ] **Browser sharing falls to low source FPS during motion.** Capture original
|
||||
track, isolated capture-input and sender counters during the same low-FPS
|
||||
episode on Windows Chrome with mixed direct/SFU delivery. The observed sender
|
||||
|
||||
@@ -40,10 +40,11 @@ function verifyImage(reference, server) {
|
||||
}
|
||||
const tag = `${destination}:${version}`;
|
||||
function manifest(reference) {
|
||||
try { return JSON.parse(run("docker", "manifest", "inspect", reference)); }
|
||||
// manifest inspect reconstructs the list and drops descriptor annotations.
|
||||
try { return JSON.parse(run("docker", "buildx", "imagetools", "inspect", "--raw", reference)); }
|
||||
catch (error) {
|
||||
// Authentication/network failures are not evidence that a tag is absent.
|
||||
if (!/manifest unknown|no such manifest/i.test(String(error.stderr ?? ""))) throw error;
|
||||
if (String(error.stderr ?? "").trim().replace(/^ERROR: /, "") !== `${reference}: not found`) throw error;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,14 +2,22 @@
|
||||
|
||||
import assert from "node:assert/strict";
|
||||
import { execFileSync } from "node:child_process";
|
||||
import { parseArgs } from "node:util";
|
||||
|
||||
const command = process.argv[2] ?? "website-check";
|
||||
const { values, positionals } = parseArgs({ options: {
|
||||
help: { type: "boolean" }, revision: { type: "string" },
|
||||
}, allowPositionals: true });
|
||||
const command = positionals[0] ?? "website-check";
|
||||
const commands = ["website-check", "website-purge", "server-check"];
|
||||
if (command === "--help") {
|
||||
console.log("Usage: node --env-file=.env.maintenance.local scripts/release-maintenance.mjs <command>\nCommands: " + commands.join(", "));
|
||||
if (values.help) {
|
||||
console.log("Usage: node --env-file=.env.maintenance.local scripts/release-maintenance.mjs <command> [--revision <full-source-SHA>]\nCommands: " + commands.join(", ") + "\n--revision verifies the expected server deployment.");
|
||||
process.exit(0);
|
||||
}
|
||||
assert.ok(commands.includes(command) && process.argv.length <= 3, "Unknown maintenance command; use --help.");
|
||||
assert.ok(commands.includes(command) && positionals.length <= 1, "Unknown maintenance command; use --help.");
|
||||
if (values.revision !== undefined) {
|
||||
assert.equal(command, "server-check", "--revision applies only to server-check.");
|
||||
assert.match(values.revision, /^[a-f0-9]{40}$/, "Use the release descriptor's full source revision.");
|
||||
}
|
||||
const required = name => {
|
||||
const value = process.env[name]?.trim();
|
||||
assert.ok(value, `Set ${name} in the local maintenance env file.`);
|
||||
@@ -94,6 +102,7 @@ print(json.dumps({
|
||||
assert.equal((await response.json()).status, "ok");
|
||||
assert.equal(remote.service, "active");
|
||||
assert.equal(remote.runningPackage, true, "The running binary differs from the current release.");
|
||||
if (values.revision) assert.equal(remote.revision, values.revision, "The service is not running the expected release.");
|
||||
return { ...remote, origin: origin.origin, health: true, passed: true };
|
||||
}
|
||||
|
||||
|
||||
@@ -16,12 +16,11 @@ export function resolveMirrorSource(runId, automatic = false) {
|
||||
if (run.id !== Number(runId) || run.repository?.full_name !== repository ||
|
||||
run.head_repository?.full_name !== repository || run.event !== "push" ||
|
||||
run.head_branch !== "main" || run.path !== ".github/workflows/repository-hygiene.yml" ||
|
||||
run.status !== "completed" || !/^[a-f0-9]{40}$/.test(run.head_sha) ||
|
||||
(automatic && run.conclusion !== "success")) {
|
||||
run.status !== "completed" || !/^[a-f0-9]{40}$/.test(run.head_sha)) {
|
||||
throw new Error("Mirror artifacts must come from a completed main push in this repository's CI workflow");
|
||||
}
|
||||
// A legacy CI run may be red because its mirror failed after GitHub published.
|
||||
// The published release, not that aggregate result, owns manual retry identity.
|
||||
// A later publication step can fail after GitHub has published the packages.
|
||||
// The matching stable release owns mirror identity, not the CI aggregate result.
|
||||
const release = gh("releases/latest");
|
||||
if (release.draft !== false || release.prerelease !== false || !isReleaseVersion(release.tag_name) ||
|
||||
!/^[a-f0-9]{40}$/.test(release.target_commitish)) {
|
||||
|
||||
@@ -319,7 +319,7 @@ function Screen({ shot }: { shot: Shot }) {
|
||||
<div className={viewer ? "lr-viewer-personal-controls" : "lr-host-personal-controls"}>
|
||||
<div className={`lr-row-group lr-group-name ${viewer ? "lr-viewer-self-slot" : "lr-host-identity-slot"}`}>
|
||||
<NameTag name={viewer ? names[0] : name} identity={viewer ? guests[0] : host} />
|
||||
<Btn icon="pencil" cap="common.edit" title="host.nameEdit" hint="hint-rename" />
|
||||
<Btn icon="pencil" cap="common.edit" collapsibleCaption title="host.nameEdit" hint="hint-rename" />
|
||||
</div>
|
||||
<div className={`lr-row-group lr-group-actions ${viewer ? "lr-viewer-actions-slot" : "lr-host-diagnostics-slot"}`}>
|
||||
<Btn icon="gauge" cap="host.details" title="host.details.show" hint="hint-details" disabled={!live} />
|
||||
|
||||
+15
-14
@@ -638,11 +638,12 @@
|
||||
<p>
|
||||
<span lang="en"
|
||||
>Piik App is available for Windows, macOS, Linux and Android. Friends can watch in a computer or phone browser.
|
||||
Physical-device coverage for the macOS and Linux apps is still limited; if you have a device,
|
||||
we'd welcome your test results and <a href="https://github.com/TNTcraftHIM/Piik/issues">feedback</a>.</span
|
||||
On iPhone/iPad, screen sharing requires Safari on iOS/iPadOS 27 or later and does not include system sound. Watching and camera sharing use the browser's existing capabilities; see the <a href="./docs/sharing.html?lang=en#iphone-and-ipad-screen-sharing">sharing guide</a>.
|
||||
If something goes wrong, <a href="https://github.com/TNTcraftHIM/Piik/issues">let us know</a>.</span
|
||||
><span lang="zh-CN"
|
||||
>Piik App 提供 Windows、macOS、Linux 和 Android 版本,朋友可使用电脑或手机浏览器观看。
|
||||
macOS 和 Linux 版 Piik App 仍需更多实机测试,欢迎有设备的朋友试用并<a href="https://github.com/TNTcraftHIM/Piik/issues">反馈问题</a>。</span
|
||||
iPhone/iPad 屏幕分享需使用 iOS/iPadOS 27 及以上的 Safari,不包含系统声音;观看与摄像头分享使用浏览器已有能力,详见<a href="./docs/zh/sharing.html#iphone-与-ipad-屏幕分享">分享指南</a>。
|
||||
遇到问题欢迎<a href="https://github.com/TNTcraftHIM/Piik/issues">反馈</a>。</span
|
||||
>
|
||||
</p>
|
||||
</details>
|
||||
@@ -745,19 +746,19 @@
|
||||
</details>
|
||||
<div class="faq-more">
|
||||
<section aria-labelledby="faq-network-title">
|
||||
<h3 id="faq-network-title"><span lang="en">Campus or restricted network?</span><span lang="zh-CN">校园网或受限网络?</span></h3>
|
||||
<p><span lang="en">If direct connections fail, explore sites with media forwarding or a virtual LAN.</span><span lang="zh-CN">直连不通时,可尝试支持媒体转发的站点或虚拟局域网。</span></p>
|
||||
<a class="text-link" lang="en" href="./docs/network.html?lang=en">Explore connection options<span aria-hidden="true"> ↗</span></a>
|
||||
<a class="text-link" lang="zh-CN" href="./docs/zh/network.html">查看连接方案<span aria-hidden="true"> ↗</span></a>
|
||||
<h3 id="faq-network-title"><span lang="en">Can't join a friend's room?</span><span lang="zh-CN">进不了朋友的房间?</span></h3>
|
||||
<p><span lang="en">The page opens, but picture or voice won't connect? Check the browser and network.</span><span lang="zh-CN">网页能打开,但画面或语音连不上?检查浏览器与网络。</span></p>
|
||||
<a class="text-link" lang="en" href="./docs/network.html?lang=en">Troubleshoot joining<span aria-hidden="true"> ↗</span></a>
|
||||
<a class="text-link" lang="zh-CN" href="./docs/zh/network.html">排查连接问题<span aria-hidden="true"> ↗</span></a>
|
||||
</section>
|
||||
<section aria-labelledby="faq-help-title">
|
||||
<h3 id="faq-help-title"><span lang="en">Another sharing problem?</span><span lang="zh-CN">其他分享或连接问题?</span></h3>
|
||||
<p><span lang="en">Find steps for invitations, sharing failures, picture and sound.</span><span lang="zh-CN">按现象查找步骤:打不开邀请、无法分享、画面或声音异常。</span></p>
|
||||
<a class="text-link" href="./docs/troubleshooting.html?lang=en" data-doc-page="troubleshooting.html">
|
||||
<span lang="en">Open troubleshooting</span><span lang="zh-CN">查看问题排查</span><span aria-hidden="true"> ↗</span>
|
||||
</a>
|
||||
<h3 id="faq-help-title"><span lang="en">More questions?</span><span lang="zh-CN">更多问题</span></h3>
|
||||
<p><span lang="en">Find help with sharing, sound, picture quality and remote control.</span><span lang="zh-CN">分享、声音、画质与远程控制,按遇到的问题查找。</span></p>
|
||||
<a class="text-link" lang="en" href="./docs/troubleshooting.html?lang=en">Browse troubleshooting<span aria-hidden="true"> ↗</span></a>
|
||||
<a class="text-link" lang="zh-CN" href="./docs/zh/troubleshooting.html">查看疑难解答<span aria-hidden="true"> ↗</span></a>
|
||||
</section>
|
||||
</div>
|
||||
<p class="faq-feedback"><span lang="en">Still stuck? <a href="./docs/troubleshooting.html?lang=en#reporting-a-problem">Report a problem<span aria-hidden="true"> ↗</span></a></span><span lang="zh-CN">仍未解决?<a href="./docs/zh/troubleshooting.html#反馈问题">反馈问题<span aria-hidden="true"> ↗</span></a></span></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
@@ -905,13 +906,13 @@
|
||||
<p class="download-variant">iPhone / iPad</p>
|
||||
<a class="lr-btn button download-button" href="https://demo.piik.tv"
|
||||
><span lang="en">Use online</span><span lang="zh-CN">使用在线版</span><span aria-hidden="true">↗</span></a>
|
||||
<p class="download-note"><span lang="en">Use Piik in your browser. No installation needed.</span><span lang="zh-CN">无需安装,在浏览器中直接使用。</span></p>
|
||||
<p class="download-note"><span lang="en">Screen sharing requires Safari on iOS/iPadOS 27 or later.</span><span lang="zh-CN">屏幕分享需 iOS/iPadOS 27 及以上的 Safari。</span></p>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
<div class="download-help">
|
||||
<a class="lr-btn button" href="https://github.com/TNTcraftHIM/Piik"><span lang="en">View on GitHub</span><span lang="zh-CN">GitHub 项目</span><span aria-hidden="true"> ↗</span></a>
|
||||
<p><span lang="en">Found a problem? <a href="https://github.com/TNTcraftHIM/Piik/issues">Let us know</a>.</span><span lang="zh-CN">遇到问题?欢迎<a href="https://github.com/TNTcraftHIM/Piik/issues">反馈</a>。</span></p>
|
||||
<p><span lang="en">Need help? Start with <a href="./docs/troubleshooting.html?lang=en">troubleshooting</a>, or <a href="https://github.com/TNTcraftHIM/Piik/issues">report a problem</a>.</span><span lang="zh-CN">遇到问题?先看<a href="./docs/zh/troubleshooting.html">问题排查</a>,或向我们<a href="https://github.com/TNTcraftHIM/Piik/issues">反馈</a>。</span></p>
|
||||
</div>
|
||||
</section>
|
||||
|
||||
|
||||
@@ -175,6 +175,8 @@ h3 { font-size: 21px; font-weight: 700; letter-spacing: -.03em; line-height: 1.3
|
||||
.faq-more > section { display: flex; flex-direction: column; align-items: flex-start; gap: 10px; padding: 20px; border: 1px solid var(--line); border-radius: 18px; }
|
||||
.faq-more h3 { color: var(--ink); font-size: 15px; font-weight: 650; }
|
||||
.faq-more a { margin-top: auto; color: var(--ink); }
|
||||
.faq-feedback { margin-top: 12px; color: var(--muted); font-size: 12px; }
|
||||
.faq-feedback a { display: inline-block; padding-block: 8px; }
|
||||
summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 21px 0; font-size: 15px; font-weight: 650; list-style: none; }
|
||||
summary::-webkit-details-marker { display: none; }
|
||||
summary::after { content: "+"; flex: none; width: 22px; font-size: 21px; font-weight: 400; text-align: center; color: var(--action-text); }
|
||||
|
||||
@@ -98,6 +98,9 @@ export function FloatingPanel({ id, trigger, title, icon, compact = false, ancho
|
||||
// resizing the living room or taking ownership of scrolling/focus.
|
||||
const viewport = window.visualViewport;
|
||||
const place = (change?: PanelChange) => {
|
||||
// Native hiding/adoption can precede React's effect cleanup. Only this
|
||||
// document's visible panel can update its remembered in-page position.
|
||||
if (panel.ownerDocument !== document || !panel.matches(":popover-open")) return;
|
||||
const layout = document.documentElement;
|
||||
const width = viewport?.width ?? layout.clientWidth, height = viewport?.height ?? layout.clientHeight;
|
||||
const maxWidth = Math.max(0, width - 24), maxHeight = Math.max(0, height - 24);
|
||||
|
||||
@@ -85,7 +85,7 @@ const webVersion = import.meta.env.VITE_PIIK_VERSION ?? "development";
|
||||
const webRelease = /^v\d+\.\d+\.\d+$/.test(webVersion)
|
||||
? `https://github.com/TNTcraftHIM/Piik/releases/tag/${webVersion}` : null;
|
||||
|
||||
function BrowserHelpContent({ active }: { active: boolean }) {
|
||||
function BrowserHelpContent({ active, diagnosticControl }: { active: boolean; diagnosticControl?: React.ReactNode }) {
|
||||
const { lang, vis, t } = useCopy();
|
||||
const guide = useProjectLink(`/docs/${lang === "zh" ? "zh/" : ""}troubleshooting.html`,
|
||||
`https://github.com/TNTcraftHIM/Piik/blob/main/docs/guide/troubleshooting${lang === "zh" ? ".zh-CN" : ""}.md`, active);
|
||||
@@ -101,13 +101,13 @@ function BrowserHelpContent({ active }: { active: boolean }) {
|
||||
<Glyph name="book" size={16} />{!vis && <span className="lr-cap">{t("help.troubleshooting")}</span>}
|
||||
</a>
|
||||
</Tooltip>
|
||||
<BrowserDiagnosticsButton size="compact" quiet />
|
||||
{diagnosticControl === undefined ? <BrowserDiagnosticsButton size="compact" quiet /> : diagnosticControl}
|
||||
</>}
|
||||
</nav>
|
||||
</div>;
|
||||
}
|
||||
|
||||
function BrowserHelpMenu() {
|
||||
function BrowserHelpMenu({ diagnosticControl }: { diagnosticControl?: React.ReactNode }) {
|
||||
const { vis, t } = useCopy();
|
||||
const id = useId();
|
||||
const trigger = useRef<HTMLButtonElement>(null);
|
||||
@@ -125,7 +125,7 @@ function BrowserHelpMenu() {
|
||||
className="lr-anchored-card lr-help-menu" onToggle={event => {
|
||||
if (event.target === event.currentTarget) setOpen(event.newState === "open");
|
||||
}}>
|
||||
<BrowserHelpContent active={open} />
|
||||
<BrowserHelpContent active={open} diagnosticControl={diagnosticControl} />
|
||||
</div>, document.body)}
|
||||
</>;
|
||||
}
|
||||
@@ -198,7 +198,7 @@ export function HeaderControls({ diagnosticControl, appControl }: { diagnosticCo
|
||||
{themeButton}
|
||||
</Tooltip>
|
||||
</div>
|
||||
{diagnosticControl === undefined ? compact ? <BrowserHelpContent active={open} /> : <BrowserHelpMenu /> : diagnosticControl}
|
||||
{compact ? <BrowserHelpContent active={open} diagnosticControl={diagnosticControl} /> : <BrowserHelpMenu diagnosticControl={diagnosticControl} />}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
import { useEffect, useId, useRef, useState, type ReactNode } from "react";
|
||||
import { useCopy } from "../../ui/copy";
|
||||
import { Glyph } from "../../ui/icons";
|
||||
|
||||
export function NumberControl({ value, min, max, step, unit, showUnit = true, name, label, disabled, onChange, className, children }: {
|
||||
value: number;
|
||||
@@ -19,6 +20,7 @@ export function NumberControl({ value, min, max, step, unit, showUnit = true, na
|
||||
const [invalid, setInvalid] = useState(false);
|
||||
const errorId = useId();
|
||||
const input = useRef<HTMLInputElement>(null);
|
||||
useEffect(() => { input.current!.value = String(value); }, [value]);
|
||||
useEffect(() => setInvalid(false), [value, min, max, step]);
|
||||
const reset = () => { input.current!.value = String(value); setInvalid(false); };
|
||||
const select = (next: number) => {
|
||||
@@ -26,8 +28,14 @@ export function NumberControl({ value, min, max, step, unit, showUnit = true, na
|
||||
reset();
|
||||
if (next !== value) onChange(next);
|
||||
};
|
||||
const number = <label className="lr-input lr-quality-number">
|
||||
<input ref={input} type="number" inputMode={step < 1 ? "decimal" : "numeric"} name={name} key={value}
|
||||
const adjust = (direction: number) => {
|
||||
const field = input.current!;
|
||||
if (direction > 0) field.stepUp(); else field.stepDown();
|
||||
const valid = field.validity.valid && Number.isFinite(field.valueAsNumber);
|
||||
if (valid) select(field.valueAsNumber); else setInvalid(true);
|
||||
};
|
||||
const number = <span className="lr-input lr-quality-number">
|
||||
<input ref={input} type="number" inputMode={step < 1 ? "decimal" : "numeric"} name={name}
|
||||
defaultValue={value} min={min} max={max} step={step} disabled={disabled} required aria-label={label}
|
||||
aria-invalid={invalid || undefined} aria-describedby={invalid ? errorId : undefined}
|
||||
onInput={() => setInvalid(false)}
|
||||
@@ -40,7 +48,13 @@ export function NumberControl({ value, min, max, step, unit, showUnit = true, na
|
||||
event.currentTarget.blur();
|
||||
}} />
|
||||
{showUnit && <span>{unit}</span>}
|
||||
</label>;
|
||||
<span className="lr-number-steppers" onPointerDown={event => event.preventDefault()}>
|
||||
<button type="button" className="lr-btn is-dense is-quiet" disabled={disabled}
|
||||
aria-label={t("common.increase", { name: label })} onClick={() => adjust(1)}><Glyph name="arrowUp" size={14} /></button>
|
||||
<button type="button" className="lr-btn is-dense is-quiet" disabled={disabled}
|
||||
aria-label={t("common.decrease", { name: label })} onClick={() => adjust(-1)}><Glyph name="arrowDown" size={14} /></button>
|
||||
</span>
|
||||
</span>;
|
||||
return <div className={className} onBlur={event => {
|
||||
if (event.currentTarget.contains(event.relatedTarget)) return;
|
||||
const field = input.current!;
|
||||
|
||||
@@ -45,6 +45,10 @@ button { -webkit-user-select: none; user-select: none; -webkit-touch-callout: no
|
||||
.lr-btn > .lr-glyph { width: var(--button-icon-size, var(--control-icon-size)); height: var(--button-icon-size, var(--control-icon-size)); }
|
||||
.lr-btn.is-compact { --button-size: var(--control-compact-size); --button-padding: 10px; }
|
||||
.lr-btn.is-dense { --button-size: var(--control-dense-size); --button-padding: 8px; --button-icon-size: 16px; }
|
||||
@container value-actions (max-width: 420px) {
|
||||
.lr-btn[data-caption="collapsible"] { width: var(--button-size, var(--control-size)); padding-inline: 0; }
|
||||
.lr-btn[data-caption="collapsible"] > .lr-cap { display: none; }
|
||||
}
|
||||
.lr-btn.is-quiet { border-radius: 12px; }
|
||||
.lr-btn.is-quiet:not(.is-on):not(.is-primary):not(.is-danger) { background: transparent; border-color: transparent; color: var(--muted); box-shadow: none; }
|
||||
.lr-btn.is-quiet:not(.is-on):not(.is-primary):not(.is-danger):is(:hover, :focus-visible):not(:disabled):not([aria-disabled="true"]) { background: var(--control-hover); border-color: transparent; color: var(--ink); }
|
||||
|
||||
@@ -43,6 +43,7 @@ export function Btn({
|
||||
id,
|
||||
icon,
|
||||
cap,
|
||||
collapsibleCaption = false,
|
||||
tone,
|
||||
size,
|
||||
quiet = false,
|
||||
@@ -66,6 +67,8 @@ export function Btn({
|
||||
id?: string;
|
||||
icon: GlyphName;
|
||||
cap?: CopyKey;
|
||||
/** Auxiliary caption may yield space while its icon, label and hint remain. */
|
||||
collapsibleCaption?: boolean;
|
||||
tone?: "primary" | "danger" | "on";
|
||||
size?: "compact" | "dense";
|
||||
quiet?: boolean;
|
||||
@@ -100,6 +103,7 @@ export function Btn({
|
||||
id={id}
|
||||
type={type}
|
||||
className={`lr-btn${size ? ` is-${size}` : ""}${quiet ? " is-quiet" : ""}${activeTone ? ` is-${activeTone}` : ""}`}
|
||||
data-caption={collapsibleCaption ? "collapsible" : undefined}
|
||||
aria-label={label}
|
||||
disabled={disabled && !softDisabled}
|
||||
aria-disabled={softDisabled || undefined}
|
||||
|
||||
@@ -31,7 +31,10 @@ export function useAnchoredPopover(
|
||||
const left = (viewport?.offsetLeft ?? 0) + 8, top = (viewport?.offsetTop ?? 0) + 8;
|
||||
const right = left + (viewport?.width ?? view.innerWidth) - 16;
|
||||
const bottom = top + (viewport?.height ?? view.innerHeight) - 16;
|
||||
if (!anchor.getClientRects().length || rect.bottom < top || rect.top > bottom || rect.right < left || rect.left > right) {
|
||||
const anchorOutside = rect.bottom < top || rect.top > bottom || rect.right < left || rect.left > right;
|
||||
// A keyboard can cover the anchor while its popover still owns input.
|
||||
// Keep that editing surface placed in view; a removed trigger still closes it.
|
||||
if (!anchor.getClientRects().length || (anchorOutside && !menu.contains(menu.ownerDocument.activeElement))) {
|
||||
menu.hidePopover();
|
||||
return;
|
||||
}
|
||||
@@ -44,7 +47,7 @@ export function useAnchoredPopover(
|
||||
const preferredHeight = Math.min(height, minVisibleHeight);
|
||||
const openAbove = side === "above" ? above >= preferredHeight || above > below : below < preferredHeight && above > below;
|
||||
const beside = openAbove ? above : below;
|
||||
menu.style.maxHeight = `${Math.min(maxHeight, beside >= preferredHeight ? beside : bottom - top)}px`;
|
||||
menu.style.maxHeight = `${Math.min(maxHeight, bottom - top, beside >= preferredHeight ? beside : bottom - top)}px`;
|
||||
menu.classList.toggle("is-above", openAbove);
|
||||
const x = align === "center" ? rect.left + (rect.width - menu.offsetWidth) / 2 : rect.right - menu.offsetWidth;
|
||||
menu.style.left = `${Math.max(left, Math.min(x, right - menu.offsetWidth))}px`;
|
||||
|
||||
@@ -80,7 +80,7 @@ export function parseMirrorReleaseMetadata(value: unknown, packageTarget?: strin
|
||||
if (release.prerelease !== false || typeof release.body !== "string") return null;
|
||||
const sources = [...release.body.matchAll(/^<!-- piik-source: ([0-9a-f]{40}) -->\r?$/gm)];
|
||||
if (sources.length !== 1) return null;
|
||||
// The mirror tag identifies its README commit, never the original Piik source.
|
||||
// The mirror publisher records original source identity in this marker.
|
||||
const normalized = parseReleaseMetadata({
|
||||
tag_name: release.tag_name, html_url: RELEASE_PAGE + String(release.tag_name),
|
||||
target_commitish: sources[0][1],
|
||||
|
||||
@@ -217,6 +217,8 @@ export const en: Record<CopyKey, string> = {
|
||||
"notice.dismiss": "Dismiss notice",
|
||||
"common.enable": "Enable {name}",
|
||||
"common.disable": "Disable {name}",
|
||||
"common.increase": "Increase {name}",
|
||||
"common.decrease": "Decrease {name}",
|
||||
"host.join.hide": "Hide room entry",
|
||||
"host.advanced.hide": "Hide sharing settings",
|
||||
"host.password.settingsHide": "Hide password settings",
|
||||
|
||||
@@ -217,6 +217,8 @@ export const zh = {
|
||||
"notice.dismiss": "关闭提示",
|
||||
"common.enable": "开启{name}",
|
||||
"common.disable": "关闭{name}",
|
||||
"common.increase": "增大{name}",
|
||||
"common.decrease": "减小{name}",
|
||||
"host.join.hide": "收起加入房间",
|
||||
"host.advanced.hide": "收起分享设置",
|
||||
"host.password.settingsHide": "收起密码设置",
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
/** Retire the caller immediately; a late permission grant still owns real tracks. */
|
||||
export async function acquireMediaStream(start: () => Promise<MediaStream>, signal?: AbortSignal): Promise<MediaStream> {
|
||||
signal?.throwIfAborted();
|
||||
const pending = start();
|
||||
return new Promise((resolve, reject) => {
|
||||
const abort = () => { signal?.removeEventListener("abort", abort); reject(signal!.reason); };
|
||||
signal?.addEventListener("abort", abort, { once: true });
|
||||
if (signal?.aborted) abort();
|
||||
pending.then(stream => {
|
||||
signal?.removeEventListener("abort", abort);
|
||||
if (signal?.aborted) stream.getTracks().forEach(track => track.stop());
|
||||
else resolve(stream);
|
||||
}, error => {
|
||||
signal?.removeEventListener("abort", abort);
|
||||
reject(error);
|
||||
});
|
||||
});
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
import type { BrowserCaptureSource } from "./quality";
|
||||
import { audioInputConstraints } from "./audio-capture";
|
||||
import { MicrophoneInput } from "./microphone-input";
|
||||
import { acquireMediaStream } from "./capture-stream";
|
||||
|
||||
export interface CommentaryInput { deviceId: string; volume: number; voiceProcessing: boolean }
|
||||
|
||||
@@ -14,7 +15,7 @@ export class HostAudio {
|
||||
private sourceNode: MediaStreamAudioSourceNode | null = null;
|
||||
private microphone: MicrophoneInput | null = null;
|
||||
private microphoneNode: MediaStreamAudioSourceNode | null = null;
|
||||
private microphoneRequest = 0;
|
||||
private microphoneRequest: AbortController | null = null;
|
||||
private closed = false;
|
||||
constructor(private source: MediaStream, private kind: BrowserCaptureSource = "browser",
|
||||
private availabilityChanged: (available: boolean) => void = () => {},
|
||||
@@ -63,21 +64,22 @@ export class HostAudio {
|
||||
}
|
||||
}
|
||||
async setMicrophone(enabled: boolean, settings: CommentaryInput): Promise<void> {
|
||||
const request = ++this.microphoneRequest;
|
||||
this.microphoneRequest?.abort();
|
||||
this.microphoneRequest = null;
|
||||
if (!enabled) { this.clearMicrophone(); return; }
|
||||
if (!this.context || !this.destination || this.closed) throw new Error("Shared audio is unavailable");
|
||||
const request = this.microphoneRequest = new AbortController();
|
||||
const context = new AudioContext();
|
||||
let stream: MediaStream | undefined, input: MicrophoneInput | undefined;
|
||||
try {
|
||||
const resumed = context.resume().then(() => true, () => false);
|
||||
await this.context.resume();
|
||||
stream = await navigator.mediaDevices.getUserMedia({ audio: { ...audioInputConstraints(settings.voiceProcessing),
|
||||
...(settings.deviceId ? { deviceId: { exact: settings.deviceId } } : {}) }, video: false });
|
||||
const resumed = Promise.all([context.resume(), this.context.resume()]).then(() => true, () => false);
|
||||
stream = await acquireMediaStream(() => navigator.mediaDevices.getUserMedia({ audio: { ...audioInputConstraints(settings.voiceProcessing),
|
||||
...(settings.deviceId ? { deviceId: { exact: settings.deviceId } } : {}) }, video: false }), request.signal);
|
||||
if (!await resumed) throw new Error("Microphone audio could not start");
|
||||
if (this.closed || request !== this.microphoneRequest) return;
|
||||
request.signal.throwIfAborted();
|
||||
if (!stream.getAudioTracks().some(track => track.readyState === "live")) throw new Error("No live microphone");
|
||||
input = new MicrophoneInput(stream, context, settings.volume, () => {
|
||||
if (this.microphone === input) { ++this.microphoneRequest; this.clearMicrophone(); }
|
||||
if (this.microphone === input) { this.microphoneRequest?.abort(); this.clearMicrophone(); }
|
||||
});
|
||||
const node = this.context.createMediaStreamSource(input.stream);
|
||||
node.connect(this.gain!);
|
||||
@@ -87,8 +89,10 @@ export class HostAudio {
|
||||
previousNode?.disconnect(); previousInput?.close();
|
||||
this.microphoneChanged(true); this.reportAvailability();
|
||||
} catch (error) {
|
||||
input?.close(); throw error;
|
||||
input?.close();
|
||||
if (!request.signal.aborted) throw error;
|
||||
} finally {
|
||||
if (this.microphoneRequest === request) this.microphoneRequest = null;
|
||||
if (!input) { stream?.getTracks().forEach(track => track.stop()); void context.close().catch(() => {}); }
|
||||
}
|
||||
}
|
||||
@@ -119,7 +123,7 @@ export class HostAudio {
|
||||
}
|
||||
dispose(): void {
|
||||
if (this.closed) return;
|
||||
this.closed = true; ++this.microphoneRequest;
|
||||
this.closed = true; this.microphoneRequest?.abort(); this.microphoneRequest = null;
|
||||
this.unwatchSource();
|
||||
this.clearMicrophone(); this.closeGraph();
|
||||
this.source.getAudioTracks().forEach(track => track.stop());
|
||||
|
||||
@@ -229,10 +229,13 @@ export function AppLauncherPage() {
|
||||
const finish = beginStateChange();
|
||||
setSiteBusy(true);
|
||||
setSiteError(undefined);
|
||||
const controller = new AbortController();
|
||||
const timer = setTimeout(() => controller.abort(), 8_000);
|
||||
async function save(setting: "site" | "startup-site"): Promise<boolean> {
|
||||
const response = await fetch(`/api/client-launcher/${setting}`, {
|
||||
method: "POST", headers: { "Content-Type": "application/json" },
|
||||
body: JSON.stringify({ site: nextSite, ...(setting === "site" ? { allowed } : {}) }),
|
||||
signal: controller.signal,
|
||||
});
|
||||
const result = launcherStateSchema.pick({ sites: true, startupSite: true }).safeParse(await response.json().catch(() => null));
|
||||
if (result.success) {
|
||||
@@ -251,7 +254,7 @@ export function AppLauncherPage() {
|
||||
} catch {
|
||||
setSiteError(t("client.connect.saveFailed"));
|
||||
return false;
|
||||
} finally { finish(); setSiteBusy(false); }
|
||||
} finally { clearTimeout(timer); finish(); setSiteBusy(false); }
|
||||
}
|
||||
|
||||
async function approveSite(site: string): Promise<void> {
|
||||
@@ -264,7 +267,7 @@ export function AppLauncherPage() {
|
||||
return (
|
||||
<div className="lr-app">
|
||||
<AppHeader homeHref="/client" diagnosticControl={appDebug === undefined ? null : (
|
||||
<Btn icon="cpu" title="client.launch.debugHint" size="compact"
|
||||
<Btn icon="cpu" title="client.launch.debugHint" cap="debug.start" size="compact" quiet
|
||||
pressed={debug} tone={debug ? "on" : undefined} hint="debug-start"
|
||||
disabled={appDebug || debugBusy || loading || starting || !!target || error?.kind === "load"}
|
||||
onClick={() => void enableDebug()} />
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
import { useLayoutEffect, useRef, useState } from "react";
|
||||
import type { VideoFit, VideoRotation } from "../media/video-geometry";
|
||||
import { BackButton, Btn, Chip, NameTag, Pill, SwitchItem } from "../components/living/primitives";
|
||||
import { RoomChip, RoomCodePlaceholder, RoomAdmissionBadge } from "../components/living/RoomChip";
|
||||
import { BackButton, Btn, Chip, FieldCap, NameTag, Pill, SwitchItem } from "../components/living/primitives";
|
||||
import { Lcd, RoomChip, RoomCodePlaceholder, RoomAdmissionBadge } from "../components/living/RoomChip";
|
||||
import { CaptureSourcePicker, type NativeSourceList } from "../components/living/CaptureSourcePicker";
|
||||
import { LedStrip } from "../components/living/Header";
|
||||
import { StageOverlay, StageTv } from "../components/living/Stage";
|
||||
@@ -90,6 +90,7 @@ export function ControlsPreview() {
|
||||
const [paused, setPaused] = useState(false);
|
||||
const [passwordVisible, setPasswordVisible] = useState(false);
|
||||
const [name, setName] = useState("Piik friend");
|
||||
const [editingName, setEditingName] = useState(false);
|
||||
const [invalid, setInvalid] = useState(false);
|
||||
const [sourceOpen, setSourceOpen] = useState(displayPreview);
|
||||
const [sourceRevision, setSourceRevision] = useState(0);
|
||||
@@ -269,6 +270,25 @@ export function ControlsPreview() {
|
||||
<label className="lr-input"><Glyph name="pencil" size={17} /><input value={name} aria-label={t("host.name")}
|
||||
autoComplete="off" onChange={event => setName(event.target.value)} /></label>
|
||||
</div>
|
||||
{(["host", "viewer"] as const).map(role => <div key={role} className={`lr-row lr-${role}-summary-row`}>
|
||||
<div className={`lr-row-group lr-${role}-room-slot`}><FieldCap k="common.roomCode" />
|
||||
{role === "host" ? <RoomChip roomId="9527" onReplace={notify} /> : <Lcd code="9527" />}</div>
|
||||
{role === "viewer" && <div className="lr-row-group lr-viewer-host-slot"><Glyph name="tv" size={17} />
|
||||
<Tooltip overflow={{ text: name || "Piik friend", selector: "b" }} className="lr-name-hint"><b>{name || "Piik friend"}</b></Tooltip></div>}
|
||||
<div className={`lr-row-group lr-group-name lr-${role === "host" ? "host-identity" : "viewer-self"}-slot`}>
|
||||
{editingName ? <>
|
||||
<span className="lr-input lr-name-editor"><input value={name} aria-label={t("host.name")}
|
||||
onChange={event => setName(event.target.value)} /></span>
|
||||
<Btn icon="check" title="host.nameSave" onClick={() => setEditingName(false)} />
|
||||
<Btn icon="x" title="host.nameCancel" onClick={() => setEditingName(false)} />
|
||||
</> : <><NameTag name={name || "Piik friend"} identity={`preview-${role}-name`} />
|
||||
<Btn icon="pencil" cap="common.edit" collapsibleCaption title="host.nameEdit" hint="hint-rename" onClick={() => setEditingName(true)} /></>}
|
||||
</div>
|
||||
<div className={`lr-row-group lr-group-actions lr-${role === "host" ? "host-diagnostics" : "viewer-actions"}-slot`}>
|
||||
<Btn icon="gauge" cap="host.details" title="host.details" onClick={notify} />
|
||||
<Btn icon="network" cap="host.topology" title="host.topology.show" onClick={notify} />
|
||||
</div>
|
||||
</div>)}
|
||||
<div className="cp-tools">
|
||||
<label className="lr-input is-password"><Glyph name="key" size={17} /><input type={passwordVisible ? "text" : "password"}
|
||||
placeholder={t("join.password")} aria-label={t("join.password")} aria-invalid={invalid} aria-describedby={invalid ? "preview-input-error" : undefined} autoComplete="off" />
|
||||
|
||||
@@ -4462,6 +4462,7 @@ export function HostPage({
|
||||
<Btn
|
||||
icon="pencil"
|
||||
cap="common.edit"
|
||||
collapsibleCaption
|
||||
title="host.nameEdit"
|
||||
hint="hint-rename"
|
||||
onClick={() => {
|
||||
|
||||
@@ -2517,6 +2517,7 @@ export function ViewerPage({
|
||||
key="edit-name"
|
||||
icon="pencil"
|
||||
cap="common.edit"
|
||||
collapsibleCaption
|
||||
title="host.nameEdit"
|
||||
hint="hint-rename"
|
||||
onClick={() => {
|
||||
|
||||
@@ -783,6 +783,7 @@ body.lr-theater-open .lr-top { visibility: hidden; }
|
||||
.lr-row.is-sub { background: var(--wall-2); border-color: transparent; }
|
||||
.lr-row-group { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; min-width: 0; }
|
||||
.lr-group-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; min-width: 0; }
|
||||
:is(.lr-host-summary-row, .lr-viewer-summary-row) { container: value-actions / inline-size; }
|
||||
.lr-host-summary-row { justify-content: flex-end; column-gap: 8px; }
|
||||
.lr-host-room-slot { margin-inline-end: auto; }
|
||||
.lr-host-personal-controls,
|
||||
@@ -1076,7 +1077,9 @@ body.lr-theater-open .lr-top { visibility: hidden; }
|
||||
.lr-input:is(.lr-quality-number, .lr-video-size):has(:disabled) { opacity: .55; }
|
||||
.lr-input:is(.lr-quality-number, .lr-video-size):has([aria-invalid="true"]) { border-color: var(--danger); }
|
||||
.lr-quality-validation { color: color-mix(in srgb, var(--danger) 70%, var(--ink)); font-size: 12px; line-height: 1.5; }
|
||||
.lr-input.lr-quality-number { width: 110px; gap: 6px; }
|
||||
.lr-input.lr-quality-number { width: 144px; height: 52px; padding: 1px 3px 1px 10px; gap: 6px; }
|
||||
.lr-number-steppers { display: flex; flex: none; flex-direction: column; }
|
||||
.lr-number-steppers .lr-btn { --button-size: 24px; --button-padding: 0; --button-icon-size: 14px; --control-hover-transform: none; border-radius: 7px; }
|
||||
.lr-quality-number input, .lr-video-size input { font-size: 13px; font-weight: 650; appearance: textfield; }
|
||||
.lr-quality-number input { text-align: right; }
|
||||
.lr-quality-number span, .lr-video-size span { color: var(--muted); font-size: 11px; }
|
||||
@@ -1122,15 +1125,15 @@ body.lr-theater-open .lr-top { visibility: hidden; }
|
||||
.lr-welcome-catalog li > span:first-child { display: block; }
|
||||
.lr-welcome-catalog .lr-welcome-cipher { margin-top: 6px; }
|
||||
.lr-input.lr-name-editor {
|
||||
flex: 1;
|
||||
min-width: 0;
|
||||
width: 0;
|
||||
flex: 1 1 224px;
|
||||
min-width: min(160px, 100%);
|
||||
width: 224px;
|
||||
height: 40px;
|
||||
border-radius: 999px;
|
||||
}
|
||||
.lr-group-name { width: 224px; max-width: 100%; }
|
||||
.lr-group-name { width: max-content; max-width: 100%; }
|
||||
.lr-group-name > [role="alert"] { flex-basis: 100%; }
|
||||
.lr-group-name > .lr-name-hint { flex: 1; width: 0; }
|
||||
.lr-group-name > .lr-name-hint { flex: 1 0 max-content; }
|
||||
.lr-group-name .lr-name-tag { width: 100%; }
|
||||
|
||||
.lr-name-tag {
|
||||
|
||||
@@ -0,0 +1,74 @@
|
||||
import { afterEach, describe, expect, it, vi } from "vitest";
|
||||
import { useAnchoredPopover } from "../src/client/components/living/use-anchored-popover";
|
||||
|
||||
const hooks = vi.hoisted(() => ({ effects: [] as (() => void)[] }));
|
||||
vi.mock("react", async importOriginal => ({
|
||||
...await importOriginal<typeof import("react")>(),
|
||||
useRef: (current: unknown) => ({ current }),
|
||||
useLayoutEffect: (effect: () => (() => void) | undefined) => {
|
||||
const cleanup = effect();
|
||||
if (cleanup) hooks.effects.push(cleanup);
|
||||
},
|
||||
}));
|
||||
vi.mock("../src/client/ui/panel-window", () => ({ useSurfaceDocument: () => undefined }));
|
||||
|
||||
afterEach(() => {
|
||||
for (const cleanup of hooks.effects.splice(0).reverse()) cleanup();
|
||||
vi.unstubAllGlobals();
|
||||
});
|
||||
|
||||
function surface() {
|
||||
const frame = new Map<number, FrameRequestCallback>();
|
||||
let sequence = 0, visible = true, open = true;
|
||||
const field = {};
|
||||
const viewport = Object.assign(new EventTarget(), { width: 390, height: 844, offsetLeft: 0, offsetTop: 0 });
|
||||
const view = Object.assign(new EventTarget(), {
|
||||
visualViewport: viewport, innerWidth: 390, innerHeight: 844,
|
||||
requestAnimationFrame: (callback: FrameRequestCallback) => { frame.set(++sequence, callback); return sequence; },
|
||||
cancelAnimationFrame: (id: number) => { frame.delete(id); },
|
||||
});
|
||||
const owner = { defaultView: view, activeElement: null as unknown };
|
||||
const anchor = {
|
||||
getBoundingClientRect: () => ({ left: 40, right: 350, top: 600, bottom: 650, width: 310, height: 50 }),
|
||||
getClientRects: () => visible ? [{}] : [],
|
||||
closest: () => null,
|
||||
};
|
||||
const style: Record<string, string> = {};
|
||||
const hidePopover = vi.fn(() => { open = false; });
|
||||
const menu = Object.assign(new EventTarget(), {
|
||||
ownerDocument: owner, style, classList: { toggle: vi.fn() }, scrollHeight: 700, offsetWidth: 300,
|
||||
contains: (element: unknown) => element === field,
|
||||
matches: () => open, hidePopover,
|
||||
});
|
||||
Object.defineProperty(menu, "offsetHeight", { get: () => Math.min(700, parseFloat(style.maxHeight) || 700) });
|
||||
vi.stubGlobal("ResizeObserver", class { observe() {} disconnect() {} });
|
||||
useAnchoredPopover({ current: anchor as unknown as HTMLElement }, { current: menu as unknown as HTMLElement });
|
||||
const resize = (height: number) => {
|
||||
viewport.height = height;
|
||||
viewport.dispatchEvent(new Event("resize"));
|
||||
for (const [id, callback] of [...frame]) { frame.delete(id); callback(0); }
|
||||
};
|
||||
return { owner, field, menu, style, hidePopover, resize, removeAnchor: () => { visible = false; } };
|
||||
}
|
||||
|
||||
describe("Anchored popover input ownership", () => {
|
||||
it("keeps an active editor open and inside the keyboard viewport", () => {
|
||||
const current = surface();
|
||||
current.owner.activeElement = current.field;
|
||||
current.resize(320);
|
||||
expect(current.hidePopover).not.toHaveBeenCalled();
|
||||
expect(current.owner.activeElement).toBe(current.field);
|
||||
expect(parseFloat(current.style.top!)).toBeGreaterThanOrEqual(8);
|
||||
expect(parseFloat(current.style.top!) + parseFloat(current.style.maxHeight!)).toBeLessThanOrEqual(312);
|
||||
|
||||
current.removeAnchor();
|
||||
current.resize(320);
|
||||
expect(current.hidePopover).toHaveBeenCalledOnce();
|
||||
});
|
||||
|
||||
it("still dismisses an inactive menu whose anchor leaves view", () => {
|
||||
const current = surface();
|
||||
current.resize(320);
|
||||
expect(current.hidePopover).toHaveBeenCalledOnce();
|
||||
});
|
||||
});
|
||||
@@ -51,7 +51,7 @@ function mount(fetch: ReturnType<typeof vi.fn>, manualSite = false) {
|
||||
state[name] = typeof value === "function" ? value(state[name]) : value;
|
||||
})]));
|
||||
const window = Object.assign(new EventTarget(), { location: { replace: vi.fn() } });
|
||||
const timers = new Map<number, () => void>();
|
||||
const timers = new Map<number, { callback: () => void; delay: number }>();
|
||||
let nextTimer = 0;
|
||||
const actions = runInNewContext(executable, {
|
||||
...setters, z, fetch, window,
|
||||
@@ -59,17 +59,26 @@ function mount(fetch: ReturnType<typeof vi.fn>, manualSite = false) {
|
||||
siteBusy: false, debugBusy: false, starting: false, sites: saved.sites, manualSite, openOnApproval: false,
|
||||
mode: "link", lang: "en", vis: false, debug: false, appDebug: false, localAccessPassword: "",
|
||||
consoleLanguage: () => "en", launchURL: (target: string) => target, t: (key: string) => key,
|
||||
AbortController,
|
||||
setTimeout: (callback: () => void, delay: number) => {
|
||||
expect(delay).toBe(750);
|
||||
timers.set(++nextTimer, callback);
|
||||
return nextTimer;
|
||||
const id = ++nextTimer;
|
||||
timers.set(id, { callback, delay });
|
||||
return id;
|
||||
},
|
||||
clearTimeout: (id: number) => timers.delete(id),
|
||||
}) as { cleanup(): void; changeSite(site: string, setting?: "site" | "startup-site", starAfterApproval?: boolean, allowed?: boolean): Promise<boolean>; approveSite(site: string): Promise<void>; enableDebug(): Promise<void>; launch(event: { preventDefault(): void }): Promise<void> };
|
||||
return { state, setters, ...actions, navigate: window.location.replace, focus: () => window.dispatchEvent(new Event("focus")),
|
||||
retry: () => {
|
||||
expect(timers.size).toBe(1);
|
||||
const [id, callback] = [...timers][0]!;
|
||||
const entry = [...timers].find(([, timer]) => timer.delay === 750);
|
||||
expect(entry).toBeDefined();
|
||||
const [id, { callback }] = entry!;
|
||||
timers.delete(id);
|
||||
callback();
|
||||
},
|
||||
expireRequest: () => {
|
||||
const entry = [...timers].find(([, timer]) => timer.delay > 750);
|
||||
expect(entry).toBeDefined();
|
||||
const [id, { callback }] = entry!;
|
||||
timers.delete(id);
|
||||
callback();
|
||||
},
|
||||
@@ -212,6 +221,49 @@ describe("App launcher state recovery", () => {
|
||||
page.cleanup();
|
||||
});
|
||||
|
||||
it("releases the approval page when saving a site never responds", async () => {
|
||||
const fetch = vi.fn(async (_url: string, options?: { method?: string; signal?: AbortSignal }) => {
|
||||
if (options?.method === "POST") return await new Promise<never>((_, reject) => {
|
||||
options.signal?.addEventListener("abort", () => reject(new Error("request aborted")), { once: true });
|
||||
});
|
||||
return response();
|
||||
});
|
||||
const page = mount(fetch, true);
|
||||
await settle();
|
||||
const approval = page.approveSite("https://next.example");
|
||||
await settle();
|
||||
expect(page.state.SiteBusy).toBe(true);
|
||||
page.expireRequest();
|
||||
await approval;
|
||||
expect(page.state).toMatchObject({ SiteBusy: false, SiteError: "client.connect.saveFailed" });
|
||||
expect(page.navigate).not.toHaveBeenCalled();
|
||||
fetch.mockResolvedValueOnce(response({ ...saved, sites: [...saved.sites, "https://next.example"] }));
|
||||
await page.approveSite("https://next.example");
|
||||
expect(page.navigate).toHaveBeenCalledWith("https://next.example/#piik-client=1");
|
||||
expect(page.state.SiteBusy).toBe(false);
|
||||
page.cleanup();
|
||||
});
|
||||
|
||||
it("keeps committed approval when the startup preference body stalls", async () => {
|
||||
const nextSite = "https://next.example";
|
||||
const approved = { ...saved, sites: [...saved.sites, nextSite] };
|
||||
const fetch = vi.fn(async (url: string, options?: { method?: string; signal?: AbortSignal }) => {
|
||||
if (url.endsWith("/startup-site")) return { ...response(), json: () => new Promise<never>((_, reject) => {
|
||||
options?.signal?.addEventListener("abort", () => reject(new Error("body aborted")), { once: true });
|
||||
}) };
|
||||
return response(options?.method === "POST" ? approved : saved);
|
||||
});
|
||||
const page = mount(fetch, true);
|
||||
await settle();
|
||||
const approval = page.changeSite(nextSite, "site", true);
|
||||
await settle();
|
||||
expect(page.state).toMatchObject({ Sites: approved.sites, StartupSite: "", SiteBusy: true });
|
||||
page.expireRequest();
|
||||
await expect(approval).resolves.toBe(false);
|
||||
expect(page.state).toMatchObject({ Sites: approved.sites, StartupSite: "", SiteBusy: false, SiteError: "client.connect.saveFailed" });
|
||||
page.cleanup();
|
||||
});
|
||||
|
||||
it("restores saved choices after a failed first read, then preserves unsaved edits on focus", async () => {
|
||||
const fetch = vi.fn(async () => response()).mockRejectedValueOnce(new Error("unavailable"));
|
||||
const page = mount(fetch);
|
||||
|
||||
@@ -119,8 +119,12 @@ test("ending a share retires microphone permission completed after disposal", as
|
||||
const audio = new HostAudio(media(new Track("video")), "browser", () => {}, enabled);
|
||||
await audio.start();
|
||||
const pending = audio.setMicrophone(true, { deviceId: "", volume: 1, voiceProcessing: true });
|
||||
expect(getUserMedia).toHaveBeenCalledOnce();
|
||||
audio.dispose();
|
||||
await pending;
|
||||
expect(contexts.every(context => context.state === "closed")).toBe(true);
|
||||
complete(media(microphone));
|
||||
await Promise.resolve();
|
||||
audio.dispose(); complete(media(microphone)); await pending;
|
||||
expect(microphone.stop).toHaveBeenCalledOnce();
|
||||
expect(enabled).not.toHaveBeenCalledWith(true);
|
||||
expect(contexts.every(context => context.state === "closed")).toBe(true);
|
||||
|
||||
@@ -32,7 +32,7 @@ const source = ts.createSourceFile("HostPage.tsx", readFileSync(
|
||||
new URL("../src/client/pages/HostPage.tsx", import.meta.url), "utf8",
|
||||
), ts.ScriptTarget.Latest, true, ts.ScriptKind.TSX);
|
||||
const owners = new Set(["changeQuality", "commitQuality", "rememberQuality", "loadAppQualityPreference", "handleSignalMessage",
|
||||
"switchSource", "watchCaptureEnd", "switchNativeSource", "switchToNativeSource", "createBrowserAudio", "retireNativeSenderPeers", "finishSourceSwitch", "replaceBrowserStream", "recoverBrowserFanout", "disposeNativeShare",
|
||||
"switchSource", "watchCaptureEnd", "switchNativeSource", "switchToNativeSource", "createBrowserAudio", "changeCommentary", "retireNativeSenderPeers", "finishSourceSwitch", "replaceBrowserStream", "recoverBrowserFanout", "disposeNativeShare",
|
||||
"acquireNativeClient", "requestSharing", "nativeCaptureCodec", "startNativeShare", "startBrowserNativeIngress",
|
||||
"createNativePreview", "failNativePreview", "reconnectNativePreview", "reportHostChildFailure", "hostChildIsAssigned", "prepareHostChild",
|
||||
"connectNativeClient", "handleNativeClientClosed", "releaseUnusedNativeClient", "closeCaptureSourcePicker",
|
||||
@@ -338,6 +338,66 @@ describe("Camera replacement ownership", () => {
|
||||
return { ...current, nativeControl, remoteSnapshot, picture, previous, camera, nativeStream, oldBridge, peer, nativePeer, startedPeerStreams, replacePublication };
|
||||
}
|
||||
|
||||
it("releases pending Browser commentary when Native handoff retires its audio owner", async () => {
|
||||
const current = sourceFixture(false);
|
||||
const permission = deferred<MediaStream>();
|
||||
const getUserMedia = vi.fn(() => permission.promise), contexts: { close: ReturnType<typeof vi.fn> }[] = [];
|
||||
const outputAudio = { readyState: "live", stop: vi.fn() };
|
||||
vi.stubGlobal("AudioContext", class {
|
||||
close = vi.fn(async () => {});
|
||||
resume = vi.fn(async () => {});
|
||||
constructor() { contexts.push(this); }
|
||||
createMediaStreamDestination() { return { stream: { getAudioTracks: () => [outputAudio], getTracks: () => [outputAudio] } }; }
|
||||
createGain() { return { gain: { value: 1 }, connect() {}, disconnect() {} }; }
|
||||
});
|
||||
vi.stubGlobal("MediaStream", class {
|
||||
constructor(private tracks: unknown[]) {}
|
||||
getTracks() { return this.tracks; }
|
||||
getVideoTracks() { return this.tracks.filter(track => track === current.previous.video); }
|
||||
getAudioTracks() { return this.tracks.filter(track => track === outputAudio); }
|
||||
});
|
||||
vi.stubGlobal("navigator", { mediaDevices: { getUserMedia } });
|
||||
let busy = false;
|
||||
const setCommentaryBusy = vi.fn((value: boolean) => { busy = value; });
|
||||
const setMicrophone = vi.fn(async () => {});
|
||||
Object.assign(current.client, { setMicrophone });
|
||||
Object.assign(current.context, {
|
||||
commentaryOperationRef: ref(null), setCommentaryBusy, setCommentaryInput: vi.fn(),
|
||||
commentaryInput: { deviceId: "", volume: 1, voiceProcessing: true },
|
||||
startPeer: current.startChild,
|
||||
});
|
||||
const audio = current.context.hostAudioRef.current as HostAudio;
|
||||
const disposed = vi.spyOn(audio, "dispose");
|
||||
const lateTrack = { stop: vi.fn() };
|
||||
try {
|
||||
await audio.start();
|
||||
const commentary = current.context.changeCommentary(true) as Promise<void>;
|
||||
await vi.waitFor(() => expect(getUserMedia).toHaveBeenCalledOnce());
|
||||
expect(busy).toBe(true);
|
||||
// The normal source action is available while microphone permission waits.
|
||||
await current.context.switchToNativeSource({ kind: "native", client: current.client,
|
||||
target: { kind: "display", sourceId: "1", title: "Display" }, audio: false, path: {} });
|
||||
expect(current.nativeModeRef.current).toBe(true);
|
||||
expect(current.context.streamRef.current).toBe(current.nativeStream);
|
||||
expect(disposed).toHaveBeenCalledOnce();
|
||||
await vi.waitFor(() => expect(busy).toBe(false));
|
||||
await commentary;
|
||||
expect(contexts.every(context => context.close.mock.calls.length === 1)).toBe(true);
|
||||
await current.context.changeCommentary(true);
|
||||
expect(setMicrophone).toHaveBeenCalledExactlyOnceWith("native-source-2", true, 1, "");
|
||||
permission.resolve({ getTracks: () => [lateTrack] } as unknown as MediaStream);
|
||||
await Promise.resolve();
|
||||
expect(lateTrack.stop).toHaveBeenCalledOnce();
|
||||
expect(current.context.streamRef.current).toBe(current.nativeStream);
|
||||
expect(current.context.endSharing).not.toHaveBeenCalled();
|
||||
expect(current.createRoom).not.toHaveBeenCalled();
|
||||
} finally {
|
||||
permission.resolve({ getTracks: () => [lateTrack] } as unknown as MediaStream);
|
||||
audio.dispose();
|
||||
vi.unstubAllGlobals();
|
||||
}
|
||||
});
|
||||
|
||||
it.each(["initial", "replacement"])("rejects Browser capture that ends during %s audio preparation", async entry => {
|
||||
const current = sourceFixture(entry === "replacement");
|
||||
const pending = deferred<void>();
|
||||
|
||||
@@ -16,7 +16,7 @@ const servers = [...linuxServers, {
|
||||
}];
|
||||
type Scenario = { existing?: boolean; draft?: boolean; badArchive?: boolean;
|
||||
wrongSource?: boolean; wrongImage?: boolean; remoteMismatch?: boolean;
|
||||
registryError?: boolean; newerRelease?: boolean; largeCommit?: boolean;
|
||||
registryError?: string; newerRelease?: boolean; largeCommit?: boolean;
|
||||
partial?: boolean; wrongPlatform?: boolean; attestation?: boolean; unknownPlatform?: boolean };
|
||||
|
||||
async function publish(options: Scenario = {}) {
|
||||
@@ -64,17 +64,24 @@ async function publish(options: Scenario = {}) {
|
||||
} } }]);
|
||||
}
|
||||
if (args[0] === "manifest") {
|
||||
if (options.registryError || !manifests.has(args[2])) {
|
||||
// Docker CLI rebuilds a manifest list without its OCI annotations.
|
||||
const original = manifests.get(args[2]) as { manifests?: object[] } | undefined;
|
||||
return JSON.stringify({ ...original, manifests: original?.manifests?.map(entry => ({ ...entry, annotations: undefined })) });
|
||||
}
|
||||
if (args[0] === "buildx" && args[2] === "inspect") {
|
||||
expect(args.slice(0, 4)).toEqual(["buildx", "imagetools", "inspect", "--raw"]);
|
||||
const reference = args[4];
|
||||
if (options.registryError || !manifests.has(reference)) {
|
||||
throw Object.assign(new Error("Registry failure"), {
|
||||
stderr: options.registryError ? "unauthorized: authentication required" : "manifest unknown",
|
||||
stderr: options.registryError ?? `ERROR: ${reference}: not found`,
|
||||
});
|
||||
}
|
||||
return JSON.stringify(manifests.get(args[2]));
|
||||
return JSON.stringify(manifests.get(reference));
|
||||
}
|
||||
if (args[0] === "pull") images.set(args[3], args[2].slice("linux/".length));
|
||||
if (args[0] === "tag") images.set(args[2], images.get(args[1])!);
|
||||
if (args[0] === "push") manifests.set(args[1], {});
|
||||
if (args[0] === "buildx") manifests.set(args[4], index);
|
||||
if (args[0] === "buildx" && args[2] === "create") manifests.set(args[4], index);
|
||||
return "{}";
|
||||
});
|
||||
const argv = process.argv;
|
||||
@@ -85,7 +92,7 @@ async function publish(options: Scenario = {}) {
|
||||
}
|
||||
const pushes = () => command.mock.calls.filter(([program, args]) => program === "docker" && args[0] === "push")
|
||||
.map(([, args]) => args[1]);
|
||||
const indexes = () => command.mock.calls.filter(([program, args]) => program === "docker" && args[0] === "buildx")
|
||||
const indexes = () => command.mock.calls.filter(([program, args]) => program === "docker" && args[0] === "buildx" && args[2] === "create")
|
||||
.map(([, args]) => args.slice(4));
|
||||
|
||||
describe("container publication", () => {
|
||||
@@ -107,7 +114,10 @@ describe("container publication", () => {
|
||||
});
|
||||
it.each([
|
||||
{ draft: true }, { badArchive: true }, { wrongSource: true }, { wrongImage: true },
|
||||
{ registryError: true }, { existing: true, remoteMismatch: true },
|
||||
{ registryError: "unauthorized: authentication required" },
|
||||
{ registryError: "ERROR: failed to fetch manifest sha256:missing: not found" },
|
||||
{ registryError: "ERROR: lookup ghcr.io: i/o timeout" },
|
||||
{ existing: true, remoteMismatch: true },
|
||||
{ partial: true, remoteMismatch: true }, { wrongPlatform: true },
|
||||
])("blocks invalid publication before pushing (%j)", async (options) => {
|
||||
await expect(publish(options)).rejects.toThrow();
|
||||
|
||||
@@ -29,7 +29,7 @@ function editor() {
|
||||
const setInvalid = vi.fn();
|
||||
const render = runInNewContext(executable, {
|
||||
exports: {}, require: () => jsxRuntime, useRef: () => ({ current: input }), Number,
|
||||
useState: () => [false, setInvalid], useId: () => "validation", useCopy: () => ({ t: vi.fn() }),
|
||||
useState: () => [false, setInvalid], useId: () => "validation", useCopy: () => ({ t: vi.fn() }), Glyph: () => null,
|
||||
useEffect: (effect: () => void) => effect(),
|
||||
});
|
||||
let choose!: (next: number) => void;
|
||||
@@ -95,7 +95,7 @@ describe("Numeric quality editing group", () => {
|
||||
expect(fields[index]).toContain(`value="${value}"`);
|
||||
expect(fields[index]).not.toContain('type="range"');
|
||||
expect(fields[index]).toContain('class="lr-quality-custom"');
|
||||
if (nearest === null) expect(fields[index]).not.toContain('<button');
|
||||
if (nearest === null) expect(fields[index]).not.toContain('class="lr-btn is-dense"');
|
||||
else expect(fields[index]).toMatch(new RegExp(`<button[^>]*aria-label="[^"]*${nearest} ${unit}`));
|
||||
}
|
||||
expect(onChange).not.toHaveBeenCalled();
|
||||
|
||||
@@ -31,7 +31,7 @@ describe("mirror source authority", () => {
|
||||
expect(resolveMirrorSource("12345")).toEqual(expected);
|
||||
api({ ...run, conclusion: "failure" });
|
||||
expect(resolveMirrorSource("12345")).toEqual(expected);
|
||||
expect(() => resolveMirrorSource("12345", true)).toThrow(/completed main push/);
|
||||
expect(resolveMirrorSource("12345", true)).toEqual(expected);
|
||||
});
|
||||
|
||||
it.each(["", "012345", "1e3", "-1", "12345\nmirror=true", "9007199254740992", undefined])
|
||||
@@ -52,9 +52,11 @@ describe("mirror source authority", () => {
|
||||
});
|
||||
|
||||
it("skips automatic runs without a current release and refuses an explicit stale retry", () => {
|
||||
api(run, { ...release, target_commitish: "b".repeat(40) });
|
||||
expect(resolveMirrorSource("12345", true)).toBeNull();
|
||||
expect(() => resolveMirrorSource("12345")).toThrow(/does not match the latest/);
|
||||
for (const conclusion of ["success", "failure", "cancelled"]) {
|
||||
api({ ...run, conclusion }, { ...release, target_commitish: "b".repeat(40) });
|
||||
expect(resolveMirrorSource("12345", true)).toBeNull();
|
||||
expect(() => resolveMirrorSource("12345")).toThrow(/does not match the latest/);
|
||||
}
|
||||
});
|
||||
|
||||
it.each([{ draft: true }, { prerelease: true }, { tag_name: "preview" }, { target_commitish: "main" }])
|
||||
|
||||
Reference in new issue
Block a user