cdp-tunnel 2.10.0 → 2.10.1
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.
package/package.json
CHANGED
package/server/proxy-server.js
CHANGED
|
@@ -1165,6 +1165,16 @@ function forwardToPlugin(clientWs, data, clientId) {
|
|
|
1165
1165
|
* 处理 CDP 客户端连接 (Playwright/Puppeteer)
|
|
1166
1166
|
*/
|
|
1167
1167
|
function handleClientConnection(ws, clientInfo, customClientId = null, targetPluginId = null, mode = 'create') {
|
|
1168
|
+
if (mode === 'takeover') {
|
|
1169
|
+
for (const client of clientConnections) {
|
|
1170
|
+
if (client.mode === 'takeover' && client.readyState === WebSocket.OPEN) {
|
|
1171
|
+
console.log('[TAKEOVER] Rejected: takeover mode already has a connected client');
|
|
1172
|
+
ws.close(1008, 'Takeover mode already in use. Only one client allowed.');
|
|
1173
|
+
return;
|
|
1174
|
+
}
|
|
1175
|
+
}
|
|
1176
|
+
}
|
|
1177
|
+
|
|
1168
1178
|
clientConnections.add(ws);
|
|
1169
1179
|
const id = customClientId || generateId('client');
|
|
1170
1180
|
ws.mode = mode;
|