@xbrowser/cli 1.34.0 → 1.35.0
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/dist/{browser-GXL6V2JW.js → browser-KY7AIRAB.js} +3 -2
- package/dist/{browser-ZWEJ663M.js → browser-MLKP72XP.js} +3 -3
- package/dist/{browser-X7LO42UI.js → browser-RZ7DPBI3.js} +3 -3
- package/dist/cdp-driver-CCG3OJUQ.js +49 -0
- package/dist/{cdp-driver-GCFEMRFJ.js → cdp-driver-HBMCD7NU.js} +2 -2
- package/dist/{cdp-driver-QOUSRPR2.js → cdp-driver-MJD7YIQI.js} +2 -2
- package/dist/{cdp-driver-4MNHDU2J.js → cdp-driver-YJU4GRSV.js} +196 -95
- package/dist/chunk-3SZTCI33.js +147 -0
- package/dist/{chunk-DZ6XEPAH.js → chunk-43U5VDLB.js} +8 -2
- package/dist/chunk-53VZHESL.js +150 -0
- package/dist/{chunk-NAIHOVDZ.js → chunk-63526WET.js} +2 -8
- package/dist/{chunk-YIL44YDX.js → chunk-6DS3T6UK.js} +196 -95
- package/dist/{chunk-N7DFS4V7.js → chunk-BLCBCESM.js} +8 -2
- package/dist/{chunk-SH6OTPXN.js → chunk-C5ZPXPD7.js} +31 -7
- package/dist/chunk-EGOWDZXP.js +149 -0
- package/dist/chunk-GNLZWHSP.js +1380 -0
- package/dist/{chunk-3E6VVMK2.js → chunk-GYGVHWG3.js} +272 -1460
- package/dist/{chunk-2KPI5GKP.js → chunk-IYCB2KJL.js} +2 -8
- package/dist/chunk-JYYKMSFH.js +39 -0
- package/dist/{chunk-TBJUSUKF.js → chunk-NBT2CE3H.js} +140 -96
- package/dist/{chunk-J4NOL5XX.js → chunk-QRFM4NOV.js} +1025 -202
- package/dist/chunk-RGL2YTWQ.js +64 -0
- package/dist/{chunk-BND5O5KC.js → chunk-SQLICOPZ.js} +177 -240
- package/dist/{chunk-O5PASNI7.js → chunk-UUW5EGES.js} +139 -237
- package/dist/{chunk-43TEMG4U.js → chunk-WGS3Y6ZV.js} +3 -1
- package/dist/{chunk-R57Z5KZX.js → chunk-Y2GRCINH.js} +1004 -183
- package/dist/{chunk-R7AG7ONI.js → chunk-ZCZELQCS.js} +196 -95
- package/dist/cli.js +2237 -278
- package/dist/{daemon-client-7D6EZNOE.js → daemon-client-OXKRGLPQ.js} +32 -8
- package/dist/{daemon-client-HEGAXWGK.js → daemon-client-Z3NKNZRL.js} +5 -1
- package/dist/daemon-main.js +2214 -159
- package/dist/human-interaction-BGAZC3JR.js +12 -0
- package/dist/human-interaction-TPKPEE7A.js +11 -0
- package/dist/human-interaction-ZSD3IX6Q.js +12 -0
- package/dist/index.d.ts +225 -94
- package/dist/index.js +2880 -267
- package/dist/{launcher-TOLF23ET.js → launcher-AUJK5QQM.js} +1 -1
- package/dist/{launcher-ZYB32LSZ.js → launcher-QBAZ6F5L.js} +1 -1
- package/dist/mistake-ledger-2B4N54CO.js +29 -0
- package/dist/{recovery-ORHJSBDN.js → recovery-5AGY7CV3.js} +4 -5
- package/dist/{recovery-JFGV3DBX.js → recovery-7NRRHLS4.js} +4 -4
- package/dist/{recovery-XDKN63O5.js → recovery-TIBRFGRP.js} +4 -4
- package/dist/run-routes-SJKVZ34L.js +26 -0
- package/dist/run-routes-TFNV5BBR.js +24 -0
- package/dist/{server-5U56MQD2.js → server-HUSX7EFE.js} +5 -4
- package/dist/{server-R4OYD7ZC.js → server-KSP5H4HD.js} +5 -3
- package/dist/{session-replayer-GHEFFNGV.js → session-replayer-4TCLQI76.js} +1 -1
- package/dist/viewer-routes-YOS5GTCV.js +11 -0
- package/package.json +1 -1
- package/dist/chunk-QCV2PI7U.js +0 -184
- package/dist/human-interaction-ISMMOJOK.js +0 -8
- package/dist/human-interaction-STTZZZ5N.js +0 -8
- package/dist/human-interaction-UXFYV7DU.js +0 -8
|
@@ -95,17 +95,11 @@ async function launchChrome(options = {}) {
|
|
|
95
95
|
}
|
|
96
96
|
const port = await findFreePort();
|
|
97
97
|
const allArgs = [
|
|
98
|
+
...DEFAULT_ARGS,
|
|
98
99
|
`--remote-debugging-port=${port}`,
|
|
99
100
|
"--remote-allow-origins=*",
|
|
100
|
-
"--no-sandbox",
|
|
101
|
-
"--no-first-run",
|
|
102
|
-
"--no-default-browser-check",
|
|
103
101
|
"--disable-session-crashed-bubble",
|
|
104
|
-
"--disable-
|
|
105
|
-
"--disable-backgrounding-occluded-windows",
|
|
106
|
-
"--disable-renderer-backgrounding",
|
|
107
|
-
"--disable-features=Translate,PasswordLeakDetection",
|
|
108
|
-
"--disable-popup-blocking"
|
|
102
|
+
"--disable-features=Translate,PasswordLeakDetection"
|
|
109
103
|
];
|
|
110
104
|
if (headless) {
|
|
111
105
|
allArgs.push("--headless", "--hide-scrollbars", "--mute-audio");
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import {
|
|
2
|
+
outputResult
|
|
3
|
+
} from "./chunk-RGL2YTWQ.js";
|
|
4
|
+
import {
|
|
5
|
+
forwardViewerCheckSelector
|
|
6
|
+
} from "./chunk-C5ZPXPD7.js";
|
|
7
|
+
import {
|
|
8
|
+
getDaemonConfig,
|
|
9
|
+
getDaemonProcessStatus,
|
|
10
|
+
startDaemonProcess
|
|
11
|
+
} from "./chunk-Q2DFJQGS.js";
|
|
12
|
+
|
|
13
|
+
// src/cli/viewer-routes.ts
|
|
14
|
+
async function handleViewer(_args, options, mode, _cdpEndpoint) {
|
|
15
|
+
const name = options.session || process.env.XBROWSER_SESSION || "default";
|
|
16
|
+
const selector = options.selector;
|
|
17
|
+
const userPort = options.port ? Number(options.port) : void 0;
|
|
18
|
+
let status = getDaemonProcessStatus();
|
|
19
|
+
if (!status.running) {
|
|
20
|
+
await startDaemonProcess(userPort || 9224);
|
|
21
|
+
status = getDaemonProcessStatus();
|
|
22
|
+
}
|
|
23
|
+
const port = userPort || status.port || getDaemonConfig().basePort;
|
|
24
|
+
let url = `http://localhost:${port}/preview/${name}`;
|
|
25
|
+
if (selector) {
|
|
26
|
+
try {
|
|
27
|
+
const resp = await forwardViewerCheckSelector(name, selector);
|
|
28
|
+
if (resp.found) {
|
|
29
|
+
url += `#focus=${encodeURIComponent(selector)}`;
|
|
30
|
+
}
|
|
31
|
+
} catch {
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
outputResult({ url, name, focused: !!selector && url.includes("#focus=") }, mode);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export {
|
|
38
|
+
handleViewer
|
|
39
|
+
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
|
-
ScreencastCapturer,
|
|
3
2
|
getCaptchaConfig
|
|
4
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-ZTHE5RBZ.js";
|
|
5
4
|
|
|
6
5
|
// src/human-interaction.ts
|
|
7
6
|
import { execFile } from "child_process";
|
|
@@ -177,27 +176,52 @@ var WebhookNotifier = class {
|
|
|
177
176
|
};
|
|
178
177
|
|
|
179
178
|
// src/human-interaction.ts
|
|
179
|
+
var DEFAULT_HUMAN_INTERACTION_SESSION = "default";
|
|
180
|
+
var activeWaitsByServer = /* @__PURE__ */ new WeakMap();
|
|
181
|
+
function acquireWaitSlot(server, sessionName) {
|
|
182
|
+
let sessions = activeWaitsByServer.get(server);
|
|
183
|
+
if (!sessions) {
|
|
184
|
+
sessions = /* @__PURE__ */ new Map();
|
|
185
|
+
activeWaitsByServer.set(server, sessions);
|
|
186
|
+
}
|
|
187
|
+
if (sessions.has(sessionName)) return false;
|
|
188
|
+
sessions.set(sessionName, "starting");
|
|
189
|
+
return true;
|
|
190
|
+
}
|
|
191
|
+
function releaseWaitSlot(server, sessionName) {
|
|
192
|
+
activeWaitsByServer.get(server)?.delete(sessionName);
|
|
193
|
+
}
|
|
194
|
+
function isHumanWaitActive(server, sessionName) {
|
|
195
|
+
return activeWaitsByServer.get(server)?.get(sessionName) === "waiting";
|
|
196
|
+
}
|
|
180
197
|
var HumanInteractionManager = class {
|
|
181
198
|
wsServer;
|
|
182
199
|
page;
|
|
183
|
-
|
|
200
|
+
sessionName;
|
|
184
201
|
webhook;
|
|
185
202
|
autoOpen;
|
|
186
|
-
constructor(wsServer, page) {
|
|
203
|
+
constructor(wsServer, page, sessionName) {
|
|
187
204
|
this.wsServer = wsServer;
|
|
188
205
|
this.page = page;
|
|
189
|
-
this.
|
|
206
|
+
this.sessionName = sessionName && sessionName.trim() ? sessionName.trim() : DEFAULT_HUMAN_INTERACTION_SESSION;
|
|
190
207
|
const cfg = getCaptchaConfig();
|
|
191
208
|
this.webhook = new WebhookNotifier(cfg.notifyUrl);
|
|
192
209
|
this.autoOpen = cfg.autoOpen;
|
|
193
|
-
this.wsServer.registerSession(
|
|
210
|
+
this.wsServer.registerSession(this.sessionName, page);
|
|
211
|
+
}
|
|
212
|
+
/** The named session this manager interacts with. */
|
|
213
|
+
get session() {
|
|
214
|
+
return this.sessionName;
|
|
215
|
+
}
|
|
216
|
+
buildPreviewUrl() {
|
|
217
|
+
return `http://localhost:${this.wsServer.getPort()}/preview/${encodeURIComponent(this.sessionName)}`;
|
|
194
218
|
}
|
|
195
219
|
async sendWebhook(event, overrides = {}) {
|
|
196
220
|
await this.webhook.notify({
|
|
197
221
|
event,
|
|
198
222
|
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
199
223
|
url: this.page.url(),
|
|
200
|
-
previewUrl:
|
|
224
|
+
previewUrl: this.buildPreviewUrl(),
|
|
201
225
|
...overrides
|
|
202
226
|
});
|
|
203
227
|
}
|
|
@@ -214,11 +238,16 @@ var HumanInteractionManager = class {
|
|
|
214
238
|
/**
|
|
215
239
|
* Wait for a human to solve a CAPTCHA or complete an interaction.
|
|
216
240
|
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
241
|
+
* Sends session-scoped notifications and waits for CAPTCHA resolution
|
|
242
|
+
* or a manual solve signal from a viewer bound to this session.
|
|
243
|
+
*
|
|
244
|
+
* Only one wait may be in flight per session per WSServer. The wait
|
|
245
|
+
* slot, listener, and timers are cleaned
|
|
246
|
+
* up on every exit path (auto-detected / preview / timeout / error).
|
|
219
247
|
*
|
|
220
248
|
* @param options - Configuration for timeout, auto-detection, and reason text.
|
|
221
249
|
* @returns Result indicating whether the CAPTCHA was solved and by what method.
|
|
250
|
+
* @throws If a wait is already in progress for this session.
|
|
222
251
|
*/
|
|
223
252
|
async waitForHuman(options = {}) {
|
|
224
253
|
const {
|
|
@@ -227,102 +256,117 @@ var HumanInteractionManager = class {
|
|
|
227
256
|
autoDetect = true,
|
|
228
257
|
detectInterval = 2e3
|
|
229
258
|
} = options;
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
url: frame.url,
|
|
241
|
-
viewport: frame.viewport
|
|
242
|
-
}
|
|
243
|
-
});
|
|
244
|
-
});
|
|
245
|
-
const previewUrl = `http://localhost:${this.wsServer.getPort()}`;
|
|
246
|
-
await this.sendWebhook("captcha-detected", {
|
|
247
|
-
reason: captchaInfo ? `${captchaInfo.type ?? "unknown"} CAPTCHA detected` : reason,
|
|
248
|
-
timeout,
|
|
249
|
-
targetUrl: this.page.url()
|
|
250
|
-
});
|
|
251
|
-
this.wsServer.broadcast({
|
|
252
|
-
type: "captcha-detected",
|
|
253
|
-
sessionId: "default",
|
|
254
|
-
url: this.page.url(),
|
|
255
|
-
reason: captchaInfo ? `${captchaInfo.type ?? "unknown"} CAPTCHA detected` : reason,
|
|
256
|
-
timeout
|
|
257
|
-
});
|
|
258
|
-
this.tryAutoOpen(previewUrl);
|
|
259
|
-
console.log("");
|
|
260
|
-
console.log("\u26A0\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
261
|
-
console.log(`\u26A0\uFE0F ${captchaInfo ? (captchaInfo.type ?? "UNKNOWN").toUpperCase() + " CAPTCHA" : "INTERACTION"} REQUIRED`);
|
|
262
|
-
console.log(`\u26A0\uFE0F URL: ${this.page.url()}`);
|
|
263
|
-
console.log(`\u26A0\uFE0F `);
|
|
264
|
-
console.log(`\u26A0\uFE0F Solve via:`);
|
|
265
|
-
console.log(`\u26A0\uFE0F \u{1F4FA} Preview: ${previewUrl}`);
|
|
266
|
-
console.log(`\u26A0\uFE0F \u{1F310} Direct: ${this.page.url()}`);
|
|
267
|
-
console.log(`\u26A0\uFE0F \u23ED\uFE0F Skip`);
|
|
268
|
-
console.log(`\u26A0\uFE0F \u274C Abort`);
|
|
269
|
-
console.log(`\u26A0\uFE0F `);
|
|
270
|
-
console.log(`\u26A0\uFE0F \u23F3 Waiting... (${timeout}s timeout)`);
|
|
271
|
-
console.log("\u26A0\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
272
|
-
console.log("");
|
|
273
|
-
return new Promise((resolve) => {
|
|
274
|
-
let resolved = false;
|
|
275
|
-
let pollTimer = null;
|
|
276
|
-
let timeoutTimer = null;
|
|
277
|
-
const cleanup = () => {
|
|
278
|
-
if (pollTimer) clearInterval(pollTimer);
|
|
279
|
-
if (timeoutTimer) clearTimeout(timeoutTimer);
|
|
280
|
-
this.wsServer.removeListener("human-solved", onHumanSolved);
|
|
281
|
-
this.capturer.stopCapture();
|
|
282
|
-
};
|
|
283
|
-
if (autoDetect && captchaInfo) {
|
|
284
|
-
pollTimer = setInterval(async () => {
|
|
285
|
-
if (resolved) return;
|
|
286
|
-
try {
|
|
287
|
-
const solved = await CaptchaDetector.isSolved(this.page, captchaInfo.selector);
|
|
288
|
-
if (solved) {
|
|
289
|
-
resolved = true;
|
|
290
|
-
cleanup();
|
|
291
|
-
this.wsServer.broadcast({ type: "resolved", sessionId: "default" });
|
|
292
|
-
console.log("\u2705 CAPTCHA auto-detected as solved!");
|
|
293
|
-
this.sendWebhook("captcha-resolved", { reason: "auto-detected" });
|
|
294
|
-
resolve({ solved: true, method: "auto-detected" });
|
|
295
|
-
}
|
|
296
|
-
} catch {
|
|
297
|
-
}
|
|
298
|
-
}, detectInterval);
|
|
259
|
+
if (!acquireWaitSlot(this.wsServer, this.sessionName)) {
|
|
260
|
+
throw new Error(
|
|
261
|
+
`waitForHuman already in progress for session "${this.sessionName}" \u2014 only one human-interaction wait per session is allowed`
|
|
262
|
+
);
|
|
263
|
+
}
|
|
264
|
+
let slotReleased = false;
|
|
265
|
+
const releaseSlot = () => {
|
|
266
|
+
if (!slotReleased) {
|
|
267
|
+
slotReleased = true;
|
|
268
|
+
releaseWaitSlot(this.wsServer, this.sessionName);
|
|
299
269
|
}
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
270
|
+
};
|
|
271
|
+
try {
|
|
272
|
+
const captcha = await CaptchaDetector.detect(this.page);
|
|
273
|
+
const captchaInfo = captcha.detected ? captcha : void 0;
|
|
274
|
+
const previewUrl = this.buildPreviewUrl();
|
|
275
|
+
const waitReason = captchaInfo ? `${captchaInfo.type ?? "unknown"} CAPTCHA detected` : reason;
|
|
276
|
+
console.log("");
|
|
277
|
+
console.log("\u26A0\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
278
|
+
console.log(`\u26A0\uFE0F ${captchaInfo ? (captchaInfo.type ?? "UNKNOWN").toUpperCase() + " CAPTCHA" : "INTERACTION"} REQUIRED (session: ${this.sessionName})`);
|
|
279
|
+
console.log(`\u26A0\uFE0F URL: ${this.page.url()}`);
|
|
280
|
+
console.log(`\u26A0\uFE0F `);
|
|
281
|
+
console.log(`\u26A0\uFE0F Solve via:`);
|
|
282
|
+
console.log(`\u26A0\uFE0F \u{1F4FA} Preview: ${previewUrl}`);
|
|
283
|
+
console.log(`\u26A0\uFE0F \u{1F310} Direct: ${this.page.url()}`);
|
|
284
|
+
console.log(`\u26A0\uFE0F \u23ED\uFE0F Skip`);
|
|
285
|
+
console.log(`\u26A0\uFE0F \u274C Abort`);
|
|
286
|
+
console.log(`\u26A0\uFE0F `);
|
|
287
|
+
console.log(`\u26A0\uFE0F \u23F3 Waiting... (${timeout}s timeout)`);
|
|
288
|
+
console.log("\u26A0\uFE0F \u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550\u2550");
|
|
289
|
+
console.log("");
|
|
290
|
+
return await new Promise((resolve) => {
|
|
291
|
+
let resolved = false;
|
|
292
|
+
let pollTimer = null;
|
|
293
|
+
let timeoutTimer = null;
|
|
294
|
+
const cleanup = () => {
|
|
295
|
+
if (pollTimer) clearInterval(pollTimer);
|
|
296
|
+
if (timeoutTimer) clearTimeout(timeoutTimer);
|
|
297
|
+
this.wsServer.removeListener("human-solved", onHumanSolved);
|
|
298
|
+
releaseSlot();
|
|
299
|
+
};
|
|
300
|
+
if (autoDetect && captchaInfo) {
|
|
301
|
+
pollTimer = setInterval(async () => {
|
|
302
|
+
if (resolved) return;
|
|
303
|
+
try {
|
|
304
|
+
const solved = await CaptchaDetector.isSolved(this.page, captchaInfo.selector);
|
|
305
|
+
if (solved && !resolved) {
|
|
306
|
+
resolved = true;
|
|
307
|
+
cleanup();
|
|
308
|
+
this.wsServer.broadcastToSession(this.sessionName, {
|
|
309
|
+
type: "resolved",
|
|
310
|
+
sessionId: this.sessionName
|
|
311
|
+
});
|
|
312
|
+
console.log("\u2705 CAPTCHA auto-detected as solved!");
|
|
313
|
+
this.sendWebhook("captcha-resolved", { reason: "auto-detected" });
|
|
314
|
+
resolve({ solved: true, method: "auto-detected" });
|
|
315
|
+
}
|
|
316
|
+
} catch {
|
|
317
|
+
}
|
|
318
|
+
}, detectInterval);
|
|
308
319
|
}
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
if (timeout > 0) {
|
|
312
|
-
timeoutTimer = setTimeout(() => {
|
|
320
|
+
const onHumanSolved = (payload) => {
|
|
321
|
+
if (!payload || payload.sessionId !== this.sessionName) return;
|
|
313
322
|
if (!resolved) {
|
|
314
323
|
resolved = true;
|
|
315
324
|
cleanup();
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
325
|
+
this.wsServer.broadcastToSession(this.sessionName, {
|
|
326
|
+
type: "resolved",
|
|
327
|
+
sessionId: this.sessionName
|
|
328
|
+
});
|
|
329
|
+
console.log("\u2705 CAPTCHA solved via preview!");
|
|
330
|
+
this.sendWebhook("captcha-resolved", { reason: "preview" });
|
|
331
|
+
resolve({ solved: true, method: "preview" });
|
|
319
332
|
}
|
|
320
|
-
}
|
|
321
|
-
|
|
322
|
-
|
|
333
|
+
};
|
|
334
|
+
this.wsServer.on("human-solved", onHumanSolved);
|
|
335
|
+
if (timeout > 0) {
|
|
336
|
+
timeoutTimer = setTimeout(() => {
|
|
337
|
+
if (!resolved) {
|
|
338
|
+
resolved = true;
|
|
339
|
+
cleanup();
|
|
340
|
+
this.wsServer.broadcastToSession(this.sessionName, {
|
|
341
|
+
type: "handoff-timeout",
|
|
342
|
+
sessionId: this.sessionName
|
|
343
|
+
});
|
|
344
|
+
console.log("\u23F0 Timeout - skipping");
|
|
345
|
+
this.sendWebhook("captcha-resolved", { reason: "timeout" });
|
|
346
|
+
resolve({ solved: false, method: "timeout" });
|
|
347
|
+
}
|
|
348
|
+
}, timeout * 1e3);
|
|
349
|
+
}
|
|
350
|
+
activeWaitsByServer.get(this.wsServer)?.set(this.sessionName, "waiting");
|
|
351
|
+
this.wsServer.broadcastToSession(this.sessionName, {
|
|
352
|
+
type: "captcha-detected",
|
|
353
|
+
sessionId: this.sessionName,
|
|
354
|
+
url: this.page.url(),
|
|
355
|
+
reason: waitReason,
|
|
356
|
+
timeout
|
|
357
|
+
});
|
|
358
|
+
void this.sendWebhook("captcha-detected", { reason: waitReason, timeout, targetUrl: this.page.url() });
|
|
359
|
+
this.tryAutoOpen(previewUrl);
|
|
360
|
+
});
|
|
361
|
+
} catch (err) {
|
|
362
|
+
releaseSlot();
|
|
363
|
+
throw err;
|
|
364
|
+
}
|
|
323
365
|
}
|
|
324
366
|
};
|
|
325
367
|
|
|
326
368
|
export {
|
|
369
|
+
DEFAULT_HUMAN_INTERACTION_SESSION,
|
|
370
|
+
isHumanWaitActive,
|
|
327
371
|
HumanInteractionManager
|
|
328
372
|
};
|