BG5 commited on
Commit
485b40c
·
verified ·
1 Parent(s): e0272ca

Update api.txt

Browse files
Files changed (1) hide show
  1. api.txt +3 -1
api.txt CHANGED
@@ -370,7 +370,9 @@ async def open_browser(request: Request):
370
  resp = await client.get(f"http://127.0.0.1:{port}/json/version")
371
  if resp.status_code == 200:
372
  browser_info = resp.json()
373
- ws_url = browser_info.get("webSocketDebuggerUrl").replace("ws://127.0.0.1", "wss://0.0.0.0")
 
 
374
  # 去掉端口号
375
  ws_url = re.sub(r":\d+", "", ws_url)
376
  logger.info(f"Browser opened with ID: {browser_id}, Info: {browser_info}")
 
370
  resp = await client.get(f"http://127.0.0.1:{port}/json/version")
371
  if resp.status_code == 200:
372
  browser_info = resp.json()
373
+ # 获取纯域名 (不带端口)
374
+ hostname = request.url.hostname
375
+ ws_url = browser_info.get("webSocketDebuggerUrl").replace("ws://127.0.0.1", f"wss://hostname")
376
  # 去掉端口号
377
  ws_url = re.sub(r":\d+", "", ws_url)
378
  logger.info(f"Browser opened with ID: {browser_id}, Info: {browser_info}")