fix(baoyu-post-to-x): keep browser open for manual publishing

This commit is contained in:
Jim Liu 宝玉
2026-03-07 16:10:19 -06:00
parent 4435366898
commit 4300e6899c
4 changed files with 12 additions and 11 deletions
+6 -2
View File
@@ -98,9 +98,13 @@ Checks: Chrome, profile isolation, Bun, Accessibility, clipboard, paste keystrok
---
## Regular Posts
## Post Type Selection
Text + up to 4 images.
Unless the user explicitly specifies the post type:
- **Plain text** + within 10,000 characters → **Regular Post** (Premium members support up to 10,000 characters, non-Premium: 280)
- **Markdown file** (.md) → **X Article**
## Regular Posts
```bash
${BUN_X} ${SKILL_DIR}/scripts/x-browser.ts "Hello!" --image ./photo.png
+2 -9
View File
@@ -187,20 +187,13 @@ export async function postToX(options: XBrowserOptions): Promise<void> {
await sleep(2000);
console.log('[x-browser] Post submitted!');
} else {
console.log('[x-browser] Post composed (preview mode). Add --submit to post.');
console.log('[x-browser] Browser will stay open for 30 seconds for preview...');
await sleep(30_000);
console.log('[x-browser] Post composed. Please review and click the publish button in the browser.');
}
} finally {
if (cdp) {
try { await cdp.send('Browser.close', {}, { timeoutMs: 5_000 }); } catch {}
cdp.close();
}
setTimeout(() => {
if (!chrome.killed) try { chrome.kill('SIGKILL'); } catch {}
}, 2_000).unref?.();
try { chrome.kill('SIGTERM'); } catch {}
chrome.unref();
}
}