Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -144,6 +144,16 @@ async def handle_action(ws: WebSocket, msg: dict):
|
|
| 144 |
"stderr": result["stderr"],
|
| 145 |
"returncode": result["returncode"],
|
| 146 |
}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 147 |
|
| 148 |
# ββ MOUSE MOVE βββββββββββββββββββββββββββββββββββ
|
| 149 |
elif action == "mouse_move":
|
|
@@ -221,6 +231,16 @@ async def handle_action(ws: WebSocket, msg: dict):
|
|
| 221 |
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
| 222 |
)
|
| 223 |
await ws.send_text(json.dumps({"type": "ack", "action": "open_app"}))
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 224 |
|
| 225 |
# ββ START STREAM βββββββββββββββββββββββββββββββββ
|
| 226 |
elif action == "start_stream":
|
|
|
|
| 144 |
"stderr": result["stderr"],
|
| 145 |
"returncode": result["returncode"],
|
| 146 |
}))
|
| 147 |
+
# Auto-screenshot after terminal command
|
| 148 |
+
await asyncio.sleep(0.5)
|
| 149 |
+
frame = capture_screen(scale=0.7, quality=70)
|
| 150 |
+
if frame:
|
| 151 |
+
await ws.send_text(json.dumps({
|
| 152 |
+
"type": "screenshot",
|
| 153 |
+
"data": frame,
|
| 154 |
+
"ts": int(time.time() * 1000),
|
| 155 |
+
"auto": True
|
| 156 |
+
}))
|
| 157 |
|
| 158 |
# ββ MOUSE MOVE βββββββββββββββββββββββββββββββββββ
|
| 159 |
elif action == "mouse_move":
|
|
|
|
| 231 |
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL
|
| 232 |
)
|
| 233 |
await ws.send_text(json.dumps({"type": "ack", "action": "open_app"}))
|
| 234 |
+
# Auto-screenshot after app opens (wait for it to load)
|
| 235 |
+
await asyncio.sleep(3)
|
| 236 |
+
frame = capture_screen(scale=0.7, quality=70)
|
| 237 |
+
if frame:
|
| 238 |
+
await ws.send_text(json.dumps({
|
| 239 |
+
"type": "screenshot",
|
| 240 |
+
"data": frame,
|
| 241 |
+
"ts": int(time.time() * 1000),
|
| 242 |
+
"auto": True
|
| 243 |
+
}))
|
| 244 |
|
| 245 |
# ββ START STREAM βββββββββββββββββββββββββββββββββ
|
| 246 |
elif action == "start_stream":
|