Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1091,14 +1091,14 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1091 |
"stderr": res.get("stderr", ""),
|
| 1092 |
"returncode": res["returncode"],
|
| 1093 |
})
|
| 1094 |
-
|
| 1095 |
|
| 1096 |
# โโ mouse_move โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1097 |
elif action == "mouse_move":
|
| 1098 |
x, y = int(data.get("x", 0)), int(data.get("y", 0))
|
| 1099 |
await xdo(["mousemove", "--sync", str(x), str(y)], display)
|
| 1100 |
await send({"type": "ack", "action": "mouse_move", "x": x, "y": y})
|
| 1101 |
-
|
| 1102 |
|
| 1103 |
# โโ mouse_click โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1104 |
elif action == "mouse_click":
|
|
@@ -1113,7 +1113,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1113 |
await xdo(["click", btn], display)
|
| 1114 |
btn_name = {"1": "left", "2": "middle", "3": "right"}.get(btn, "left")
|
| 1115 |
await send({"type": "ack", "action": "mouse_click", "x": x, "y": y, "button": btn_name})
|
| 1116 |
-
|
| 1117 |
|
| 1118 |
# โโ mouse_drag โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1119 |
elif action == "mouse_drag":
|
|
@@ -1126,7 +1126,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1126 |
await asyncio.sleep(0.1)
|
| 1127 |
await xdo(["mouseup", "1"], display)
|
| 1128 |
await send({"type": "ack", "action": "mouse_drag"})
|
| 1129 |
-
|
| 1130 |
|
| 1131 |
# โโ keyboard_type โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1132 |
elif action == "keyboard_type":
|
|
@@ -1134,7 +1134,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1134 |
if text:
|
| 1135 |
res = await type_smart(text, display)
|
| 1136 |
await send({"type": "ack", "action": "keyboard_type", "method": res["method"]})
|
| 1137 |
-
|
| 1138 |
|
| 1139 |
# โโ keyboard_hotkey โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1140 |
elif action == "keyboard_hotkey":
|
|
@@ -1142,7 +1142,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1142 |
if keys:
|
| 1143 |
await xdo(["key", "--clearmodifiers", "+".join(keys)], display)
|
| 1144 |
await send({"type": "ack", "action": "keyboard_hotkey", "keys": keys})
|
| 1145 |
-
|
| 1146 |
|
| 1147 |
# โโ keyboard_press โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1148 |
elif action == "keyboard_press":
|
|
@@ -1150,7 +1150,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1150 |
if key:
|
| 1151 |
await xdo(["key", "--clearmodifiers", key], display)
|
| 1152 |
await send({"type": "ack", "action": "keyboard_press"})
|
| 1153 |
-
|
| 1154 |
|
| 1155 |
# โโ scroll โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1156 |
elif action == "scroll":
|
|
@@ -1162,7 +1162,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1162 |
await xdo(["click", btn], display)
|
| 1163 |
await asyncio.sleep(0.025)
|
| 1164 |
await send({"type": "ack", "action": "scroll", "clicks": clicks})
|
| 1165 |
-
|
| 1166 |
|
| 1167 |
# โโ clipboard_write โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1168 |
elif action == "clipboard_write":
|
|
@@ -1191,7 +1191,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1191 |
await asyncio.sleep(0.1)
|
| 1192 |
await xdo(["key", "--clearmodifiers", "ctrl+v"], display)
|
| 1193 |
await send({"type": "ack", "action": "paste"})
|
| 1194 |
-
|
| 1195 |
|
| 1196 |
# โโ open_app โโโโโโโโโ๏ฟฝ๏ฟฝโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1197 |
elif action == "open_app":
|
|
@@ -1220,12 +1220,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1220 |
if sess["user_id"] in _user_displays:
|
| 1221 |
_user_displays[sess["user_id"]]["browser_proc"] = proc
|
| 1222 |
await send({"type": "ack", "action": "open_app", "cmd": cmd})
|
| 1223 |
-
|
| 1224 |
-
await asyncio.sleep(3.0)
|
| 1225 |
-
await shot_explicit("app opening 3s")
|
| 1226 |
-
await asyncio.sleep(5.0)
|
| 1227 |
-
await shot_explicit("app loaded 8s")
|
| 1228 |
-
asyncio.create_task(_open_app_shots())
|
| 1229 |
|
| 1230 |
# โโ open_browser โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1231 |
elif action == "open_browser":
|
|
@@ -1249,12 +1244,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1249 |
if sess["user_id"] in _user_displays:
|
| 1250 |
_user_displays[sess["user_id"]]["browser_proc"] = proc
|
| 1251 |
await send({"type": "ack", "action": "open_browser", "url": url})
|
| 1252 |
-
|
| 1253 |
-
await asyncio.sleep(3.0)
|
| 1254 |
-
await shot_explicit("browser opening 3s")
|
| 1255 |
-
await asyncio.sleep(6.0)
|
| 1256 |
-
await shot_explicit("browser loaded 9s")
|
| 1257 |
-
asyncio.create_task(_open_browser_shots())
|
| 1258 |
|
| 1259 |
# โโ open_tab โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1260 |
elif action == "open_tab":
|
|
@@ -1273,25 +1263,25 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1273 |
await asyncio.sleep(0.3)
|
| 1274 |
await xdo(["key", "--clearmodifiers", "Return"], display)
|
| 1275 |
await send({"type": "ack", "action": "open_tab", "url": url})
|
| 1276 |
-
|
| 1277 |
|
| 1278 |
# โโ close_tab โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1279 |
elif action == "close_tab":
|
| 1280 |
await xdo(["key", "--clearmodifiers", "ctrl+w"], display)
|
| 1281 |
await send({"type": "ack", "action": "close_tab"})
|
| 1282 |
-
|
| 1283 |
|
| 1284 |
# โโ browser_back โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1285 |
elif action == "browser_back":
|
| 1286 |
await xdo(["key", "--clearmodifiers", "alt+Left"], display)
|
| 1287 |
await send({"type": "ack", "action": "browser_back"})
|
| 1288 |
-
|
| 1289 |
|
| 1290 |
# โโ browser_forward โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1291 |
elif action == "browser_forward":
|
| 1292 |
await xdo(["key", "--clearmodifiers", "alt+Right"], display)
|
| 1293 |
await send({"type": "ack", "action": "browser_forward"})
|
| 1294 |
-
|
| 1295 |
|
| 1296 |
# โโ browser_search โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1297 |
elif action == "browser_search":
|
|
@@ -1302,7 +1292,7 @@ async def handle_action(ws: WebSocket, msg: dict, sess: dict):
|
|
| 1302 |
await asyncio.sleep(0.15)
|
| 1303 |
await xdo(["key", "--clearmodifiers", "Return"], display)
|
| 1304 |
await send({"type": "ack", "action": "browser_search"})
|
| 1305 |
-
|
| 1306 |
|
| 1307 |
# โโ screen_info โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1308 |
elif action == "screen_info":
|
|
|
|
| 1091 |
"stderr": res.get("stderr", ""),
|
| 1092 |
"returncode": res["returncode"],
|
| 1093 |
})
|
| 1094 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู: ูุง ุชูุคุฎุฐ ููุทุฉ ุดุงุดุฉ ุฅูุง ุจุทูุจ ุตุฑูุญ โโ
|
| 1095 |
|
| 1096 |
# โโ mouse_move โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1097 |
elif action == "mouse_move":
|
| 1098 |
x, y = int(data.get("x", 0)), int(data.get("y", 0))
|
| 1099 |
await xdo(["mousemove", "--sync", str(x), str(y)], display)
|
| 1100 |
await send({"type": "ack", "action": "mouse_move", "x": x, "y": y})
|
| 1101 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1102 |
|
| 1103 |
# โโ mouse_click โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1104 |
elif action == "mouse_click":
|
|
|
|
| 1113 |
await xdo(["click", btn], display)
|
| 1114 |
btn_name = {"1": "left", "2": "middle", "3": "right"}.get(btn, "left")
|
| 1115 |
await send({"type": "ack", "action": "mouse_click", "x": x, "y": y, "button": btn_name})
|
| 1116 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1117 |
|
| 1118 |
# โโ mouse_drag โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1119 |
elif action == "mouse_drag":
|
|
|
|
| 1126 |
await asyncio.sleep(0.1)
|
| 1127 |
await xdo(["mouseup", "1"], display)
|
| 1128 |
await send({"type": "ack", "action": "mouse_drag"})
|
| 1129 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1130 |
|
| 1131 |
# โโ keyboard_type โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1132 |
elif action == "keyboard_type":
|
|
|
|
| 1134 |
if text:
|
| 1135 |
res = await type_smart(text, display)
|
| 1136 |
await send({"type": "ack", "action": "keyboard_type", "method": res["method"]})
|
| 1137 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1138 |
|
| 1139 |
# โโ keyboard_hotkey โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1140 |
elif action == "keyboard_hotkey":
|
|
|
|
| 1142 |
if keys:
|
| 1143 |
await xdo(["key", "--clearmodifiers", "+".join(keys)], display)
|
| 1144 |
await send({"type": "ack", "action": "keyboard_hotkey", "keys": keys})
|
| 1145 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1146 |
|
| 1147 |
# โโ keyboard_press โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1148 |
elif action == "keyboard_press":
|
|
|
|
| 1150 |
if key:
|
| 1151 |
await xdo(["key", "--clearmodifiers", key], display)
|
| 1152 |
await send({"type": "ack", "action": "keyboard_press"})
|
| 1153 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1154 |
|
| 1155 |
# โโ scroll โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1156 |
elif action == "scroll":
|
|
|
|
| 1162 |
await xdo(["click", btn], display)
|
| 1163 |
await asyncio.sleep(0.025)
|
| 1164 |
await send({"type": "ack", "action": "scroll", "clicks": clicks})
|
| 1165 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1166 |
|
| 1167 |
# โโ clipboard_write โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1168 |
elif action == "clipboard_write":
|
|
|
|
| 1191 |
await asyncio.sleep(0.1)
|
| 1192 |
await xdo(["key", "--clearmodifiers", "ctrl+v"], display)
|
| 1193 |
await send({"type": "ack", "action": "paste"})
|
| 1194 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1195 |
|
| 1196 |
# โโ open_app โโโโโโโโโ๏ฟฝ๏ฟฝโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1197 |
elif action == "open_app":
|
|
|
|
| 1220 |
if sess["user_id"] in _user_displays:
|
| 1221 |
_user_displays[sess["user_id"]]["browser_proc"] = proc
|
| 1222 |
await send({"type": "ack", "action": "open_app", "cmd": cmd})
|
| 1223 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู ุจุนุฏ ูุชุญ ุงูุชุทุจูู โโ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1224 |
|
| 1225 |
# โโ open_browser โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1226 |
elif action == "open_browser":
|
|
|
|
| 1244 |
if sess["user_id"] in _user_displays:
|
| 1245 |
_user_displays[sess["user_id"]]["browser_proc"] = proc
|
| 1246 |
await send({"type": "ack", "action": "open_browser", "url": url})
|
| 1247 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู ุจุนุฏ ูุชุญ ุงูู
ุชุตูุญ โโ
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1248 |
|
| 1249 |
# โโ open_tab โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1250 |
elif action == "open_tab":
|
|
|
|
| 1263 |
await asyncio.sleep(0.3)
|
| 1264 |
await xdo(["key", "--clearmodifiers", "Return"], display)
|
| 1265 |
await send({"type": "ack", "action": "open_tab", "url": url})
|
| 1266 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1267 |
|
| 1268 |
# โโ close_tab โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1269 |
elif action == "close_tab":
|
| 1270 |
await xdo(["key", "--clearmodifiers", "ctrl+w"], display)
|
| 1271 |
await send({"type": "ack", "action": "close_tab"})
|
| 1272 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1273 |
|
| 1274 |
# โโ browser_back โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1275 |
elif action == "browser_back":
|
| 1276 |
await xdo(["key", "--clearmodifiers", "alt+Left"], display)
|
| 1277 |
await send({"type": "ack", "action": "browser_back"})
|
| 1278 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1279 |
|
| 1280 |
# โโ browser_forward โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1281 |
elif action == "browser_forward":
|
| 1282 |
await xdo(["key", "--clearmodifiers", "alt+Right"], display)
|
| 1283 |
await send({"type": "ack", "action": "browser_forward"})
|
| 1284 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1285 |
|
| 1286 |
# โโ browser_search โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1287 |
elif action == "browser_search":
|
|
|
|
| 1292 |
await asyncio.sleep(0.15)
|
| 1293 |
await xdo(["key", "--clearmodifiers", "Return"], display)
|
| 1294 |
await send({"type": "ack", "action": "browser_search"})
|
| 1295 |
+
# โโ ุชุนุทูู ุงูุงูุชูุงุท ุงูุชููุงุฆู โโ
|
| 1296 |
|
| 1297 |
# โโ screen_info โโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโโ
|
| 1298 |
elif action == "screen_info":
|