Fix deploy.sh CRLF line endings for Linux compatibility
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
+70
-70
@@ -1,70 +1,70 @@
|
||||
from typing import Any
|
||||
|
||||
from app.browser_manager import BrowserManager, BrowserSession
|
||||
|
||||
|
||||
async def handle_input(
|
||||
manager: BrowserManager,
|
||||
session: BrowserSession,
|
||||
payload: dict[str, Any],
|
||||
) -> dict[str, Any] | None:
|
||||
action = payload.get("action")
|
||||
if not action:
|
||||
return None
|
||||
|
||||
manager.touch(session)
|
||||
page = session.page
|
||||
|
||||
if action == "click":
|
||||
x = float(payload.get("x", 0))
|
||||
y = float(payload.get("y", 0))
|
||||
button = payload.get("button", "left")
|
||||
await page.mouse.click(x, y, button=button)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "dblclick":
|
||||
x = float(payload.get("x", 0))
|
||||
y = float(payload.get("y", 0))
|
||||
await page.mouse.dblclick(x, y)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "mousemove":
|
||||
x = float(payload.get("x", 0))
|
||||
y = float(payload.get("y", 0))
|
||||
await page.mouse.move(x, y)
|
||||
return None
|
||||
|
||||
if action == "wheel":
|
||||
delta_x = float(payload.get("deltaX", 0))
|
||||
delta_y = float(payload.get("deltaY", 0))
|
||||
await page.mouse.wheel(delta_x, delta_y)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "keydown":
|
||||
key = payload.get("key")
|
||||
if not key:
|
||||
return None
|
||||
await page.keyboard.down(key)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "keyup":
|
||||
key = payload.get("key")
|
||||
if not key:
|
||||
return None
|
||||
await page.keyboard.up(key)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "type":
|
||||
text = payload.get("text", "")
|
||||
if text:
|
||||
await page.keyboard.type(text)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "press":
|
||||
key = payload.get("key")
|
||||
if not key:
|
||||
return None
|
||||
await page.keyboard.press(key)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
return {"type": "error", "message": f"未知操作: {action}"}
|
||||
from typing import Any
|
||||
|
||||
from app.browser_manager import BrowserManager, BrowserSession
|
||||
|
||||
|
||||
async def handle_input(
|
||||
manager: BrowserManager,
|
||||
session: BrowserSession,
|
||||
payload: dict[str, Any],
|
||||
) -> dict[str, Any] | None:
|
||||
action = payload.get("action")
|
||||
if not action:
|
||||
return None
|
||||
|
||||
manager.touch(session)
|
||||
page = session.page
|
||||
|
||||
if action == "click":
|
||||
x = float(payload.get("x", 0))
|
||||
y = float(payload.get("y", 0))
|
||||
button = payload.get("button", "left")
|
||||
await page.mouse.click(x, y, button=button)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "dblclick":
|
||||
x = float(payload.get("x", 0))
|
||||
y = float(payload.get("y", 0))
|
||||
await page.mouse.dblclick(x, y)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "mousemove":
|
||||
x = float(payload.get("x", 0))
|
||||
y = float(payload.get("y", 0))
|
||||
await page.mouse.move(x, y)
|
||||
return None
|
||||
|
||||
if action == "wheel":
|
||||
delta_x = float(payload.get("deltaX", 0))
|
||||
delta_y = float(payload.get("deltaY", 0))
|
||||
await page.mouse.wheel(delta_x, delta_y)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "keydown":
|
||||
key = payload.get("key")
|
||||
if not key:
|
||||
return None
|
||||
await page.keyboard.down(key)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "keyup":
|
||||
key = payload.get("key")
|
||||
if not key:
|
||||
return None
|
||||
await page.keyboard.up(key)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "type":
|
||||
text = payload.get("text", "")
|
||||
if text:
|
||||
await page.keyboard.type(text)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
if action == "press":
|
||||
key = payload.get("key")
|
||||
if not key:
|
||||
return None
|
||||
await page.keyboard.press(key)
|
||||
return {"type": "ack", "action": action}
|
||||
|
||||
return {"type": "error", "message": f"未知操作: {action}"}
|
||||
|
||||
Reference in New Issue
Block a user