实现项目真机预览与待审版本扫码验收

需求:接管客户端未提交 WIP,保留真机预览,移除旧登录原型并维持 2.0.0。

实现:由 Main 核对项目与精确 Release,签发短时 Owner preview;补充一键提交映射能力及 Windows ZIP 预检兼容。
This commit is contained in:
2026-08-08 17:57:36 +08:00
parent 7b23cce67a
commit 1a19ad9808
20 changed files with 1890 additions and 12 deletions

25
src/lib/device-preview.ts Normal file
View File

@@ -0,0 +1,25 @@
import { hostApiFetch } from '@/lib/host-api';
import type { DevicePreviewSnapshot } from '../../shared/device-preview';
type DevicePreviewResponse = {
success: boolean;
preview?: DevicePreviewSnapshot;
error?: string;
};
export class DevicePreviewApiError extends Error {
constructor(message: string) {
super(message);
this.name = 'DevicePreviewApiError';
}
}
export async function fetchProjectDevicePreview(projectId: string): Promise<DevicePreviewSnapshot> {
const response = await hostApiFetch<DevicePreviewResponse>(
`/api/opencode/projects/${encodeURIComponent(projectId)}/device-preview`,
);
if (!response.success || !response.preview) {
throw new DevicePreviewApiError(response.error || '无法读取真机预览状态');
}
return response.preview;
}