notebooklm-mcp-server 1.1.0 → 1.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/dist/auth.js +39 -12
- package/dist/index.js +1 -1
- package/dist/server.js +1 -1
- package/package.json +1 -1
package/dist/auth.js
CHANGED
|
@@ -25,22 +25,49 @@ export class AuthManager {
|
|
|
25
25
|
let isDone = false;
|
|
26
26
|
try {
|
|
27
27
|
await Promise.race([
|
|
28
|
-
//
|
|
28
|
+
// 1. Entering the app (notebook view or dashboard)
|
|
29
29
|
page.waitForURL(url => url.origin === 'https://notebooklm.google.com' &&
|
|
30
30
|
(url.pathname.includes('/notebook') || url.pathname === '/'), { timeout: 300000 }).then(() => { isDone = true; }),
|
|
31
|
-
//
|
|
32
|
-
page.waitForSelector('
|
|
31
|
+
// 2. Main app structure (main role, notebook grid, or aria-labels)
|
|
32
|
+
page.waitForSelector('div[role="main"], .notebook-grid, [aria-label*="Notebook"], [aria-label*="notebook"]', { timeout: 300000 })
|
|
33
33
|
.then(() => { isDone = true; }),
|
|
34
|
-
//
|
|
35
|
-
page.
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
34
|
+
// 3. Account indicators (profile pic, logout links)
|
|
35
|
+
page.waitForSelector('button[aria-haspopup="true"] img[src*="googleusercontent.com"], a[href*="logout"], a[href*="Logout"]', { timeout: 300000 })
|
|
36
|
+
.then(() => { isDone = true; }),
|
|
37
|
+
// 4. Fallback: check session cookies (language neutral)
|
|
38
|
+
new Promise((resolve) => {
|
|
39
|
+
const checkLoop = async () => {
|
|
40
|
+
if (isDone)
|
|
41
|
+
return;
|
|
42
|
+
try {
|
|
43
|
+
const cookies = await context.cookies();
|
|
44
|
+
const sid = cookies.find(c => c.name === '__Secure-3PSID' || c.name === 'SID');
|
|
45
|
+
if (sid && page.url().includes('notebooklm.google.com')) {
|
|
46
|
+
isDone = true;
|
|
47
|
+
resolve(true);
|
|
48
|
+
}
|
|
49
|
+
else {
|
|
50
|
+
if (!isDone)
|
|
51
|
+
setTimeout(checkLoop, 2000);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
catch (e) {
|
|
55
|
+
isDone = true;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
checkLoop();
|
|
59
|
+
})
|
|
41
60
|
]);
|
|
42
|
-
//
|
|
43
|
-
await
|
|
61
|
+
// Ensure we actually have cookies before proceeding
|
|
62
|
+
const finalCookies = await context.cookies();
|
|
63
|
+
const hasSid = finalCookies.some(c => c.name === '__Secure-3PSID' || c.name === 'SID');
|
|
64
|
+
if (!hasSid) {
|
|
65
|
+
// If we don't have session cookies, we might have just landed on the landing page
|
|
66
|
+
// Wait a bit more or throw to avoid saving empty/expired sessions
|
|
67
|
+
if (onStatus)
|
|
68
|
+
onStatus('Verifying session session...');
|
|
69
|
+
await page.waitForTimeout(3000);
|
|
70
|
+
}
|
|
44
71
|
}
|
|
45
72
|
catch (e) {
|
|
46
73
|
throw new Error('Authentication timed out or browser was closed.');
|
package/dist/index.js
CHANGED
package/dist/server.js
CHANGED