THEZYZSTUDIO commited on
Commit
f1d2b34
Β·
verified Β·
1 Parent(s): ec1f651

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
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
- result = capture_screen_with_grid(scale=0.65, quality=72,
769
- force_mx=force_mx, force_my=force_my)
 
 
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 = capture_screen_with_grid(scale=0.65, quality=75)
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 = run_command_smart(cmd, timeout=timeout)
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 = capture_screen_with_grid(scale=0.65, quality=72)
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",