@lightcone-ai/daemon 0.9.36 → 0.9.38

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.
@@ -33,8 +33,15 @@ export class XhsAdapter {
33
33
  }
34
34
 
35
35
  async checkLoginStatus() {
36
- const result = await this._cdp.send('Network.getAllCookies', {});
37
- return (result.cookies ?? []).some(c => c.name === 'web_session' && c.value?.length > 0);
36
+ // Navigate to publish page — if redirected away, session is expired
37
+ await this._cdp.send('Page.navigate', { url: 'https://creator.xiaohongshu.com/publish/publish' });
38
+ await sleep(4000);
39
+ const result = await this._cdp.send('Runtime.evaluate', {
40
+ expression: 'window.location.href',
41
+ returnByValue: true,
42
+ });
43
+ const url = result.result?.value ?? '';
44
+ return url.includes('creator.xiaohongshu.com/publish');
38
45
  }
39
46
 
40
47
  async publishImageText({ title, text, tags = [], images = [] }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lightcone-ai/daemon",
3
- "version": "0.9.36",
3
+ "version": "0.9.38",
4
4
  "type": "module",
5
5
  "main": "src/index.js",
6
6
  "bin": {
@@ -105,12 +105,7 @@ export class BrowserLoginSession {
105
105
  '--disable-infobars',
106
106
  '--user-agent=Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36',
107
107
  'about:blank',
108
- ], { stdio: ['ignore', 'ignore', 'pipe'], detached: false });
109
-
110
- this._proc.stderr.on('data', (data) => {
111
- const text = data.toString().trim();
112
- if (text) console.error(`[BrowserLogin][${this._platform}] Chrome stderr: ${text.slice(0, 300)}`);
113
- });
108
+ ], { stdio: 'ignore', detached: false });
114
109
 
115
110
  this._proc.on('error', (err) => {
116
111
  console.error(`[BrowserLogin][${this._platform}] Chrome spawn error: ${err.message}`);