mirror of
https://github.com/nexu-io/openmotion.git
synced 2026-12-01 23:51:42 +08:00
Some checks failed
Motion standalone checks / Template library policy (push) Has been cancelled
Motion standalone checks / Maintainability report (push) Has been cancelled
Motion standalone checks / Source checks (push) Has been cancelled
Motion standalone checks / Workspace reliability (macos-15) (push) Has been cancelled
Motion standalone checks / Workspace reliability (windows-2025) (push) Has been cancelled
Motion standalone checks / Studio regression (1/2) (push) Has been cancelled
Motion standalone checks / Studio regression (2/2) (push) Has been cancelled
Motion standalone checks / Distribution browser regression (push) Has been cancelled
Motion standalone checks / Distribution regression (push) Has been cancelled
Motion standalone checks / standalone (push) Has been cancelled
DSH integration / Optional DSH plugin (push) Has been cancelled
Motion release controls / controls (push) Has been cancelled
Update README star history / refresh (push) Has been cancelled
Reverts commit 216e12abfe on main while keeping #808 (and follow-up #848) intact on the next branch for continued local/desktop Super Agent development.
Preserves subsequent main commits (#844, #847, #849, #851, #854, #856) outside the reverted #808 surface and restores the pre-#808 /mcp routing expectation in tests/server.test.ts.
Co-authored-by: 罗高 <luogao@users.noreply.github.com>
15 lines
1023 B
TypeScript
15 lines
1023 B
TypeScript
export type WebPageState = { url: string; title: string; canGoBack: boolean; canGoForward: boolean; loading: boolean; error?: string };
|
|
export type BrowserInput =
|
|
| { type: 'pointer'; event: 'move' | 'down' | 'up'; x: number; y: number; button: 'left' | 'middle' | 'right'; clickCount?: number }
|
|
| { type: 'wheel'; x: number; y: number; deltaX: number; deltaY: number }
|
|
| { type: 'text'; text: string }
|
|
| { type: 'key'; key: string; modifiers: number };
|
|
|
|
export function webAddress(value: unknown): string {
|
|
if (typeof value !== 'string' || !value.trim() || value.length > 8192) throw new Error('请输入有效的 HTTP 或 HTTPS 网址');
|
|
const input = value.trim();
|
|
const url = new URL(/^https?:\/\//i.test(input) ? input : /^[a-z][\w+.-]*:/i.test(input) && !/^[\w.-]+:\d+(?:\/|$)/.test(input) ? input : `https://${input}`);
|
|
if (!['http:', 'https:'].includes(url.protocol) || url.username || url.password || !url.hostname) throw new Error('请输入有效的 HTTP 或 HTTPS 网址');
|
|
return url.href;
|
|
}
|