Spaces:
BG5
/
Running

BG5 commited on
Commit
00398ed
·
verified ·
1 Parent(s): f366d38

Update api.py

Browse files
Files changed (1) hide show
  1. api.py +6 -5
api.py CHANGED
@@ -169,6 +169,12 @@ def get_default_launch_args():
169
  "--no-first-run",
170
  "--no-default-browser-check",
171
  "--remote-allow-origins=*",
 
 
 
 
 
 
172
  "--headless"
173
  ]
174
 
@@ -251,16 +257,11 @@ async def open_browser(request: Request):
251
  resp = await client.get(f"http://127.0.0.1:{port}/json/version")
252
  if resp.status_code == 200:
253
  browser_info = resp.json()
254
- logger.info(f"Browser opened with ID: {browser_id},port: {port}, Info: {browser_info}")
255
  ws_url = browser_info.get("webSocketDebuggerUrl").replace("ws://127.0.0.1", "wss://0.0.0.0")
256
  # 去掉端口号
257
  ws_url = re.sub(r":\d+", "", ws_url)
258
- browser_info["webSocketDebuggerUrl"] = ws_url
259
  logger.info(f"Browser opened with ID: {browser_id}, Info: {browser_info}")
260
- logger.info(f'port1111: {port}, ws_url: {ws_url}')
261
-
262
  BROWSERS[browser_id] = {"process": proc, "ws": ws_url, "port": port, "status": "open", "info": browser_info}
263
- logger.info(f'port2222: {port}, ws_url: {ws_url}')
264
  return {"success": True, "msg": "success", "data": {"id": browser_id, "ws": ws_url}, "info": browser_info}
265
 
266
 
 
169
  "--no-first-run",
170
  "--no-default-browser-check",
171
  "--remote-allow-origins=*",
172
+ "--incognito",
173
+ "--disable-blink-features=AutomationControlled",
174
+ "--disable-notifications",
175
+ "--disable-popup-blocking",
176
+ "--disable-infobars",
177
+ "--disable-features=TranslateUI,NotificationIndicator",
178
  "--headless"
179
  ]
180
 
 
257
  resp = await client.get(f"http://127.0.0.1:{port}/json/version")
258
  if resp.status_code == 200:
259
  browser_info = resp.json()
 
260
  ws_url = browser_info.get("webSocketDebuggerUrl").replace("ws://127.0.0.1", "wss://0.0.0.0")
261
  # 去掉端口号
262
  ws_url = re.sub(r":\d+", "", ws_url)
 
263
  logger.info(f"Browser opened with ID: {browser_id}, Info: {browser_info}")
 
 
264
  BROWSERS[browser_id] = {"process": proc, "ws": ws_url, "port": port, "status": "open", "info": browser_info}
 
265
  return {"success": True, "msg": "success", "data": {"id": browser_id, "ws": ws_url}, "info": browser_info}
266
 
267