Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -765,8 +765,10 @@ async def handle_action(ws: WebSocket, msg: dict):
|
|
| 765 |
Ψ¨Ψ―ΩΨ§Ω Ω
Ω Ψ₯ΨΉΨ§Ψ―Ψ© ΩΨ±Ψ§Ψ‘ΨͺΩ Ω
Ω X server β ΩΩΨ΅ΩΨ race condition.
|
| 766 |
"""
|
| 767 |
await asyncio.sleep(delay)
|
| 768 |
-
|
| 769 |
-
|
|
|
|
|
|
|
| 770 |
if result["data"]:
|
| 771 |
await send({
|
| 772 |
"type": "screenshot",
|
|
@@ -784,7 +786,7 @@ async def handle_action(ws: WebSocket, msg: dict):
|
|
| 784 |
|
| 785 |
# ββ screenshot ββββββββββββββββββββββββββββββββββββ
|
| 786 |
if action == "screenshot":
|
| 787 |
-
result =
|
| 788 |
await send({
|
| 789 |
"type": "screenshot",
|
| 790 |
"data": result["data"],
|
|
@@ -823,7 +825,7 @@ async def handle_action(ws: WebSocket, msg: dict):
|
|
| 823 |
await send({"type": "terminal_result", "cmd": "", "stdout": "",
|
| 824 |
"stderr": "no command", "returncode": -1})
|
| 825 |
return
|
| 826 |
-
res =
|
| 827 |
await send({
|
| 828 |
"type": "terminal_result",
|
| 829 |
"cmd": cmd,
|
|
@@ -1040,7 +1042,7 @@ async def websocket_endpoint(ws: WebSocket):
|
|
| 1040 |
]
|
| 1041 |
}, ensure_ascii=False))
|
| 1042 |
# Ψ£Ψ±Ψ³Ω screenshot Ψ£ΩΩΩΨ© Ω
ΨΉ grid
|
| 1043 |
-
result =
|
| 1044 |
if result["data"]:
|
| 1045 |
await ws.send_text(json.dumps({
|
| 1046 |
"type": "screenshot",
|
|
|
|
| 765 |
Ψ¨Ψ―ΩΨ§Ω Ω
Ω Ψ₯ΨΉΨ§Ψ―Ψ© ΩΨ±Ψ§Ψ‘ΨͺΩ Ω
Ω X server β ΩΩΨ΅ΩΨ race condition.
|
| 766 |
"""
|
| 767 |
await asyncio.sleep(delay)
|
| 768 |
+
# ββ ΩΨΉΩ
Ω ΩΩ thread Ω
ΩΩΨ΅Ω ΨΨͺΩ ΩΨ§ ΩΩΨ¬Ω
ΩΨ― ΨΩΩΨ© asyncio ββ
|
| 769 |
+
result = await asyncio.to_thread(
|
| 770 |
+
capture_screen_with_grid, scale=0.65, quality=72,
|
| 771 |
+
force_mx=force_mx, force_my=force_my)
|
| 772 |
if result["data"]:
|
| 773 |
await send({
|
| 774 |
"type": "screenshot",
|
|
|
|
| 786 |
|
| 787 |
# ββ screenshot ββββββββββββββββββββββββββββββββββββ
|
| 788 |
if action == "screenshot":
|
| 789 |
+
result = await asyncio.to_thread(capture_screen_with_grid, scale=0.65, quality=75)
|
| 790 |
await send({
|
| 791 |
"type": "screenshot",
|
| 792 |
"data": result["data"],
|
|
|
|
| 825 |
await send({"type": "terminal_result", "cmd": "", "stdout": "",
|
| 826 |
"stderr": "no command", "returncode": -1})
|
| 827 |
return
|
| 828 |
+
res = await asyncio.to_thread(run_command_smart, cmd, timeout)
|
| 829 |
await send({
|
| 830 |
"type": "terminal_result",
|
| 831 |
"cmd": cmd,
|
|
|
|
| 1042 |
]
|
| 1043 |
}, ensure_ascii=False))
|
| 1044 |
# Ψ£Ψ±Ψ³Ω screenshot Ψ£ΩΩΩΨ© Ω
ΨΉ grid
|
| 1045 |
+
result = await asyncio.to_thread(capture_screen_with_grid, scale=0.65, quality=72)
|
| 1046 |
if result["data"]:
|
| 1047 |
await ws.send_text(json.dumps({
|
| 1048 |
"type": "screenshot",
|