MCPcopy Create free account
hub / github.com/SKVNDR/FastDork / applyImportStatus

Function applyImportStatus

Script/FastDork.js:2400–2464  ·  view source on GitHub ↗
(message, source = "updateImportStatus")

Source from the content-addressed store, hash-verified

2398 }
2399
2400 async function applyImportStatus(message, source = "updateImportStatus") {
2401 console.log(
2402 `[applyImportStatus:${source}] isImporting=${message.isImporting}, isPaused=${message.isPaused}, activeListKey=${message.activeListKey}`
2403 );
2404 const previouslyImporting = isCurrentlyAutoImporting;
2405 const previouslyPaused = isImportPaused;
2406 isCurrentlyAutoImporting = message.isImporting ?? false;
2407 isImportPaused = message.isPaused ?? false;
2408 if (!isCurrentlyAutoImporting) {
2409 isImportPaused = false;
2410 }
2411
2412 setManualImportButtonState(isCurrentlyAutoImporting, isImportPaused);
2413
2414 const isTab2Active = document
2415 .querySelector("#icetab-content > .tabcontent:nth-child(2)")
2416 ?.classList.contains("tab-active");
2417
2418 if (
2419 (isCurrentlyAutoImporting || isImportPaused) &&
2420 message.activeListKey &&
2421 !isTab2Active
2422 ) {
2423 const selected = await selectListAndRefreshTextarea(message.activeListKey, {
2424 switchToEditList: true,
2425 });
2426 if (!selected) {
2427 console.warn(
2428 `[applyImportStatus:${source}] Active list not found: ${message.activeListKey}`
2429 );
2430 } else {
2431 console.log(
2432 `[applyImportStatus:${source}] Selected active list ${message.activeListKey} and switched to Tab 2.`
2433 );
2434 }
2435 }
2436
2437 if (isImportPaused) {
2438 const captchaDetail = message.pausedTabId
2439 ? ` on tab ${message.pausedTabId}`
2440 : "";
2441 const reason = message.captchaReason
2442 ? `\nReason: ${message.captchaReason}`
2443 : "";
2444 showModal(
2445 `All remaining imports are waiting on CAPTCHA${captchaDetail}. Solve it in the highlighted tab, then FastDork will continue automatically.${reason}`,
2446 [],
2447 UI.settingsModal
2448 );
2449 }
2450
2451 if (!isCurrentlyAutoImporting && previouslyImporting && !previouslyPaused) {
2452 console.log(
2453 `[applyImportStatus:${source}] Import inactive, refreshing manual import context.`
2454 );
2455 try {
2456 await initializeImportButtonLogic(true);
2457 } catch (e) {

Callers 2

Calls 4

showModalFunction · 0.85

Tested by

no test coverage detected