cdp-tunnel 2.4.2 → 2.4.4
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/cli/index.js
CHANGED
|
@@ -204,11 +204,10 @@ function startServer(port, watchdog, autoRestart) {
|
|
|
204
204
|
}
|
|
205
205
|
|
|
206
206
|
console.log('');
|
|
207
|
-
log('yellow', '⚠ 服务器异常退出 (' + reason + '),
|
|
207
|
+
log('yellow', '⚠ 服务器异常退出 (' + reason + '),5 秒后自动重启...');
|
|
208
208
|
console.log(' 重启次数: ' + restartTimestamps.length + '/' + MAX_RESTARTS + ' (60秒内)');
|
|
209
209
|
console.log('');
|
|
210
210
|
|
|
211
|
-
// Kill any leftover process occupying the port before restarting
|
|
212
211
|
try {
|
|
213
212
|
const result = execSync(`lsof -ti:${port} 2>/dev/null || true`).toString().trim();
|
|
214
213
|
if (result) {
|
|
@@ -220,7 +219,7 @@ function startServer(port, watchdog, autoRestart) {
|
|
|
220
219
|
}
|
|
221
220
|
} catch {}
|
|
222
221
|
|
|
223
|
-
setTimeout(() => startServer(port, true, autoRestart),
|
|
222
|
+
setTimeout(() => startServer(port, true, autoRestart), 5000);
|
|
224
223
|
});
|
|
225
224
|
|
|
226
225
|
process.on('SIGINT', () => {
|
|
@@ -24,6 +24,9 @@ var WebSocketManager = (function() {
|
|
|
24
24
|
State.clearReconnectTimer();
|
|
25
25
|
processQueue();
|
|
26
26
|
broadcastStateUpdate();
|
|
27
|
+
var extVersion = (typeof chrome !== 'undefined' && chrome.runtime && chrome.runtime.getManifest)
|
|
28
|
+
? chrome.runtime.getManifest().version : 'unknown';
|
|
29
|
+
send({ type: 'plugin-hello', version: extVersion });
|
|
27
30
|
};
|
|
28
31
|
|
|
29
32
|
ws.onclose = function(event) {
|
package/package.json
CHANGED
package/server/proxy-server.js
CHANGED
|
@@ -448,6 +448,21 @@ function handlePluginConnection(ws, clientInfo) {
|
|
|
448
448
|
logConnectionEvent('KEEPALIVE_RECEIVED', { type: 'plugin', id: ws.id });
|
|
449
449
|
return;
|
|
450
450
|
}
|
|
451
|
+
|
|
452
|
+
if (parsed && parsed.type === 'plugin-hello') {
|
|
453
|
+
const extVersion = parsed.version || 'unknown';
|
|
454
|
+
ws.extVersion = extVersion;
|
|
455
|
+
const match = extVersion === PKG_VERSION;
|
|
456
|
+
const level = match ? 'info' : 'warn';
|
|
457
|
+
const label = match ? '✅' : '⚠️ VERSION MISMATCH';
|
|
458
|
+
const msg = `[VERSION CHECK] ${label} server=${PKG_VERSION} extension=${extVersion}`;
|
|
459
|
+
console.log(msg);
|
|
460
|
+
logCDP('VERSION', msg);
|
|
461
|
+
if (!match) {
|
|
462
|
+
console.log(` ↳ Run "cdp-tunnel update" or reload the extension to sync versions`);
|
|
463
|
+
}
|
|
464
|
+
return;
|
|
465
|
+
}
|
|
451
466
|
|
|
452
467
|
// 调试:打印所有收到的消息
|
|
453
468
|
console.log(`[PLUGIN MSG] id=${parsed?.id} method=${parsed?.method || 'none'} type=${parsed?.type || 'none'} sessionId=${parsed?.sessionId?.substring(0,8) || 'none'}`);
|