## Problem and outcome / 问题与结果 Planned release: **v2.3.0**, preserving the published 2.x sharing contracts. Friends can now talk in a Piik room before, during or after screen sharing. Room voice, media forwarding and the picture retain separate lifetimes under the existing room authority and route controller. This phase also improves direct LAN entry, native capture startup, interaction controls and first-use documentation. Related: #484, #437, #486, #488, #485 and #489. These references do not declare all reported hardware or distribution problems fixed. ## Release notes **Less typing. More talking.** Piik now supports room voice, with or without screen sharing. **聊不够?开麦吧!** Piik 现已支持房间语音,不开播也能聊。 ### English This update adds room voice alongside sharing, chat and reactions, with clearer controls and direct HTTPS invitations for local and virtual networks. #### Highlights - Create a room before sharing. The Host opens or closes room voice; friends can join, control their own microphone and listening, or mute someone locally. Joining voice keeps the microphone off until you enable it. - Choose your microphone, adjust microphone, master and individual listening volumes from 0% to 200%, and enable voice processing in the interaction window. Audio icons offer quick volume sliders. The microphone icon shows live input level. Voice continues when the picture stops. - Use a local HTTPS invitation for microphone and remote-control features on a LAN or virtual LAN. A temporary local certificate requires a browser warning confirmation; a self-hosted Server can also use supplied certificate files. - Rotate your local picture, optionally volunteer more relay capacity, and download a native Windows x64 Server package. #### Fixes and polish - Align Windows automatic encoder probes with the surfaces used during actual capture; keep video capture progressing while optional source audio starts. - Correct Linux desktop pixel-aspect negotiation and accept fitted native source dimensions without forcing a different aspect ratio. - Avoid retaining false media queue congestion when producer and consumer clocks disagree. - Distinguish chat authors with identical names, clarify remote permissions, and keep floating tools, contextual hints and microphone indicators aligned. - Separate first-use guides, room tools and troubleshooting so help is easier to find. Use updated Server/Web pages for room voice and update the App for the native capture and local HTTPS improvements. Established 2.x sharing remains supported. macOS builds do not yet carry Developer ID signing or Apple notarization; see the first-launch instructions. The macOS audio-startup changes still need confirmation on an affected Mac. ### 中文 本次更新为分享、聊天和表情互动加入房间语音,同时打磨操作控件,并为局域网和虚拟局域网提供直接 HTTPS 邀请。 #### 主要变化 - 不开播也能创建房间。房主开启或关闭房间语音;朋友可以加入、自行开关麦克风和收听,或仅在自己这边静音某人。加入语音时默认不开麦。 - 在互动窗口选择麦克风、分别调整 0%–200% 的麦克风、总收听与个人音量,并设置语音处理。音频图标可展开快捷音量条,麦克风图标显示实时输入音量。停止画面分享后,语音仍可继续。 - 局域网和虚拟局域网可使用本地 HTTPS 邀请,启用麦克风和远程控制;临时本地证书需要在浏览器确认警告。自部署服务端也可使用自行提供的证书文件。 - 可旋转本地观看画面、自愿增加转发容量,并提供 Windows x64 服务端下载包。 #### 修复与打磨 - Windows 自动编码探测使用与实际采集一致的输入;可选来源音频启动期间,画面采集继续运行。 - 修正 Linux 桌面采集的像素比例协商;原生来源保留实际画幅,不再要求固定比例的尺寸。 - 避免生产者和消费者时钟不一致时,错误保留媒体队列拥塞状态。 - 区分同名聊天作者,明确远控授权,并统一浮窗、上下文提示与麦克风指示器的细节。 - 分开首次使用、房间工具和故障排查文档,让帮助更容易查找。 房间语音需使用更新后的服务端和网页;原生采集与本地 HTTPS 改进需更新 App。既有 2.x 分享仍保持兼容。 macOS 构建仍未正式签名和公证,首次启动请参照文档;音频启动调整仍需在受影响的 Mac 上确认。 ## Verification / 验证 Full Web checks, Go tests/vet/build/native probes, reachable vulnerability checks, normal-page P2P/SFU voice and compatible sharing, LAN HTTPS, detached interaction tools, responsive controls and tooltip/pure-visual checks provide acceptance evidence. Physical macOS/Linux capture and acoustic behavior on arbitrary devices are not established by these controls. Scoped contributions from #488 (Linux pixel aspect) and #485 (Windows Server packaging) are retained as their original authors' patch commits in this PR. The remaining implementation and integration belong to the maintainer. ## Impact / 影响 Preserve the published 2.x sharing contract. New room-voice behavior is opt-in; Host voice activation, capture and picture lifetimes remain distinct. Local certificate material remains in memory; no system trust installation is performed.
240 lines
8.6 KiB
TypeScript
240 lines
8.6 KiB
TypeScript
import { spawn, type ChildProcessWithoutNullStreams } from "node:child_process";
|
|
import { mkdtemp, readFile } from "node:fs/promises";
|
|
import { tmpdir } from "node:os";
|
|
import { join } from "node:path";
|
|
|
|
import {
|
|
CdpConnection,
|
|
cleanupRun,
|
|
createPage,
|
|
evaluate,
|
|
fetchJsonBefore,
|
|
launchChrome,
|
|
reservePort,
|
|
waitForSample,
|
|
waitForVersion,
|
|
} from "./browser-gate-harness";
|
|
import {
|
|
readAppEndpoint,
|
|
} from "./app-gate-endpoint";
|
|
|
|
interface GateReport {
|
|
passed: boolean;
|
|
platform: NodeJS.Platform;
|
|
browser: string | null;
|
|
appStarted: boolean;
|
|
localServerReady: boolean;
|
|
bootstrapAuthenticated: boolean;
|
|
bootstrapRemoved: boolean;
|
|
hostReady: boolean;
|
|
lanInvite: boolean;
|
|
lanSecureContext: boolean;
|
|
lanMicrophone: boolean;
|
|
lanEncryptedInput: boolean;
|
|
lanSignalingConnected: boolean;
|
|
appExited: boolean;
|
|
browserExited: boolean;
|
|
portsClosed: boolean;
|
|
profileRemoved: boolean;
|
|
error: string | null;
|
|
}
|
|
|
|
interface LocalPageState {
|
|
bootstrapPresent: boolean;
|
|
access: { required: boolean; authenticated: boolean } | null;
|
|
hostReady: boolean;
|
|
}
|
|
|
|
const LOCAL_PAGE_STATE = `fetch('/api/site-access')
|
|
.then((response) => response.json())
|
|
.catch(() => null)
|
|
.then((access) => ({
|
|
bootstrapPresent: ['client-access', 'piik-client']
|
|
.some((key) => new URLSearchParams(location.hash.slice(1)).has(key)),
|
|
access,
|
|
hostReady: Boolean(document.querySelector('.lr-host-personal-controls')),
|
|
}))`;
|
|
|
|
async function main(): Promise<void> {
|
|
if (process.env.PIIK_CLIENT_LOCAL_GATE !== "true") {
|
|
throw new Error("Local App gate was not explicitly enabled");
|
|
}
|
|
const browserPath = process.env.CHROME_PATH?.trim();
|
|
const appPath = process.env.PIIK_CLIENT_EXE?.trim();
|
|
const lanAddress = process.env.PIIK_CLIENT_GATE_LAN_ADDRESS?.trim();
|
|
if (!browserPath || !appPath || !lanAddress) {
|
|
throw new Error(
|
|
"CHROME_PATH, PIIK_CLIENT_EXE, and PIIK_CLIENT_GATE_LAN_ADDRESS are required",
|
|
);
|
|
}
|
|
|
|
const report: GateReport = {
|
|
passed: false,
|
|
platform: process.platform,
|
|
browser: null,
|
|
appStarted: false,
|
|
localServerReady: false,
|
|
bootstrapAuthenticated: false,
|
|
bootstrapRemoved: false,
|
|
hostReady: false,
|
|
lanInvite: false,
|
|
lanSecureContext: false,
|
|
lanMicrophone: false,
|
|
lanEncryptedInput: false,
|
|
lanSignalingConnected: false,
|
|
appExited: false,
|
|
browserExited: false,
|
|
portsClosed: false,
|
|
profileRemoved: false,
|
|
error: null,
|
|
};
|
|
const appPort = await reservePort();
|
|
const debugPort = await reservePort();
|
|
const profile = await mkdtemp(join(tmpdir(), "piik-client-loopback-"));
|
|
const configPath = join(profile, "client.json");
|
|
let app: ChildProcessWithoutNullStreams | null = null;
|
|
let browser: ChildProcessWithoutNullStreams | null = null;
|
|
let cdp: CdpConnection | null = null;
|
|
let loopbackPort = 0;
|
|
try {
|
|
app = spawn(appPath, [
|
|
"--local",
|
|
"--config", configPath,
|
|
"--lan-address", lanAddress,
|
|
"--port", String(appPort),
|
|
], {
|
|
stdio: "pipe",
|
|
windowsHide: true,
|
|
env: { ...process.env, PIIK_CLIENT_GATE_NO_BROWSER: "true" },
|
|
});
|
|
app.stderr.resume();
|
|
const endpoint = await readAppEndpoint(app);
|
|
loopbackPort = endpoint.port;
|
|
report.appStarted = true;
|
|
await waitForSample(
|
|
(deadline) => fetchJsonBefore<{ status: string }>(
|
|
`http://127.0.0.1:${appPort}/healthz`,
|
|
deadline,
|
|
),
|
|
(health) => health.status === "ok",
|
|
15_000,
|
|
);
|
|
report.localServerReady = true;
|
|
const config = JSON.parse(await readFile(configPath, "utf8")) as {
|
|
localAccessPassword?: unknown;
|
|
};
|
|
if (typeof config.localAccessPassword !== "string") {
|
|
throw new Error("App access bootstrap is unavailable");
|
|
}
|
|
const localAccessPassword = config.localAccessPassword;
|
|
const bootstrap = new URLSearchParams({
|
|
...(localAccessPassword ? { "client-access": localAccessPassword } : {}),
|
|
"piik-client": "1",
|
|
}).toString();
|
|
|
|
browser = await launchChrome(browserPath, debugPort, profile, [
|
|
"--headless=new",
|
|
...(process.env.PIIK_CLIENT_GATE_NO_SANDBOX === "true"
|
|
? ["--no-sandbox"]
|
|
: []),
|
|
"--no-first-run",
|
|
"--no-proxy-server",
|
|
"--disable-logging",
|
|
"--use-fake-device-for-media-stream",
|
|
"--use-fake-ui-for-media-stream",
|
|
]);
|
|
browser.stdout.resume();
|
|
browser.stderr.resume();
|
|
const version = await waitForVersion(debugPort, browser);
|
|
report.browser = version.Browser;
|
|
cdp = await CdpConnection.connect(version.webSocketDebuggerUrl, Date.now() + 10_000);
|
|
const page = await createPage(
|
|
cdp,
|
|
`http://localhost:${appPort}/#${bootstrap}`,
|
|
);
|
|
const readState = (deadline: number) =>
|
|
evaluate<LocalPageState>(cdp!, page, LOCAL_PAGE_STATE, deadline).then((value) => {
|
|
report.bootstrapAuthenticated = value.access?.required === Boolean(localAccessPassword) &&
|
|
value.access.authenticated;
|
|
report.bootstrapRemoved = !value.bootstrapPresent;
|
|
report.hostReady = value.hostReady;
|
|
return value;
|
|
});
|
|
await waitForSample(
|
|
readState,
|
|
(value) => value.access?.authenticated === true &&
|
|
value.hostReady,
|
|
15_000,
|
|
);
|
|
const invitation = await evaluate<string>(
|
|
cdp,
|
|
page,
|
|
`fetch('/api/rooms', {
|
|
method: 'POST',
|
|
headers: { 'Content-Type': 'application/json' },
|
|
body: JSON.stringify({ codeEntryPolicy: 'open' }),
|
|
}).then(async (response) => {
|
|
if (!response.ok) throw new Error('Room creation failed');
|
|
const room = await response.json();
|
|
return room.inviteUrl;
|
|
})`,
|
|
Date.now() + 5_000,
|
|
);
|
|
report.lanInvite = invitation.startsWith(`https://${lanAddress}:${appPort}/r/`);
|
|
const viewer = await createPage(cdp, invitation, `(() => {
|
|
const NativeWS=WebSocket;
|
|
window.WebSocket=class extends NativeWS {
|
|
constructor(...args){super(...args);this.addEventListener('message',event=>{
|
|
try {if(JSON.parse(event.data).type==='authenticated')window.__localGateAuthenticated=true;}catch{}
|
|
});}
|
|
};
|
|
})()`);
|
|
// Exercise Chrome's actual certificate exception. No global TLS bypass or
|
|
// browser trust-store change is part of this gate or the shipped App.
|
|
await evaluate(cdp, viewer, `document.getElementById('details-button')?.click();
|
|
document.getElementById('proceed-link')?.click();`, Date.now() + 5_000);
|
|
await waitForSample(deadline => evaluate(cdp!, viewer,
|
|
"Boolean(window.__localGateAuthenticated)", deadline), Boolean, 15_000);
|
|
report.lanSignalingConnected = true;
|
|
const capabilities = await evaluate<{ secure: boolean; microphone: boolean; encryption: boolean }>(cdp, viewer,
|
|
`(async()=>{
|
|
const stream=await navigator.mediaDevices.getUserMedia({audio:true});
|
|
const microphone=stream.getAudioTracks().some(track=>track.readyState==='live');
|
|
stream.getTracks().forEach(track=>track.stop());
|
|
const key=await crypto.subtle.generateKey({name:'AES-GCM',length:128},false,['encrypt','decrypt']);
|
|
const iv=crypto.getRandomValues(new Uint8Array(12));
|
|
const text=new TextEncoder().encode('Piik LAN input');
|
|
const ciphertext=await crypto.subtle.encrypt({name:'AES-GCM',iv},key,text);
|
|
const plaintext=await crypto.subtle.decrypt({name:'AES-GCM',iv},key,ciphertext);
|
|
return {secure:isSecureContext,microphone,encryption:new TextDecoder().decode(plaintext)==='Piik LAN input'};
|
|
})()`, Date.now() + 5_000);
|
|
report.lanSecureContext = capabilities.secure;
|
|
report.lanMicrophone = capabilities.microphone;
|
|
report.lanEncryptedInput = capabilities.encryption;
|
|
} catch (error) {
|
|
report.error = error instanceof Error ? error.message : String(error);
|
|
} finally {
|
|
const cleanup = await cleanupRun({
|
|
cdp,
|
|
native: app,
|
|
chrome: browser,
|
|
server: null,
|
|
profile,
|
|
ports: [appPort, debugPort, ...(loopbackPort ? [loopbackPort] : [])],
|
|
});
|
|
report.appExited = cleanup.nativeExited;
|
|
report.browserExited = cleanup.browserExited;
|
|
report.portsClosed = cleanup.portsClosed;
|
|
report.profileRemoved = cleanup.profileRemoved;
|
|
}
|
|
report.passed = report.appStarted && report.localServerReady &&
|
|
report.bootstrapAuthenticated && report.bootstrapRemoved && report.hostReady &&
|
|
report.lanInvite && report.lanSecureContext && report.lanMicrophone &&
|
|
report.lanEncryptedInput && report.lanSignalingConnected && report.appExited && report.browserExited &&
|
|
report.portsClosed && report.profileRemoved && report.error === null;
|
|
process.stdout.write(`${JSON.stringify(report)}\n`);
|
|
if (!report.passed) process.exitCode = 1;
|
|
}
|
|
|
|
await main();
|