Add Twitter and LinkedIn publishers with Playwright sidecars

- Create twitter-post sidecar with Playwright for browser automation
- Create linkedin-post sidecar with Playwright for browser automation
- Add TwitterPublisher class that calls twitter-post sidecar
- Add LinkedInPublisher class that calls linkedin-post sidecar
- Register both publishers in PublisherManager via AppServiceProvider
- Update Posts index view to show Publish button for twitter/linkedin types

Both publishers use the same pattern as RedditPublisher:
- No API keys required (uses stored credentials from Social Accounts)
- Browser automation via Playwright
- Returns JSON result with success/failure and URL

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
m105
2026-07-27 21:08:39 +03:00
parent 2a41328130
commit 44f979820f
16 changed files with 604 additions and 1 deletions
+27
View File
@@ -0,0 +1,27 @@
# Twitter/X Post Sidecar
A Playwright acceptance test that logs into Twitter/X with supplied credentials and creates a post.
## One-time setup
cd sidecars/twitter-post
npm install
npx playwright install chromium
## Usage
./run.sh --username=YOUR_USERNAME --password=YOUR_PASSWORD \
--tweet="Your tweet text here" [--headed]
Prints a single JSON line to stdout and exits 0 on success, exits 1 on failure:
{"success": true, "url": "https://twitter.com/username/status/..."}
{"success": false, "error": "Login failed: Invalid credentials"}
## Notes
- On a failed run, Playwright retains a screenshot and trace under `test-results/` for debugging.
These are gitignored and not committed, but they persist on disk.
- Twitter's UI changes frequently. If posting fails, check the selectors in `tests/twitter-post.spec.js`
and update them using: `npx playwright codegen https://twitter.com/i/flow/login`
- Twitter may show CAPTCHAs or 2FA prompts which will cause the automation to fail.