cdp-tunnel 3.2.1 → 3.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "manifest_version": 3,
3
3
  "name": "CDP Bridge",
4
- "version": "3.2.1",
4
+ "version": "3.2.3",
5
5
  "description": "Chrome DevTools Protocol Bridge for Playwright/Puppeteer automation",
6
6
  "permissions": [
7
7
  "debugger",
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cdp-tunnel",
3
- "version": "3.2.1",
3
+ "version": "3.2.3",
4
4
  "description": "Bridge Chrome's debugger API to WebSocket — control your existing browser with Playwright/Puppeteer via CDP",
5
5
  "main": "server/proxy-server.js",
6
6
  "bin": "./cli/index.js",
@@ -150,10 +150,20 @@ class PortPoolManager {
150
150
  }
151
151
 
152
152
  if (path === '/json' || path === '/json/list') {
153
- // 只返回这个端口的 target(从主 proxy 拿全量后过滤)
154
- const allTargets = await this.mainProxy.getAllTargets(session.portIndex);
153
+ // 返回这个端口创建的 tab 列表
154
+ // session.targetIds 构建(这些是 createTarget 时记录的)
155
+ const targets = [];
156
+ for (const targetId of session.targetIds) {
157
+ targets.push({
158
+ id: targetId,
159
+ type: 'page',
160
+ url: 'about:blank',
161
+ title: '',
162
+ webSocketDebuggerUrl: `ws://localhost:${session.port}/devtools/page/${targetId}`
163
+ });
164
+ }
155
165
  res.writeHead(200, { 'Content-Type': 'application/json' });
156
- res.end(JSON.stringify(allTargets));
166
+ res.end(JSON.stringify(targets));
157
167
  return;
158
168
  }
159
169
 
@@ -277,6 +287,9 @@ class PortPoolManager {
277
287
 
278
288
  // 恢复原始 id,发给发起请求的 client
279
289
  const response = { ...msg, id: this._parseOriginalId(originalId) };
290
+ delete response.__portIndex;
291
+ delete response.__clientId;
292
+ delete response.type;
280
293
  if (pending && pending.clientWs && pending.clientWs.readyState === WebSocket.OPEN) {
281
294
  pending.clientWs.send(JSON.stringify(response));
282
295
  } else {