Files
piik/scripts/release-mirror-source.mjs
T
TNTcraft 07e37c7228 fix(app): stabilize authorization and compact room controls
## Problem and outcome / 问题与结果

App authorization could stay busy after a stalled save, a pending microphone request could survive a capture-source handoff, and compact room controls could lose focus, position or readable names. This maintenance phase corrects those owners and makes connection help easier to find.

## Verification / 验证

Validation: the exact candidate tree passed all 1,943 Web tests and documentation checks. Its unchanged product source has passed TypeScript and a production Web build. Controlled UI checks cover delayed microphone permission, stalled approval responses, keyboard viewport changes, rapid floating-panel hide/show and narrow nickname layouts. Published 2.x wire, native control and storage contracts are unchanged.

## Impact / 影响

Compatible 2.x maintenance release. Existing App, site and persisted room contracts are retained. Matching packages, download mirrors and both managed sites are verified through the normal release workflow.

## Release notes

**Piik, now in your pocket.**

Piik App supports Android screen sharing, with touch controls for a friend's computer.

**手机,也能开播。**

Piik App 支持 Android 屏幕分享,也能用手机控制朋友的电脑。

### English

This maintenance update improves App authorization, capture-source switching and controls on smaller screens.

- Fix commentary controls remaining busy after switching from Browser capture to the App.
- Let App site approval recover from a stalled save, keeping access already granted.
- Preserve numeric-input focus when the mobile keyboard resizes the page, and provide increase/decrease buttons. Keep interaction windows at their remembered position after rapid hide/show actions.
- Give nicknames readable space on smaller screens, while retaining edit controls and accessible labels. Keep launcher diagnostics inside the shared Help menu.
- Make room-connection help easier to find, and clarify Safari screen-sharing and sound support.
- Complete package mirroring after a later CI publication step fails, and verify managed-service deployments against the intended source revision.

This maintenance update preserves the established 2.x room, invitation, media,
App-control and storage contracts. Refresh a site's open pages after it is
updated. App-local users need the updated App bundle to receive its included
Web fixes. Existing compatible 2.x App/site workflows remain supported.

### 中文

本次维护更新改善 App 授权、切换分享源和小屏操作。

- 修复浏览器切换为 App 采集后,分享麦克风控制一直处于忙碌状态的问题。
- App 站点授权不再因保存卡住而一直转圈;可以重试,已批准的授权也会保留。
- 手机键盘改变页面尺寸时保留数字输入焦点,并提供增减按钮;互动窗口快速隐藏再打开后保留记忆位置。
- 小屏上为昵称保留可读空间,同时保留编辑入口与无障碍名称;启动页诊断统一收进帮助菜单。
- 更容易找到房间连接问题的排查入口,并说明 Safari 屏幕分享与声音的支持情况。
- 发布流程后续步骤失败时,仍可补全已经发布的程序包镜像;部署核验明确比对预期源码版本。

本维护更新保留既有 2.x 房间、邀请、媒体、App 控制与存储契约。
站点更新后请刷新已打开的网页;App 本地使用者需更新程序包,才能使用其中的新网页修复。
已有兼容的 2.x App/站点使用方式继续支持。
2026-11-08 12:28:03 -04:00

50 lines
2.6 KiB
JavaScript

import { execFileSync } from "node:child_process";
import { appendFileSync } from "node:fs";
import { pathToFileURL } from "node:url";
import { isReleaseVersion } from "./release-version.mjs";
const repository = "TNTcraftHIM/Piik";
const gh = (path) => JSON.parse(execFileSync("gh", ["api", `repos/${repository}/${path}`], {
encoding: "utf8", stdio: ["ignore", "pipe", "pipe"], timeout: 30_000,
}));
export function resolveMirrorSource(runId, automatic = false) {
if (!/^[1-9]\d*$/.test(runId) || !Number.isSafeInteger(Number(runId))) {
throw new Error("Provide the original CI run's numeric ID");
}
const run = gh(`actions/runs/${runId}`);
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)) {
throw new Error("Mirror artifacts must come from a completed main push in this repository's CI workflow");
}
// 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)) {
throw new Error("A published stable GitHub release with a full source SHA is required");
}
if (release.target_commitish !== run.head_sha) {
if (automatic) return null;
throw new Error("This CI run does not match the latest GitHub release; use its original publishing run");
}
return { run_id: String(run.id), version: release.tag_name, revision: run.head_sha };
}
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
const source = resolveMirrorSource(process.argv[2], process.env.GITHUB_EVENT_NAME === "workflow_run");
const output = { mirror: source !== null, ...source };
if (process.env.GITHUB_OUTPUT) {
appendFileSync(process.env.GITHUB_OUTPUT,
Object.entries(output).map(([key, value]) => `${key}=${value}\n`).join(""));
}
if (process.env.GITHUB_STEP_SUMMARY) {
appendFileSync(process.env.GITHUB_STEP_SUMMARY, source
? `Mirror ${source.version} from original [CI run ${source.run_id}](https://github.com/${repository}/actions/runs/${source.run_id}).\n`
: "This CI run did not publish the current GitHub release; no mirror work is needed.\n");
}
console.log(JSON.stringify(output));
}