{"_id":"@drateberry/emdash-plugin-social-share","_rev":"2-47e66dc644abfc554465908968d91f82","name":"@drateberry/emdash-plugin-social-share","dist-tags":{"latest":"0.2.0"},"versions":{"0.1.0":{"name":"@drateberry/emdash-plugin-social-share","version":"0.1.0","keywords":["emdash","emdash-plugin","cms","social","sharing","bluesky","mastodon","twitter","x","cross-posting","fediverse","at-protocol"],"author":{"name":"Drate Berry"},"license":"0BSD","_id":"@drateberry/emdash-plugin-social-share@0.1.0","maintainers":[{"name":"drateberry","email":"drate@optimizepilot.com"}],"homepage":"https://github.com/drateberry/emdash-plugin-social-share#readme","bugs":{"url":"https://github.com/drateberry/emdash-plugin-social-share/issues"},"dist":{"shasum":"f06693d6c4bacdfd8166a79d326b8e68393c4ad3","tarball":"https://registry.npmjs.org/@drateberry/emdash-plugin-social-share/-/emdash-plugin-social-share-0.1.0.tgz","fileCount":7,"integrity":"sha512-cIzYJjAGjcIzldd2EwrvGf81HQ0t8RHN6aiMJ1egk5eX/mfIuR4WHi3NUvexmKeGV2gr6wT5p/U5i4GadWso1A==","signatures":[{"sig":"MEUCIQCjbrsse0QQxFSOWcobfwAr+3QYEWD6FxIVRIi0evxRvAIgUKjP29ok6bbOlKasBXzWHK/GQ8ML61Lfg1qxE5EaVaE=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":48385},"main":"./dist/index.mjs","type":"module","types":"./dist/index.d.mts","exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":"./dist/sandbox-entry.mjs"},"gitHead":"7fd1d73a17cb51658d2bad230c4f92ae0802d259","scripts":{"dev":"tsdown src/index.ts src/sandbox-entry.ts --format esm --dts --watch","build":"tsdown src/index.ts src/sandbox-entry.ts --format esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"_npmUser":{"name":"drateberry","email":"drate@optimizepilot.com"},"repository":{"url":"git+https://github.com/drateberry/emdash-plugin-social-share.git","type":"git"},"_npmVersion":"11.12.1","description":"Automatically share newly published EmDash CMS posts to Bluesky, Mastodon, and X (Twitter) with optional featured-image attachment.","directories":{},"_nodeVersion":"25.9.0","_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.20.3","typescript":"^5.9.3"},"peerDependencies":{"emdash":">=0.6.0"},"_npmOperationalInternal":{"tmp":"tmp/emdash-plugin-social-share_0.1.0_1776886339265_0.7508213430001256","host":"s3://npm-registry-packages-npm-production"}},"0.2.0":{"_id":"@drateberry/emdash-plugin-social-share@0.2.0","bugs":{"url":"https://github.com/drateberry/emdash-plugin-social-share/issues"},"dist":{"shasum":"a8f9fa6cdab20aad006204f6e9b200bcc05392f8","tarball":"https://registry.npmjs.org/@drateberry/emdash-plugin-social-share/-/emdash-plugin-social-share-0.2.0.tgz","fileCount":7,"integrity":"sha512-EDBjN5HNRIfk42ZLWmWcIn7D+VcTN7Rbc5qsx05FC+Go4M/xOWyN1UsEyPJNSRO9bqV9Tzld/qXiqPMsPd7Kqw==","signatures":[{"sig":"MEUCIQDk1J8z2/7FLfzSlYo456zsWSfQdSXTSoL33Fx4qJPICwIgJEOFrbj3HpgnqbhznPcD0R1luusNUKP4GAk+iNsWP9Y=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDpGle8Dfj5AhC59oBTHxaLc0sDUVB6gL5HSbqRkaVRwAIgTjKqICErMuibf6tjJJJwTJFtx4hMOK7Vj4gS1iiBFsQ="}],"unpackedSize":49317},"main":"./dist/index.mjs","name":"@drateberry/emdash-plugin-social-share","type":"module","types":"./dist/index.d.mts","author":{"name":"Drate Berry"},"exports":{".":{"types":"./dist/index.d.mts","import":"./dist/index.mjs"},"./sandbox":"./dist/sandbox-entry.mjs"},"gitHead":"59b8ce111ff2c044a5800da8267e8485c3b91c6b","license":"0BSD","scripts":{"dev":"tsdown src/index.ts src/sandbox-entry.ts --format esm --dts --watch","build":"tsdown src/index.ts src/sandbox-entry.ts --format esm --dts --clean","typecheck":"tsc --noEmit","prepublishOnly":"npm run build"},"version":"0.2.0","_npmUser":{"name":"drateberry","email":"drate@optimizepilot.com"},"homepage":"https://github.com/drateberry/emdash-plugin-social-share#readme","keywords":["emdash","emdash-plugin","cms","social","sharing","bluesky","mastodon","twitter","x","cross-posting","fediverse","at-protocol"],"repository":{"url":"git+https://github.com/drateberry/emdash-plugin-social-share.git","type":"git"},"_npmVersion":"11.19.1","description":"Automatically share newly published EmDash CMS posts to Bluesky, Mastodon, and X (Twitter) with optional featured-image attachment.","directories":{},"maintainers":[{"name":"drateberry","email":"drate@optimizepilot.com"}],"_nodeVersion":"26.10.0","_hasShrinkwrap":false,"devDependencies":{"tsdown":"^0.20.3","typescript":"^5.9.3"},"peerDependencies":{"emdash":">=1.2.0"},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/emdash-plugin-social-share_0.2.0_1791489873634_0.3479961389007258"}}},"time":{"created":"2026-04-22T19:32:19.172Z","modified":"2026-10-08T20:04:33.939Z","0.1.0":"2026-04-22T19:32:19.477Z","0.2.0":"2026-10-08T20:04:33.803Z"},"bugs":{"url":"https://github.com/drateberry/emdash-plugin-social-share/issues"},"author":{"name":"Drate Berry"},"license":"0BSD","homepage":"https://github.com/drateberry/emdash-plugin-social-share#readme","keywords":["emdash","emdash-plugin","cms","social","sharing","bluesky","mastodon","twitter","x","cross-posting","fediverse","at-protocol"],"repository":{"url":"git+https://github.com/drateberry/emdash-plugin-social-share.git","type":"git"},"description":"Automatically share newly published EmDash CMS posts to Bluesky, Mastodon, and X (Twitter) with optional featured-image attachment.","maintainers":[{"name":"drateberry","email":"drate@optimizepilot.com"}],"readme":"# @drateberry/emdash-plugin-social-share\n\nAutomatically share newly published [EmDash CMS](https://emdashcms.com/) posts to **Bluesky**, **Mastodon**, and **X** (Twitter), with optional featured-image attachment.\n\nPublishing a post fires one post per enabled network. Each share is deduped via the plugin's own storage collection, so re-publishing a post won't double-post unless you explicitly ask for it.\n\n## Features\n\n- **Three networks** — Bluesky (AT Protocol), Mastodon (any instance), X (OAuth 1.0a user context).\n- **Featured image attachment** — pulls from the post's SEO image (`content.seo.image`) if set, otherwise falls back to the `featured_image` field. Each network has its own size limit and the plugin skips attachment gracefully if the image is too large for a given platform.\n- **Per-network toggles** — enable/disable each network independently, and toggle image attachment per network.\n- **URL resolution** — reads the collection's `urlPattern` automatically. No plugin-side URL template to keep in sync.\n- **Collection filter** — choose which collections auto-share (default: `posts`).\n- **Template variables** — `{title}`, `{url}`, `{excerpt}`, `{tags}` with graceful truncation per platform's char limit.\n- **Delivery log** — admin page shows every share attempt with status and timestamps.\n- **Dedup** — won't double-post if you republish; uses a `shares` storage collection keyed by `postId + platform`.\n- **Test buttons** — per-network \"Test connection\" in the settings page for fast credential validation.\n\n## Install\n\n```bash\nnpm install @drateberry/emdash-plugin-social-share\n```\n\nRegister in `astro.config.mjs`:\n\n```ts\nimport { socialSharePlugin } from \"@drateberry/emdash-plugin-social-share\";\nimport emdash from \"emdash/astro\";\n\nexport default defineConfig({\n  integrations: [\n    emdash({\n      // ...your existing config\n      plugins: [socialSharePlugin()],\n    }),\n  ],\n});\n```\n\nRequires `emdash >=0.6.0`.\n\n## Configure\n\nOpen the admin at `/_emdash/admin/plugins/social-share/settings` and:\n\n1. Set which collections should auto-share (default: `posts`).\n2. Edit the status template (default: `{title}\\n\\n{url}`).\n3. Fill in credentials for each network you want to enable. See the sections below for how to obtain them.\n\n### Bluesky\n\n1. Go to [https://bsky.app/settings/app-passwords](https://bsky.app/settings/app-passwords).\n2. Create an app password. Give it any name.\n3. In the plugin settings, enable Bluesky, enter your handle (e.g. `yourname.bsky.social`), paste the app password.\n4. Click **Test Bluesky connection** → green toast means you're good.\n\n**Image limit:** 1 MB per image. Larger images are skipped (text-only post still goes out).\n\n### Mastodon\n\n1. Go to `https://{your-instance}/settings/applications` (e.g. `https://mastodon.social/settings/applications`).\n2. Create a new application with at least `write:statuses` scope (and `read` if you want the test button to work).\n3. Copy the **access token** (not the client secret).\n4. In the plugin settings, enable Mastodon, enter your instance hostname (`mastodon.social` — we add the `https://` for you), paste the access token.\n5. Click **Test Mastodon connection**.\n\n**Image limit:** 10 MB per image.\n\n### X (Twitter)\n\nX's API is now pay-per-use (no minimum spend, as of 2026). You still need a developer account and an App configured for OAuth 1.0a user context — the Bearer Token alone can't post.\n\n1. Create an App at [developer.x.com](https://developer.x.com).\n2. In the App → **User authentication settings** → Set up:\n   - Type: **OAuth 1.0a**\n   - App permissions: **Read and Write** (critical; default is Read only)\n   - Callback URL: any valid URL works (e.g. `http://localhost:4321/`) — we don't use the OAuth redirect flow\n3. Go to **Keys and tokens**:\n   - Copy the **API Key** and **API Key Secret** (under \"Consumer Keys\")\n   - Under \"Authentication Tokens\", **Generate** Access Token and Secret, copy both\n4. **Gotcha:** if you generated access tokens BEFORE setting permissions to Read+Write, regenerate them. Token scope is baked in at generation time.\n5. Paste all four values into the plugin settings, enable X, test.\n\n**Image limit:** 5 MB per image.\n\n## How triggering works\n\n- The plugin listens to the `content:afterPublish` hook, which fires when you click Publish in the admin.\n- Each share attempt is recorded in a `shares` storage collection (indexed by `postId`, `platform`, `status`, `postedAt`).\n- Before sharing to a platform, the plugin checks if it's already succeeded for this post — if so, it skips. So hitting Unpublish → Publish doesn't re-share.\n- Errors are recorded too. Each platform is independent — if Bluesky posts and Mastodon fails, you get one success row and one failure row.\n\n## Permissions\n\nThe plugin declares these capabilities:\n\n| Capability | Why |\n|---|---|\n| `read:content` | Required by the `content:afterPublish` hook registration |\n| `read:media` | Resolve media references on `featured_image` / `seo.image` fields |\n| `network:fetch:any` | Post to arbitrary Mastodon instances and the Bluesky/X APIs |\n\n## Known v0.1 limitations\n\n- No retry with backoff — one attempt, then recorded as failure. Use the Share Log page to see what failed.\n- No threading on overflow — posts longer than a platform's char limit are truncated (the URL is preserved).\n- No hashtag support yet (template `{tags}` variable is a placeholder; taxonomy lookup not wired).\n- No manual \"Share now\" button inline on content entries — all dispatch is via the `content:afterPublish` hook.\n- No scheduled-post support — if `publishedAt` is in the future, the plugin doesn't auto-fire when that time arrives. Workaround: explicitly publish when you want to share.\n\nThese are all on the roadmap for v0.2+.\n\n## Development\n\n```bash\nnpm install\nnpm run build       # one-time build\nnpm run dev         # watch mode, rebuilds on save\nnpm run typecheck\n```\n\n## License\n\n[0BSD](./LICENSE) — do whatever you want, no warranty.\n","readmeFilename":"README.md"}