Skip to content

Commit 854789c

Browse files
author
Fei-Away
committed
fix(windows): make screenshot verification non-interactive
1 parent 9a302b7 commit 854789c

2 files changed

Lines changed: 5 additions & 10 deletions

File tree

windows/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
### 修复
66

7+
- 截图验证不再向 Codex 窗口发送 `Esc` 或移动鼠标,并取消额外等待;验证更快,也不会打断用户当时的键鼠操作。
78
- 渲染层现在只在检测到完整 Codex 主界面壳层时启用皮肤;宠物等透明辅助窗口会主动清理主题背景与装饰节点,避免出现遮挡宠物的矩形背景框。
89
- 安装与 `-RestoreBaseTheme` 现在严格按 UTF-8 读取,保留原换行风格,并以无 BOM、同目录原子替换方式写回 `config.toml`,避免中文项目名称乱码或导致 Codex 无法启动。
910
- 遇到带 BOM/无 BOM 的 UTF-16、NUL 字符、无效 UTF-8 或写入期间被其他程序改动的配置时停止修改,不再静默转码或覆盖较新的内容。
@@ -41,5 +42,6 @@
4142

4243
### 测试
4344

45+
- 增加截图流程回归检查,阻止键盘或鼠标事件重新进入只读截图路径。
4446
- 增加渲染层辅助窗口回归测试,覆盖主窗口正常注入、透明辅助窗口清理残余样式,以及辅助目标随后成为完整主界面时可重新启用皮肤。
4547
- 增加中文项目路径、CRLF/LF、UTF-16 与歧义 TOML 拒绝、并发写检测、section 隔离、精确恢复、Appx/state 身份、状态归档、payload 构造、Browser ID 和不安全 CDP URL 的回归检查。

windows/scripts/injector.mjs

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -417,16 +417,6 @@ async function waitForVerifiedSession(session, timeoutMs) {
417417

418418
async function capture(session, outputPath) {
419419
await fs.mkdir(path.dirname(outputPath), { recursive: true });
420-
await session.send("Input.dispatchKeyEvent", { type: "keyDown", key: "Escape", code: "Escape", windowsVirtualKeyCode: 27 });
421-
await session.send("Input.dispatchKeyEvent", { type: "keyUp", key: "Escape", code: "Escape", windowsVirtualKeyCode: 27 });
422-
const viewport = await session.evaluate("({ width: innerWidth, height: innerHeight })");
423-
await session.send("Input.dispatchMouseEvent", {
424-
type: "mouseMoved",
425-
x: Math.round(viewport.width * 0.64),
426-
y: Math.round(viewport.height * 0.62),
427-
button: "none",
428-
});
429-
await new Promise((resolve) => setTimeout(resolve, 300));
430420
const result = await session.send("Page.captureScreenshot", {
431421
format: "png",
432422
fromSurface: true,
@@ -620,6 +610,9 @@ if (options.mode === "self-test") {
620610
invalidPageTargets.some((item) => isValidCdpPageTarget(item, options.port))) {
621611
throw new Error("CDP URL and target validation self-test failed");
622612
}
613+
if (/dispatchKeyEvent|dispatchMouseEvent/.test(capture.toString())) {
614+
throw new Error("Screenshot capture must not dispatch renderer input events");
615+
}
623616
console.log(JSON.stringify({ pass: true, version: SKIN_VERSION, test: "loopback-cdp-validation" }));
624617
} else if (options.mode === "check-payload") {
625618
const payload = await loadPayload();

0 commit comments

Comments
 (0)