notebooklm-mcp-server 1.0.7 → 1.0.8
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/auth.js +19 -8
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -23,23 +23,33 @@ export class AuthManager {
|
|
|
23
23
|
onStatus('Waiting for Google Login...');
|
|
24
24
|
// Wait for the user to be logged in.
|
|
25
25
|
// We check for either the URL pattern or the presence of session cookies
|
|
26
|
+
let isDone = false;
|
|
26
27
|
try {
|
|
27
28
|
await Promise.race([
|
|
28
|
-
page.waitForURL('**/notebook/**', { timeout: 300000 }),
|
|
29
|
+
page.waitForURL('**/notebook/**', { timeout: 300000 }).then(() => { isDone = true; }),
|
|
29
30
|
page.waitForFunction(() => {
|
|
30
31
|
return window.location.href.includes('notebooklm.google.com') &&
|
|
31
32
|
!document.body.innerText.includes('Sign in');
|
|
32
|
-
}, { polling: 2000, timeout: 300000 }),
|
|
33
|
+
}, { polling: 2000, timeout: 300000 }).then(() => { isDone = true; }),
|
|
33
34
|
// Fallback: check if we have the critical cookies
|
|
34
35
|
new Promise((resolve) => {
|
|
35
36
|
const checkCookies = async () => {
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
37
|
+
if (isDone)
|
|
38
|
+
return;
|
|
39
|
+
try {
|
|
40
|
+
const cookies = await context.cookies();
|
|
41
|
+
const sessionCookie = cookies.find(c => c.name === '__Secure-3PSID' || c.name === 'SID');
|
|
42
|
+
if (sessionCookie && page.url().includes('notebooklm.google.com')) {
|
|
43
|
+
isDone = true;
|
|
44
|
+
resolve(true);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
setTimeout(checkCookies, 2000);
|
|
48
|
+
}
|
|
40
49
|
}
|
|
41
|
-
|
|
42
|
-
|
|
50
|
+
catch (e) {
|
|
51
|
+
// Browser might be closed, just stop
|
|
52
|
+
isDone = true;
|
|
43
53
|
}
|
|
44
54
|
};
|
|
45
55
|
checkCookies();
|
|
@@ -47,6 +57,7 @@ export class AuthManager {
|
|
|
47
57
|
]);
|
|
48
58
|
}
|
|
49
59
|
catch (e) {
|
|
60
|
+
isDone = true;
|
|
50
61
|
await browser.close();
|
|
51
62
|
throw new Error('Authentication timed out or browser was closed.');
|
|
52
63
|
}
|
package/dist/index.js
CHANGED
package/dist/server.js
CHANGED