@ubaidbinwaris/linkedin-login 2.1.0 → 2.1.2
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 +1 -1
- package/src/login/login.js +25 -4
package/package.json
CHANGED
package/src/login/login.js
CHANGED
|
@@ -86,10 +86,11 @@ async function loginToLinkedIn(options = {}, credentials = null) {
|
|
|
86
86
|
}
|
|
87
87
|
} else {
|
|
88
88
|
// Failed mobile verification.
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
89
|
+
// User Request: "otherwise after some delay using browser opens the browser and fill the form"
|
|
90
|
+
|
|
91
|
+
// If headless AND fallback is NOT disabled
|
|
92
|
+
if (options.headless && !options.disableFallback) {
|
|
93
|
+
logger.info("[Fallback] Mobile verification failed. Switching to VISIBLE browser for manual intervention...");
|
|
93
94
|
await browser.close();
|
|
94
95
|
|
|
95
96
|
// RE-LAUNCH in Visible Mode
|
|
@@ -127,6 +128,26 @@ async function loginToLinkedIn(options = {}, credentials = null) {
|
|
|
127
128
|
await visibleBrowser.close();
|
|
128
129
|
throw new Error("CHECKPOINT_DETECTED_M"); // M for manual failed
|
|
129
130
|
}
|
|
131
|
+
}
|
|
132
|
+
// IF ALREADY VISIBLE (Headless = false)
|
|
133
|
+
else if (!options.headless) {
|
|
134
|
+
logger.info(`[${email}] Checkpoint detected in VISIBLE mode. Waiting for user to solve...`);
|
|
135
|
+
try {
|
|
136
|
+
// Wait up to 5 minutes for manual resolution
|
|
137
|
+
await page.waitForFunction(() => {
|
|
138
|
+
return window.location.href.includes("/feed") ||
|
|
139
|
+
document.querySelector(".global-nav__search");
|
|
140
|
+
}, { timeout: 300000 });
|
|
141
|
+
|
|
142
|
+
if (page.url().includes("/feed") || await isLoggedIn(page)) {
|
|
143
|
+
logger.info(`[${email}] Manual Resolution Successful ✅`);
|
|
144
|
+
await saveSession(context, email, true);
|
|
145
|
+
return { browser, context, page };
|
|
146
|
+
}
|
|
147
|
+
} catch(e) {
|
|
148
|
+
logger.warn(`[Visible] Manual wait timeout: ${e.message}`);
|
|
149
|
+
// Fall through to error
|
|
150
|
+
}
|
|
130
151
|
}
|
|
131
152
|
|
|
132
153
|
const screenshotPath = `checkpoint_${email}_${Date.now()}.png`;
|