@lightcone-ai/daemon 0.9.40 → 0.9.42
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/browser-login.js +17 -4
package/package.json
CHANGED
package/src/browser-login.js
CHANGED
|
@@ -17,7 +17,11 @@ export const PLATFORM_CONFIGS = {
|
|
|
17
17
|
xhs: {
|
|
18
18
|
loginUrl: 'https://www.xiaohongshu.com',
|
|
19
19
|
isLoggedIn: (cookies) => cookies.some(c => c.name === 'web_session' && c.value?.length > 0),
|
|
20
|
-
|
|
20
|
+
// Both domain variants to cover host-only and domain cookies
|
|
21
|
+
sessionCookies: [
|
|
22
|
+
{ name: 'web_session', domain: '.xiaohongshu.com' },
|
|
23
|
+
{ name: 'web_session', domain: 'www.xiaohongshu.com' },
|
|
24
|
+
],
|
|
21
25
|
},
|
|
22
26
|
douyin: {
|
|
23
27
|
loginUrl: 'https://www.douyin.com',
|
|
@@ -26,7 +30,9 @@ export const PLATFORM_CONFIGS = {
|
|
|
26
30
|
),
|
|
27
31
|
sessionCookies: [
|
|
28
32
|
{ name: 'sessionid', domain: '.douyin.com' },
|
|
33
|
+
{ name: 'sessionid', domain: 'www.douyin.com' },
|
|
29
34
|
{ name: 'sid_guard', domain: '.douyin.com' },
|
|
35
|
+
{ name: 'sid_guard', domain: 'www.douyin.com' },
|
|
30
36
|
],
|
|
31
37
|
},
|
|
32
38
|
kuaishou: {
|
|
@@ -36,7 +42,9 @@ export const PLATFORM_CONFIGS = {
|
|
|
36
42
|
),
|
|
37
43
|
sessionCookies: [
|
|
38
44
|
{ name: 'userId', domain: '.kuaishou.com' },
|
|
45
|
+
{ name: 'userId', domain: 'www.kuaishou.com' },
|
|
39
46
|
{ name: 'passToken', domain: '.kuaishou.com' },
|
|
47
|
+
{ name: 'passToken', domain: 'www.kuaishou.com' },
|
|
40
48
|
],
|
|
41
49
|
},
|
|
42
50
|
};
|
|
@@ -106,6 +114,14 @@ export class BrowserLoginSession {
|
|
|
106
114
|
// Ensure profile dir exists
|
|
107
115
|
try { mkdirSync(this._profileDir, { recursive: true }); } catch {}
|
|
108
116
|
|
|
117
|
+
// Delete the Cookies file before Chrome starts so stale session cookies can't fool the login check
|
|
118
|
+
for (const cookiePath of [
|
|
119
|
+
path.join(this._profileDir, 'Default', 'Cookies'),
|
|
120
|
+
path.join(this._profileDir, 'Cookies'),
|
|
121
|
+
]) {
|
|
122
|
+
try { if (existsSync(cookiePath)) rmSync(cookiePath, { force: true }); } catch {}
|
|
123
|
+
}
|
|
124
|
+
|
|
109
125
|
// Kill any process holding the CDP port
|
|
110
126
|
try {
|
|
111
127
|
if (process.platform !== 'win32') {
|
|
@@ -169,9 +185,6 @@ export class BrowserLoginSession {
|
|
|
169
185
|
source: `Object.defineProperty(navigator, 'webdriver', { get: () => undefined });`,
|
|
170
186
|
});
|
|
171
187
|
|
|
172
|
-
// Clear the session cookie so we only detect a *fresh* login, not stale cached cookies
|
|
173
|
-
await this._clearSessionCookies();
|
|
174
|
-
|
|
175
188
|
await this.send('Page.navigate', { url: this._config.loginUrl });
|
|
176
189
|
|
|
177
190
|
this._startPolling(connection);
|