diff --git a/harness.html b/harness.html index acb56d3..f08f30a 100644 --- a/harness.html +++ b/harness.html @@ -5,6 +5,12 @@ harness-取证 + + + + + diff --git a/src/harness-main.ts b/src/harness-main.ts index 4325dae..88009e4 100644 --- a/src/harness-main.ts +++ b/src/harness-main.ts @@ -27,7 +27,12 @@ import AppHeader from "@/components/AppHeader.vue"; import UserInfoModal from "@/components/UserInfoModal.vue"; import mittBus from "@/utils/mitt"; +/** 命令面板取证用空壳路由:只需 route.name === "apps" 让 Header 渲染放大镜, + * 不挂真实 AppList(避免本机无后端时 getUserApp 失败污染控制台) */ +const CmdEmptyShell = defineComponent({ setup: () => () => h("div", { style: "height:100%" }) }); + const harnessRoutes: any[] = [ + { path: "/apps", name: "apps", component: CmdEmptyShell, meta: { title: "应用" } }, { path: "/msg", name: "Msg", component: MsgPage, meta: { title: "消息" } }, { path: "/settings", name: "Settings", component: SettingsPage, meta: { title: "设置" } }, { path: "/theme-preview", name: "ThemePreview", component: ThemePreviewPage, meta: { title: "主题预览" } }, @@ -258,3 +263,25 @@ function runAssert(attempt: number) { document.title = "HARNESS-READY"; } setTimeout(() => runAssert(0), 1500); + +// ===== 命令面板取证:?cmd=1[&q=课] 自动点开放大镜并可选输入;配合 #/apps ===== +if (params.get("cmd") === "1") { + setTimeout(() => { + const btn = document.querySelector(".operate-container .icon-box") as HTMLElement | null; + btn?.click(); + const q = params.get("q"); + setTimeout( + () => { + if (q) { + const inp = document.querySelector(".app-cmdk-hd input") as HTMLInputElement | null; + if (inp) { + inp.value = q; + inp.dispatchEvent(new Event("input")); + } + } + setTimeout(() => ((window as any).__CMDK_READY__ = true), 600); + }, + q ? 500 : 600 + ); + }, 900); +}