Update api.txt
Browse files
api.txt
CHANGED
|
@@ -305,7 +305,8 @@ async def system_usage():
|
|
| 305 |
try:
|
| 306 |
usage_info = get_system_usage()
|
| 307 |
response_data = {"success": True, "msg": "success", "data": usage_info}
|
| 308 |
-
return encrypt_json_response(response_data)
|
|
|
|
| 309 |
except Exception as e:
|
| 310 |
logger.error(f"获取系统资源使用情况失败: {e}")
|
| 311 |
error_data = {"success": False, "msg": "failed", "error": str(e)}
|
|
@@ -386,7 +387,8 @@ async def close_browser(request: Request):
|
|
| 386 |
b = BROWSERS.get(browser_id)
|
| 387 |
if not b:
|
| 388 |
error_data = {"success": False, "msg": "not found"}
|
| 389 |
-
return encrypt_json_response(error_data)
|
|
|
|
| 390 |
b["process"].terminate()
|
| 391 |
b["status"] = "closed"
|
| 392 |
response_data = {"success": True, "msg": "closed", "data": {"id": browser_id}}
|
|
@@ -402,7 +404,8 @@ async def delete_browser(request: Request):
|
|
| 402 |
b = BROWSERS.pop(browser_id, None)
|
| 403 |
if not b:
|
| 404 |
error_data = {"success": False, "msg": "not found"}
|
| 405 |
-
return encrypt_json_response(error_data)
|
|
|
|
| 406 |
try:
|
| 407 |
b["process"].terminate()
|
| 408 |
except Exception:
|
|
@@ -437,7 +440,8 @@ async def browser_ports():
|
|
| 437 |
# 返回 {id: port} 格式
|
| 438 |
data = {k: str(v["ws"]) for k, v in BROWSERS.items() if v["status"] == "open"}
|
| 439 |
response_data = {"success": True, "data": data}
|
| 440 |
-
return encrypt_json_response(response_data)
|
|
|
|
| 441 |
|
| 442 |
|
| 443 |
@app.post("/health")
|
|
|
|
| 305 |
try:
|
| 306 |
usage_info = get_system_usage()
|
| 307 |
response_data = {"success": True, "msg": "success", "data": usage_info}
|
| 308 |
+
#return encrypt_json_response(response_data)
|
| 309 |
+
return response_data
|
| 310 |
except Exception as e:
|
| 311 |
logger.error(f"获取系统资源使用情况失败: {e}")
|
| 312 |
error_data = {"success": False, "msg": "failed", "error": str(e)}
|
|
|
|
| 387 |
b = BROWSERS.get(browser_id)
|
| 388 |
if not b:
|
| 389 |
error_data = {"success": False, "msg": "not found"}
|
| 390 |
+
#return encrypt_json_response(error_data)
|
| 391 |
+
return error_data
|
| 392 |
b["process"].terminate()
|
| 393 |
b["status"] = "closed"
|
| 394 |
response_data = {"success": True, "msg": "closed", "data": {"id": browser_id}}
|
|
|
|
| 404 |
b = BROWSERS.pop(browser_id, None)
|
| 405 |
if not b:
|
| 406 |
error_data = {"success": False, "msg": "not found"}
|
| 407 |
+
#return encrypt_json_response(error_data)
|
| 408 |
+
return error_data
|
| 409 |
try:
|
| 410 |
b["process"].terminate()
|
| 411 |
except Exception:
|
|
|
|
| 440 |
# 返回 {id: port} 格式
|
| 441 |
data = {k: str(v["ws"]) for k, v in BROWSERS.items() if v["status"] == "open"}
|
| 442 |
response_data = {"success": True, "data": data}
|
| 443 |
+
#return encrypt_json_response(response_data)
|
| 444 |
+
return error_data
|
| 445 |
|
| 446 |
|
| 447 |
@app.post("/health")
|