High-performance browser automation bridge and multi-instance orchestrator with advanced stealth injection and real-time dashboard.
fix: add screencast keyboard input handling (#283)
Jamil Zakirov477a8cc8a9c4
diff --git a/dashboard/src/components/screencast/ScreencastTile.tsx b/dashboard/src/components/screencast/ScreencastTile.tsxindex 9b473f85..1c7ac25b 100644--- a/dashboard/src/components/screencast/ScreencastTile.tsx+++ b/dashboard/src/components/screencast/ScreencastTile.tsx@@ -84,7 +84,7 @@ export default function ScreencastTile({tabId,x: Math.round(coords.x),y: Math.round(coords.y),- deltaY: Math.round(e.deltaY),+ scrollY: Math.round(e.deltaY),});} catch (err) {console.error("scroll failed", err);@@ -93,6 +93,41 @@ export default function ScreencastTile({[status, tabId, getPageCoords],);+ const handleKeyDown = useCallback(+ async (e: React.KeyboardEvent<HTMLCanvasElement>) => {+ if (status !== "streaming") return;+ if ((e.ctrlKey || e.metaKey) && e.key === "v") {+ e.preventDefault();+ navigator.clipboard+ .readText()+ .then((text) => {+ if (text) {+ api+ .sendAction({ kind: "keyboard-inserttext", tabId, text })+ .catch(() => {});+ }+ })+ .catch(() => {});+ return;+ }+ e.preventDefault();+ try {+ if (e.key.length === 1 && !e.ctrlKey && !e.metaKey && !e.altKey) {+ await api.sendAction({+ kind: "keyboard-inserttext",+ tabId,+ text: e.key,+ });+ } else {+ await api.sendAction({ kind: "press", tabId, key: e.key });+ }+ } catch (err) {+ console.error("key input failed", err);+ }+ },+ [status, tabId],+ );+// Prevent default wheel behavior on the canvas so the page doesn't scrolluseEffect(() => {const canvas = canvasRef.current;@@ -274,10 +309,12 @@ export default function ScreencastTile({<canvasref={canvasRef}className="max-h-full max-w-full cursor-pointer object-contain"+ tabIndex={0}width={800}height={600}onClick={handleCanvasClick}onWheel={handleCanvasWheel}+ onKeyDown={handleKeyDown}/>)}diff --git a/dashboard/src/services/api.ts b/dashboard/src/services/api.tsindex 56ecfb61..67b67689 100644--- a/dashboard/src/services/api.ts+++ b/dashboard/src/services/api.ts@@ -210,7 +210,7 @@ export async function fetchTabPdf(tabId: string): Promise<Blob> {}export async function closeTab(tabId: string): Promise<void> {- await request(`/tabs/${encodeURIComponent(tabId)}`, { method: "DELETE" });+ await request(`/tabs/${encodeURIComponent(tabId)}/close`, { method: "POST" });}export async function navigateTab(