Files
piik/scripts/release-notes.mjs
T
AAA 4bc0fd1e41 fix(app): stabilize sharing startup and align shared controls
## Problem and outcome / 问题与结果

Windows Auto selection could spend its remaining startup budget on a probe that could not finish, recreate hardware after a successful probe, and discard the prepared codec on first relay activation. Preserve the proven encoder through the existing capture owner and keep VP8 fallback unchanged. Correct custom-port STUN survey membership without changing the published Hosted base preference or introducing a second route/retry owner.

Reject queued minimize/resize frames that no longer match the current WGC target, replacing the one-shot restoration flag that could end an active H.264 share. Align shared controls, help and appearance across the product and website. macOS audio readiness follows successful platform startup rather than the arrival of non-silent samples. The optional editorial headline is shared with the website, with English-first bilingual release copy. Room voice and multiplayer input implementations remain outside this candidate.

Related reports: #437 and #486. Their affected devices still need retesting; this does not establish that all reported driver or macOS failures have been resolved.

## Release notes

**Play together. Your turn!**

**远程同乐,轮到你啦!**

### English

This maintenance update improves sharing startup and brings common controls and guidance into line. Existing 2.x App and Site compatibility is preserved.

- Windows Auto reuses the H.264 encoder that passed its frame-rate probe, preserves it on first relay activation, and skips probes that cannot fit the remaining startup budget. Discard stale minimize/resize frames before they can end an active share.
- Fix optional NAT survey selection with custom STUN ports while preserving existing Hosted selection. Include the upstream ICE candidate-priority correction.
- Make macOS audio readiness follow successful capture startup, so a silent source does not have to produce samples before becoming ready.
- Align shared buttons, selectors, keyboard labels and status colours, and refresh the README previews. Preserve explicit theme choices between the website and documentation.
- Find the Web version, troubleshooting and browser diagnostics in Help; closing a nested hint keeps the menu actions available.
- Put English first in update notes and simplify the website's release section around the same opening headline.

### 中文

这是一次分享启动与界面一致性的维护更新,保留现有 2.x App 和站点的兼容性。

- Windows 自动编码复用通过帧率探测的 H.264 编码器,在首次转发启用时保留该实例,并跳过剩余启动时间不足以完成的探测;丢弃最小化、恢复或缩放窗口时残留的旧尺寸帧,避免它们导致分享结束。
- 修复自定义 STUN 端口下的辅助打洞采样选择,保留已有自部署站点的选择行为,并同步上游 ICE 候选优先级修正。
- macOS 音频在平台确认启动成功后就绪,静默音源无需等待产生音频采样。
- 对齐共享按钮、选择控件、键盘说明与状态颜色,更新 README 界面预览;官网和文档中心之间保留用户明确选择的主题。
- 网页版本、问题排查和浏览器诊断统一收进「帮助」;内部提示关闭后,菜单操作仍然保留。
- 更新说明改为英文在前、中文在后;官网更新区以同一份开篇主题收敛呈现。

## Verification / 验证

- Local Web type-check, unit tests and production build: passed.
- Local Go tests, vet, Windows/Linux builds and Windows native compile/probe: passed.
- Website/documentation build, repository hygiene and diff checks: passed.
- Seven media-lifecycle cases passed: all Browser/App pairings, SFU-only, and Browser/Native fallback followed by direct recovery; restart, replacement and stale-signal retirement were included.
- The first candidate CI exposed an asynchronous allocation-test wait gap. Its correction waits for the committed deficit, retaining the capacity assertion; focused repetition passed locally.
- The native Host gate and benchmark now follow the current picture settings and stable codec name/value instead of removed UI structure or localized captions.
- Non-publishing CI passed on dd208e83, including Windows, both macOS architectures, both Linux architectures and Server packages. The later Windows frame-admission correction passed the focused native suite, physical Auto/H.264 and manual VP8 window gates, and the H.264 display gate. The window checks include minimized/resize/fullscreen recovery; the display check preserves the same media through profile and source changes.
- Final UI review covered narrow/desktop layouts, both themes, header/help, sharing controls, keyboard and interaction panels, packaged Local entry and website/docs preference handoff. The compact release entry passed 320/1280 px checks in both languages and themes, including metadata-request failure.
- Final candidate e88cb236: [all-platform packages and the full paired NAT/weak-network comparison](https://github.com/TNTcraftHIM/Piik/actions/runs/39284032227).

## Impact / 影响

No signaling, native-control, capture-envelope or storage version changes. Route authority, consent, capacity and retry lifetimes remain with their existing owners. The CI allocation correction changes the test only, not production media policy.

Physical macOS capture/permissions, the affected reporter GPUs and difficult external networks remain evidence limits. The owner authorized v2.2.2 after final acceptance; the non-publishing candidate checks must pass before the publishing squash merge. Room voice remains in its isolated experiment and is not a feature claim for this release.
2026-10-20 01:15:17 +08:00

80 lines
3.9 KiB
JavaScript

import { appendFileSync, readFileSync } from "node:fs";
import { pathToFileURL } from "node:url";
import semver from "semver";
import { hasProductChanges, isReleaseVersion, releaseCommits, stableTags } from "./release-version.mjs";
import { splitReleaseHeadline } from "./release-headline.mjs";
export function releaseNotesSection(message, source) {
const sections = message.replace(/\r\n/g, "\n").split(/^## /m).slice(1)
.filter((section) => section.split("\n", 1)[0].trim() === "Release notes");
const body = sections.length === 1
? sections[0].split("\n").slice(1).join("\n").replace(/<!--[\s\S]*?-->/g, "").trim()
: "";
const { notes } = splitReleaseHeadline(body);
if (!notes || !notes.split("\n").some((line) => line.trim() && !/^#{1,6}(\s|$)/.test(line))) {
throw new Error(`${source} needs one nonempty ## Release notes section`);
}
if (/\uFFFD|\?{3,}/u.test(body)) {
throw new Error(`${source} has damaged Release notes text; restore the UTF-8 source`);
}
return body;
}
export function pullRequestNotes(root, event) {
const pr = event.pull_request;
if (!pr) throw new Error("A pull_request event is required");
return hasProductChanges(root, pr.base.sha, pr.head.sha)
? releaseNotesSection(pr.body ?? "", `PR #${pr.number}`) : "";
}
// The reviewed PR body survives the squash commit. Only its public section is
// release copy; implementation details and verification logs stay in the PR.
export function releaseNotes(root, version, revision, repository, { allowEmpty = false } = {}) {
if (!isReleaseVersion(version) || !/^[a-f0-9]{40}$/.test(revision) ||
!/^[A-Za-z0-9_.-]+\/[A-Za-z0-9_.-]+$/.test(repository)) {
throw new Error("Release notes require a stable version, full SHA and owner/repository");
}
// Exclude this release's tag so retrying after publication keeps the same range.
const previous = stableTags(root, "--merged", revision).find((tag) => semver.lt(tag, version));
const bodies = [];
let headline = null;
for (const commit of releaseCommits(root, revision, previous)) {
const section = splitReleaseHeadline(releaseNotesSection(commit.message, `Commit ${commit.revision}`));
// The final product PR is the editorial decision for this release, including
// deliberate omission. Earlier PRs retain all their actual update details.
headline = section.headline;
bodies.push(section.notes);
}
if (!bodies.length) {
if (allowEmpty) return "";
throw new Error("No release changes found");
}
const url = `https://github.com/${repository}`;
const source = previous
? `[Full changelog / 完整变更](${url}/compare/${previous}...${revision})`
: `[Source / 源代码](${url}/tree/${revision})`;
const opening = headline ? `**${headline.en}**\n\n**${headline["zh-CN"]}**\n\n` : "";
return `${opening}${bodies.join("\n\n")}\n\n---\n\n${source}\n`;
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
const [version, revision, option] = process.argv.slice(2);
if (version === "--pull-request") {
if (!process.env.GITHUB_EVENT_PATH) throw new Error("GITHUB_EVENT_PATH is missing");
pullRequestNotes(process.cwd(), JSON.parse(readFileSync(process.env.GITHUB_EVENT_PATH, "utf8")));
process.stdout.write("PR release notes validated.\n");
} else {
if (option && option !== "--github-summary") {
throw new Error("Use release-notes.mjs <version> <full-SHA> [--github-summary]");
}
const body = releaseNotes(process.cwd(), version, revision,
process.env.GITHUB_REPOSITORY || "TNTcraftHIM/Piik", { allowEmpty: Boolean(option) });
if (option) {
if (!process.env.GITHUB_STEP_SUMMARY) throw new Error("GITHUB_STEP_SUMMARY is missing");
appendFileSync(process.env.GITHUB_STEP_SUMMARY,
`## Release notes preview: Piik ${version}\n\n${body || "No product changes; this candidate does not publish a release.\n"}`);
}
process.stdout.write(body);
}
}