Skip to content

Open-source platform for 3D AI agents. Turn text or a photo into a rigged, animated GLB avatar, give it an LLM brain, memory and a wallet, and embed it anywhere with one web component. Remote MCP server, x402 payments, Three.js, browser-native.

feat(news): multi-destination syndication (WebSub, Dev.to, Medium, CMC handoff)

nirholas05b5ad51ae4b
diff --git a/.env.example b/.env.example
index 8653054ad..ddee97b20 100644
--- a/.env.example
+++ b/.env.example
@@ -242,3 +242,19 @@ GITHUB_OAUTH_CLIENT_SECRET=
# Callback URL: https://your-domain.com/api/auth/x/callback
X_OAUTH_CLIENT_ID=
X_OAUTH_CLIENT_SECRET=
+
+# ── News-feed syndication (admin "Publish" → Dev.to / Medium) ────────────────
+# Used by /api/admin/news (the local-only CMS) to mirror newly-saved posts
+# to external publishers. When unset, syndication for that target is silently
+# skipped — the admin UI surfaces "skipped: <KEY> not set".
+# See docs/syndication.md for setup details.
+
+# Dev.to: generate at https://dev.to/settings/extensions ("Generate API Key")
+DEV_TO_API_KEY=
+
+# Medium: generate an integration token at https://medium.com/me/settings/security
+# (Medium's API is deprecated for new accounts as of 2024 but still works for
+# accounts that had API access enabled.) MEDIUM_AUTHOR_ID is optional —
+# the syndicator auto-discovers it via /v1/me and caches in-memory.
+MEDIUM_INTEGRATION_TOKEN=
+MEDIUM_AUTHOR_ID=
diff --git a/api/_lib/env.js b/api/_lib/env.js
index c37f660f5..374c6d5ea 100644
--- a/api/_lib/env.js
+++ b/api/_lib/env.js
@@ -326,6 +326,26 @@ export const env = {
return opt('X_OAUTH_CLIENT_SECRET');
},
+ // Dev.to syndication — required for the news admin's "Publish to Dev.to"
+ // hook to do anything. Generate at https://dev.to/settings/extensions
+ // (look for "Generate API Key"). When unset, syndication is skipped
+ // silently and the admin shows "skipped: DEV_TO_API_KEY not set".
+ get DEV_TO_API_KEY() {
+ return opt('DEV_TO_API_KEY');
+ },
+
+ // Medium syndication — generate an integration token at
+ // https://medium.com/me/settings/security (note: Medium's API is
+ // deprecated for new accounts as of 2024 but still functions for
+ // accounts that had API access enabled). MEDIUM_AUTHOR_ID is optional;
+ // the syndicator auto-discovers it via /v1/me and caches in-memory.
+ get MEDIUM_INTEGRATION_TOKEN() {
+ return opt('MEDIUM_INTEGRATION_TOKEN');
+ },
+ get MEDIUM_AUTHOR_ID() {
+ return opt('MEDIUM_AUTHOR_ID');
+ },
+
getRpcUrl(chainId) {
return (
opt(`RPC_URL_${chainId}`) ||
diff --git a/api/_lib/rss-feed.js b/api/_lib/rss-feed.js
index 29c856c88..6de89906e 100644
--- a/api/_lib/rss-feed.js
+++ b/api/_lib/rss-feed.js
@@ -244,6 +244,7 @@ export function buildRssXml({ items, selfUrl, source = 'curated' }) {
\t\t<title>${escapeXml(channelTitle)}</title>
\t\t<link>https://three.ws</link>
\t\t<atom:link href="${escapeAttr(selfUrl)}" rel="self" type="application/rss+xml"/>
+\t\t<atom:link href="https://pubsubhubbub.appspot.com" rel="hub"/>
\t\t<description>${escapeXml(channelDescription)}</description>
\t\t<language>en-us</language>
\t\t<lastBuildDate>${rfc822(lastBuildDate)}</lastBuildDate>
diff --git a/api/_lib/syndicate.js b/api/_lib/syndicate.js
new file mode 100644
index 000000000..c349f23c2
--- /dev/null
+++ b/api/_lib/syndicate.js
@@ -0,0 +1,240 @@
+// Multi-destination syndication for news items.
+//
+// Targets:
+// - WebSub (PubSubHubbub) push — no credentials
+// - Dev.to /api/articles — needs DEV_TO_API_KEY
+// - Medium /v1/users/{me}/posts — needs MEDIUM_INTEGRATION_TOKEN
+// (MEDIUM_AUTHOR_ID is auto-discovered + cached)
+//
+// HackerNoon is not in this list because they auto-import from
+// /rss/announcements.xml — see docs/syndication.md.
+//
+// CMC has no public publish API; the admin UI offers a "Copy for CMC"
+// block that formats the post for manual paste.
+
+import { env } from './env.js';
+import { SITE_ORIGIN, NEWS_PATH_PREFIX } from './rss-feed.js';
+
+const WEBSUB_HUB = 'https://pubsubhubbub.appspot.com';
+const FEED_URL = `${SITE_ORIGIN}/rss/announcements.xml`;
+
+const DEVTO_API = 'https://dev.to/api/articles';
+const MEDIUM_API = 'https://api.medium.com/v1';
+
+let _mediumAuthorIdCache = null;
+
+function permalink(item) {
+ return `${SITE_ORIGIN}${NEWS_PATH_PREFIX}/${item.slug}`;
+}
+
+// ────────────────────────────────────────────────────────────────────────
+// WebSub — instant push to subscribers
+// ────────────────────────────────────────────────────────────────────────
+export async function notifyWebSub() {
+ const body = new URLSearchParams({
+ 'hub.mode': 'publish',
+ 'hub.url': FEED_URL,
+ }).toString();
+ const r = await fetch(WEBSUB_HUB, {
+ method: 'POST',
+ headers: { 'content-type': 'application/x-www-form-urlencoded', 'user-agent': 'three.ws-news-syndicator/1.0' },
+ body,
+ });
+ if (!r.ok) {
+ const text = await r.text().catch(() => '');
+ throw new Error(`WebSub hub returned HTTP ${r.status}: ${text.slice(0, 200)}`);
+ }
+ return { hub: WEBSUB_HUB, feed: FEED_URL, pinged_at: new Date().toISOString() };
+}
+
+// ────────────────────────────────────────────────────────────────────────
+// Dev.to — create or update an article
+// ────────────────────────────────────────────────────────────────────────
+function devToTags(tags) {
+ // Dev.to accepts max 4 tags, lowercase alphanumeric (no hyphens in API tags)
+ return (tags || [])
+ .map((t) => String(t).toLowerCase().replace(/[^a-z0-9]/g, ''))
+ .filter(Boolean)
+ .slice(0, 4);
+}
+
+function devToBody(item) {
+ // Dev.to accepts HTML embedded inside markdown via body_markdown.
+ // Prepend a small "Originally published" note for SEO + clarity.
+ const note = `*Originally published on [three.ws](${permalink(item)}).*\n\n`;
+ return note + item.bodyHtml;
+}
+
+export async function syndicateDevTo(item, { update = null } = {}) {
+ const apiKey = env.DEV_TO_API_KEY;
+ if (!apiKey) {
+ return { target: 'devto', status: 'skipped', reason: 'DEV_TO_API_KEY not set' };
+ }
+ const article = {
+ title: item.title,
+ body_markdown: devToBody(item),
+ published: item.published !== false,
+ canonical_url: permalink(item),
+ description: item.summary || undefined,
+ main_image: item.image ? (item.image.startsWith('http') ? item.image : `${SITE_ORIGIN}${item.image}`) : undefined,
+ tags: devToTags(item.tags),
+ };
+ const url = update ? `${DEVTO_API}/${update}` : DEVTO_API;
+ const method = update ? 'PUT' : 'POST';
+ const r = await fetch(url, {
+ method,
+ headers: { 'content-type': 'application/json', 'api-key': apiKey, accept: 'application/vnd.forem.api-v1+json' },
+ body: JSON.stringify({ article }),
+ });
+ const data = await r.json().catch(() => ({}));
+ if (!r.ok) {
+ throw new Error(`Dev.to ${method} ${r.status}: ${data?.error || JSON.stringify(data).slice(0, 200)}`);
+ }
+ return {
+ target: 'devto',
+ status: update ? 'updated' : 'published',
+ id: data.id,
+ url: data.url || data.canonical_url || null,
+ published_at: data.published_at || new Date().toISOString(),
+ };
+}
+
+// ────────────────────────────────────────────────────────────────────────
+// Medium — create a post (Medium API is create-only, no updates)
+// ────────────────────────────────────────────────────────────────────────
+async function mediumAuthorId(token) {
+ if (_mediumAuthorIdCache) return _mediumAuthorIdCache;
+ const r = await fetch(`${MEDIUM_API}/me`, { headers: { Authorization: `Bearer ${token}` } });
+ const data = await r.json().catch(() => ({}));
+ if (!r.ok || !data?.data?.id) {
+ throw new Error(`Medium /me HTTP ${r.status}: ${JSON.stringify(data).slice(0, 200)}`);
+ }
+ _mediumAuthorIdCache = data.data.id;
+ return _mediumAuthorIdCache;
+}
+
+function mediumBody(item) {
+ // Medium contentFormat: 'html' accepts arbitrary HTML; prepend an h1
+ // because Medium does not use the `title` field as a visible heading.
+ const titleH1 = `<h1>${escapeXml(item.title)}</h1>\n`;
+ const note = `<p><em>Originally published on <a href="${permalink(item)}">three.ws</a>.</em></p>\n`;
+ return titleH1 + note + item.bodyHtml;
+}
+
+function escapeXml(s) {
+ return String(s).replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');
+}
+
+export async function syndicateMedium(item) {
+ const token = env.MEDIUM_INTEGRATION_TOKEN;
+ if (!token) {
+ return { target: 'medium', status: 'skipped', reason: 'MEDIUM_INTEGRATION_TOKEN not set' };
+ }
+ if (item.published === false) {
+ return { target: 'medium', status: 'skipped', reason: 'item is a draft (published=false)' };
+ }
+ const authorId = env.MEDIUM_AUTHOR_ID || await mediumAuthorId(token);
+ const post = {
+ title: item.title,
+ contentFormat: 'html',
+ content: mediumBody(item),
+ canonicalUrl: permalink(item),
+ tags: (item.tags || []).slice(0, 5),
+ publishStatus: 'public',
+ };
+ const r = await fetch(`${MEDIUM_API}/users/${encodeURIComponent(authorId)}/posts`, {
+ method: 'POST',
+ headers: { 'content-type': 'application/json', Authorization: `Bearer ${token}`, accept: 'application/json' },
+ body: JSON.stringify(post),
+ });
+ const data = await r.json().catch(() => ({}));
+ if (!r.ok || data?.errors) {
+ throw new Error(`Medium HTTP ${r.status}: ${JSON.stringify(data).slice(0, 200)}`);
+ }
+ const out = data?.data || {};
+ return {
+ target: 'medium',
+ status: 'published',
+ id: out.id,
+ url: out.url || null,
+ published_at: out.publishedAt ? new Date(out.publishedAt).toISOString() : new Date().toISOString(),
+ };
+}
+
+// ────────────────────────────────────────────────────────────────────────
+// CMC manual handoff — generate markdown for copy-paste
+// ────────────────────────────────────────────────────────────────────────
+export function cmcCopyBlock(item) {
+ const lines = [];
+ lines.push(`# ${item.title}`);
+ lines.push('');
+ if (item.summary) { lines.push(`> ${item.summary}`); lines.push(''); }
+ lines.push(htmlToPlainMarkdown(item.bodyHtml));
+ lines.push('');
+ lines.push(`---`);
+ lines.push(`Originally published at [three.ws/news/${item.slug}](${permalink(item)}).`);
+ return lines.join('\n');
+}
+
+function htmlToPlainMarkdown(html) {
+ return String(html)
+ .replace(/<\/?(strong|b)>/gi, '**')
+ .replace(/<\/?(em|i)>/gi, '*')
+ .replace(/<h2[^>]*>(.*?)<\/h2>/gis, '\n## $1\n')
+ .replace(/<h3[^>]*>(.*?)<\/h3>/gis, '\n### $1\n')
+ .replace(/<a\s+[^>]*href="([^"]+)"[^>]*>(.*?)<\/a>/gis, '[$2]($1)')
+ .replace(/<li[^>]*>(.*?)<\/li>/gis, '- $1\n')
+ .replace(/<\/?(ul|ol)>/gi, '\n')
+ .replace(/<br\s*\/?>/gi, '\n')
+ .replace(/<p[^>]*>(.*?)<\/p>/gis, '$1\n\n')
+ .replace(/<code[^>]*>(.*?)<\/code>/gis, '`$1`')
+ .replace(/<pre[^>]*>([\s\S]*?)<\/pre>/gi, '\n```\n$1\n```\n')
+ .replace(/<[^>]+>/g, '')
+ .replace(/&amp;/g, '&').replace(/&lt;/g, '<').replace(/&gt;/g, '>').replace(/&quot;/g, '"').replace(/&#39;/g, "'").replace(/&mdash;/g, '—').replace(/&middot;/g, '·').replace(/&nbsp;/g, ' ')
+ .replace(/\n{3,}/g, '\n\n')
+ .trim();
+}
+
+// ────────────────────────────────────────────────────────────────────────
+// Run all syndication targets for a single item
+// ────────────────────────────────────────────────────────────────────────
+export async function syndicateAll(item, { existing = {}, skip = [] } = {}) {
+ const results = [];
+ const skipSet = new Set(skip);
+
+ // WebSub: ping no matter what (any item save means the feed changed)
+ if (!skipSet.has('websub')) {
+ try {
+ const r = await notifyWebSub();
+ results.push({ target: 'websub', status: 'pinged', ...r });
+ } catch (e) {
+ results.push({ target: 'websub', status: 'error', error: String(e?.message || e) });
+ }
+ }
+
+ // Dev.to: create or update based on existing syndication state
+ if (!skipSet.has('devto')) {
+ try {
+ const r = await syndicateDevTo(item, { update: existing?.devto?.id || null });
+ results.push(r);
+ } catch (e) {
+ results.push({ target: 'devto', status: 'error', error: String(e?.message || e) });
+ }
+ }
+
+ // Medium: create only (no update endpoint)
+ if (!skipSet.has('medium')) {
+ try {
+ if (existing?.medium?.id) {
+ results.push({ target: 'medium', status: 'skipped', reason: 'Medium API has no update endpoint; first-publish only' });
+ } else {
+ const r = await syndicateMedium(item);
+ results.push(r);
+ }
+ } catch (e) {
+ results.push({ target: 'medium', status: 'error', error: String(e?.message || e) });
+ }
+ }
+
+ return results;
+}
diff --git a/api/admin/news/[action].js b/api/admin/news/[action].js
index 3ec1a9582..f8749eafc 100644
--- a/api/admin/news/[action].js
+++ b/api/admin/news/[action].js
@@ -16,6 +16,7 @@ import { fileURLToPath } from 'node:url';
import { json, error, method, cors, readJson, wrap } from '../../_lib/http.js';
import { loadCuratedItems } from '../../_lib/rss-feed.js';
import { writeAllPages } from '../../../scripts/build-news.mjs';
+import { syndicateAll, cmcCopyBlock } from '../../_lib/syndicate.js';
const ROOT = path.resolve(fileURLToPath(import.meta.url), '..', '..', '..', '..');
const ITEMS_FILE = path.join(ROOT, 'data', 'rss', 'items.json');
@@ -68,8 +69,52 @@ const VALID_FIELDS = new Set([
'id', 'slug', 'title', 'date', 'body_html', 'summary', 'author', 'tags',
'image', 'image_alt', 'image_width', 'image_height',
'og_title', 'og_description', 'external_link', 'link', 'published',
+ 'syndication',
]);
+// Inflate a raw items.json entry into the loadCuratedItems-shaped object the
+// syndicator expects (slug, permalink, bodyHtml, etc.). Mirrors the logic in
+// rss-feed.js loadCuratedItems but for a single passed-in entry — used after
+// save when we want syndication based on the just-written state.
+function loadCuratedItem(e) {
+ const slug = e.slug || String(e.id || '').replace(/^t-/, '').toLowerCase().replace(/[^a-z0-9]+/g, '-').replace(/^-+|-+$/g, '');
+ return {
+ id: e.id,
+ slug,
+ title: e.title,
+ bodyHtml: e.body_html,
+ summary: e.summary || '',
+ author: e.author || 'three.ws',
+ tags: e.tags || [],
+ image: e.image || '',
+ imageAlt: e.image_alt || '',
+ published: e.published !== false,
+ timestamp: new Date(e.date),
+ };
+}
+
+// Combine prior syndication state with fresh results.
+// Keeps existing IDs/URLs (for Dev.to update keys) and overwrites with new
+// success records. Errors don't overwrite a previously-successful entry.
+function mergeSyndication(prior = {}, results = []) {
+ const merged = { ...(prior || {}) };
+ for (const r of results || []) {
+ if (!r || !r.target || r.target === 'all') continue;
+ if (r.status === 'error' || r.status === 'skipped') {
+ // keep prior success record if there is one, otherwise record the latest state
+ if (!merged[r.target]) merged[r.target] = { status: r.status, reason: r.reason || r.error };
+ continue;
+ }
+ merged[r.target] = {
+ status: r.status,
+ id: r.id,
+ url: r.url,
+ published_at: r.published_at || r.pinged_at,
+ };
+ }
+ return merged;
+}
+
function sanitizeItem(input) {
const out = {};
for (const [k, v] of Object.entries(input || {})) {
@@ -133,12 +178,63 @@ export default wrap(async (req, res) => {
const data = await readItemsFile();
const items = Array.isArray(data.items) ? data.items : [];
const i = items.findIndex((e) => e.id === item.id);
+ const existingSyndication = i >= 0 ? items[i]?.syndication : undefined;
+ // Preserve syndication state across saves (don't clobber Dev.to/Medium IDs)
+ if (existingSyndication) item.syndication = existingSyndication;
if (i >= 0) items[i] = item;
else items.unshift(item);
data.items = items;
await writeItemsFile(data);
const stats = await regeneratePages();
- return json(res, 200, { ok: true, item, rebuild: stats });
+
+ // Syndicate (fire all configured targets; per-target errors are captured)
+ const skipSyndication = body?.skip_syndication === true || item.published === false;
+ const syndication = skipSyndication
+ ? [{ target: 'all', status: 'skipped', reason: item.published === false ? 'draft' : 'requested' }]
+ : await syndicateAll(loadCuratedItem(item), { existing: existingSyndication });
+
+ // Merge new syndication results into the item (publishedAt URLs etc.)
+ const merged = mergeSyndication(existingSyndication, syndication);
+ if (Object.keys(merged).length > 0) {
+ item.syndication = merged;
+ items[items.findIndex((e) => e.id === item.id)] = item;
+ data.items = items;
+ await writeItemsFile(data);
+ }
+
+ return json(res, 200, { ok: true, item, rebuild: stats, syndication });
+ }
+
+ if (action === 'resyndicate') {
+ if (!method(req, res, ['POST'])) return;
+ const body = await readJson(req);
+ const id = String(body?.id || '').trim();
+ if (!id) return error(res, 400, 'missing_id', 'id is required');
+ const data = await readItemsFile();
+ const items = Array.isArray(data.items) ? data.items : [];
+ const idx = items.findIndex((e) => e.id === id);
+ if (idx < 0) return error(res, 404, 'not_found', `no item with id "${id}"`);
+ const raw = items[idx];
+ const existing = raw?.syndication;
+ const syndication = await syndicateAll(loadCuratedItem(raw), { existing });
+ const merged = mergeSyndication(existing, syndication);
+ raw.syndication = merged;
+ items[idx] = raw;
+ data.items = items;
+ await writeItemsFile(data);
+ return json(res, 200, { ok: true, id, syndication });
+ }
+
+ if (action === 'cmc-copy') {
+ if (!method(req, res, ['GET'])) return;
+ const id = String(req.query?.id || '').trim();
+ if (!id) return error(res, 400, 'missing_id', 'id query param is required');
+ const data = await readItemsFile();
+ const items = Array.isArray(data.items) ? data.items : [];
+ const raw = items.find((e) => e.id === id);
+ if (!raw) return error(res, 404, 'not_found', `no item with id "${id}"`);
+ const block = cmcCopyBlock(loadCuratedItem(raw));
+ return json(res, 200, { ok: true, id, markdown: block });
}
if (action === 'delete') {
diff --git a/docs/syndication.md b/docs/syndication.md
new file mode 100644
index 000000000..f021055e9
--- /dev/null
+++ b/docs/syndication.md
@@ -0,0 +1,112 @@
+# News-feed syndication
+
+Every news post saved through `/admin/news` can mirror to multiple
+external publishers automatically. Targets that need credentials are
+silently skipped until you set their env var.
+
+| Target | Needs key | Behavior |
+|---|---|---|
+| **WebSub** (PubSubHubbub) | No | Pinged on every save. RSS subscribers using a WebSub-aware reader get instant updates. |
+| **Dev.to** | `DEV_TO_API_KEY` | Creates a new article on first save, updates on later saves (Dev.to tracks the article ID). Canonical URL points back to `three.ws/news/<slug>` so Google attributes the rank to three.ws. |
+| **Medium** | `MEDIUM_INTEGRATION_TOKEN` | Creates a new post on first save. **Medium's API is create-only** — later edits do not propagate. Canonical URL points back to three.ws. |
+| **CoinMarketCap** | No (manual) | The admin's "Copy for CMC…" button generates a markdown block for paste into CMC's manual publishing flow. |
+| **HackerNoon** | No | Auto-imports from `https://three.ws/rss/announcements.xml` — see [HackerNoon setup](#hackernoon) below. |
+
+## Setup
+
+### Dev.to
+
+1. Sign in to [dev.to](https://dev.to).
+2. Open **Settings → Extensions** (`https://dev.to/settings/extensions`).
+3. Scroll to **DEV Community API Keys** and click **Generate API Key**.
+4. Copy the key and set `DEV_TO_API_KEY=<key>` in your env.
+5. Save a news post in `/admin/news` — the **Syndication** panel should
+ flip from `skipped` to `published` with a link to the live article.
+
+### Medium
+
+1. Sign in to [Medium](https://medium.com).
+2. Open **Settings → Security and apps** (`https://medium.com/me/settings/security`).
+3. Scroll to **Integration tokens**, enter a description, click **Get integration token**.
+4. Set `MEDIUM_INTEGRATION_TOKEN=<token>` in your env.
+5. (Optional) Set `MEDIUM_AUTHOR_ID=<id>` if you want to skip the
+ auto-discovery `/v1/me` call. Otherwise the syndicator fetches your
+ author ID on first use and caches it for the Lambda's warm lifetime.
+
+> **Note:** Medium's API has been deprecated for *new* accounts since
+> 2024. If your integration-token request returns "Access denied", the
+> Medium target stays skipped — there's nothing to fix on the three.ws
+> side. Older accounts with API access enabled continue to work.
+
+### CoinMarketCap
+
+CMC has no public publish API. The admin gives you a one-click handoff:
+
+1. Open the post in `/admin/news`.
+2. Click **Copy for CMC…** in the Syndication panel.
+3. Paste into CMC's manual publish form.
+
+The generated block is plain markdown: title, summary blockquote, body
+(with `**bold**`, links, lists), and a "Originally published at
+three.ws/news/<slug>" footer for canonical attribution.
+
+### HackerNoon
+
+HackerNoon's RSS auto-import is the cleanest path — no per-post action
+needed.
+
+1. Sign in to [hackernoon.com](https://hackernoon.com) and reach **Edit Profile** (top-right avatar menu).
+2. Open **Settings → Auto Import**.
+3. Paste `https://three.ws/rss/announcements.xml` as your feed URL.
+4. HackerNoon polls the feed roughly every hour and pulls every new
+ item into your drafts. You can edit / promote each draft before it
+ publishes.
+5. To claim the author profile that auto-imports create under, follow
+ HackerNoon's "Author Profile Claim" flow (Settings → Profile →
+ Verify Author).
+
+### WebSub (no setup)
+
+The RSS channel already advertises `<atom:link rel="hub" href="https://pubsubhubbub.appspot.com"/>`.
+Compatible readers subscribe via the hub instead of polling, so they
+get push notifications when items.json changes.
+
+The admin pings the hub on every save. No env var needed.
+
+## Resyndicate / one-off
+
+The Syndication panel in `/admin/news` exposes a **Re-syndicate now**
+button per post. It re-runs every target (skipping Medium for
+already-published posts since there's no update endpoint).
+
+The same endpoint is exposed as `POST /api/admin/news/resyndicate`
+with body `{ "id": "<post-id>" }` — useful for scripting or one-off
+batch runs.
+
+## What gets stored
+
+After a syndication run, the resulting URLs and IDs are written back
+into `data/rss/items.json` under a `syndication` field on the item:
+
+```json
+{
+ "id": "live-on-alibaba-cloud-marketplace",
+ "title": "…",
+ "syndication": {
+ "websub": { "status": "pinged", "published_at": "2026-05-17T02:31:36.889Z" },
+ "devto": { "status": "published", "id": 1234567, "url": "https://dev.to/…", "published_at": "…" },
+ "medium": { "status": "skipped", "reason": "MEDIUM_INTEGRATION_TOKEN not set" }
+ }
+}
+```
+
+Dev.to uses the `id` on the next save to update the same post in
+place. Medium has no update endpoint — once published it stays
+published; re-saves on three.ws do not re-publish.
+
+## Local-only
+
+`/admin/news` only runs on `localhost` or when `NODE_ENV !== 'production'`
+(and refuses outright on the Vercel runtime — its filesystem is
+read-only there anyway). Saves write to `data/rss/items.json` on disk;
+to publish, commit + push and let Vercel redeploy.
diff --git a/public/admin/news.html b/public/admin/news.html
index e9b30f94e..2437e58e3 100644
--- a/public/admin/news.html
+++ b/public/admin/news.html
@@ -70,6 +70,18 @@ textarea { resize: vertical; min-height: 220px; font-family: 'SF Mono', Menlo, m
.preview blockquote { border-left: 3px solid #ffd76a; padding: 6px 14px; background: rgba(255,215,106,.04); color: #aaa; margin: 12px 0; }
.image-controls { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.image-preview { width: 80px; height: 50px; border-radius: 4px; background: #0a0a14; border: 1px solid #1e1e2e; object-fit: cover; }
+.syndication-block { background: #0a0a14; border: 1px solid #1e1e2e; border-radius: 8px; padding: 12px 14px; margin-bottom: 16px; }
+.synd-rows { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
+.synd-row { display: flex; align-items: center; gap: 10px; font-size: 12px; }
+.synd-target { width: 70px; color: #aaa; font-weight: 500; }
+.synd-status { padding: 1px 8px; border-radius: 4px; font-size: 11px; font-weight: 500; }
+.synd-ok { background: rgba(20,241,149,.14); color: #14f195; }
+.synd-skip { background: rgba(255,166,77,.12); color: #ffa64d; }
+.synd-err { background: rgba(255,92,92,.14); color: #ff5c5c; }
+.synd-none { background: #1a1a26; color: #666; }
+.synd-meta { color: #666; font-size: 11px; }
+.synd-meta a { color: #9a8cff; }
+.synd-actions { display: flex; gap: 8px; }
.actions { display: flex; gap: 10px; justify-content: space-between; padding-top: 14px; border-top: 1px solid #1e1e2e; margin-top: 22px; }
.actions-left, .actions-right { display: flex; gap: 8px; }
.toast { position: fixed; bottom: 20px; right: 20px; padding: 10px 14px; border-radius: 8px; font-size: 13px; z-index: 100;
@@ -315,6 +327,7 @@ function renderEditor(p) {
\t\t\t<div class="field">
\t\t\t\t<label class="toggle"><input id="f-published" type="checkbox" ${p.published !== false ? 'checked' : ''}/> <span>Published</span></label>
\t\t\t</div>
+\t\t\t${activeId !== null ? renderSyndicationBlock(p) : ''}
\t\t\t<div class="actions">
\t\t\t\t<div class="actions-left">
\t\t\t\t\t${activeId !== null ? '<button type="button" class="btn btn-danger" id="delete-btn">Delete</button>' : ''}
@@ -328,6 +341,60 @@ function renderEditor(p) {
\t`;
\tupdatePreview();
\twireEditor();
+\twireSyndication(p);
+}
+
+function renderSyndicationBlock(p) {
+\tconst s = p.syndication || {};
+\tfunction badge(target) {
+\t\tconst v = s[target];
+\t\tif (!v) return `<span class="synd-status synd-none">never</span>`;
+\t\tif (v.status === 'published' || v.status === 'updated' || v.status === 'pinged') {
+\t\t\tconst link = v.url ? ` &middot; <a href="${escapeAttr(v.url)}" target="_blank" rel="noopener">view</a>` : '';
+\t\t\treturn `<span class="synd-status synd-ok">${escapeHtml(v.status)}</span><span class="synd-meta">${escapeHtml((v.published_at || v.pinged_at || '').slice(0,10))}${link}</span>`;
+\t\t}
+\t\tif (v.status === 'skipped') return `<span class="synd-status synd-skip">skipped</span><span class="synd-meta">${escapeHtml(v.reason || '')}</span>`;
+\t\treturn `<span class="synd-status synd-err">error</span><span class="synd-meta">${escapeHtml(v.error || v.reason || '')}</span>`;
+\t}
+\treturn `
+\t\t<div class="field syndication-block">
+\t\t\t<label>Syndication <span class="hint">live state per target</span></label>
+\t\t\t<div class="synd-rows">
+\t\t\t\t<div class="synd-row"><span class="synd-target">WebSub</span> ${badge('websub')}</div>
+\t\t\t\t<div class="synd-row"><span class="synd-target">Dev.to</span> ${badge('devto')}</div>
+\t\t\t\t<div class="synd-row"><span class="synd-target">Medium</span> ${badge('medium')}</div>
+\t\t\t</div>
+\t\t\t<div class="synd-actions">
+\t\t\t\t<button type="button" class="btn" id="resyndicate-btn">Re-syndicate now</button>
+\t\t\t\t<button type="button" class="btn" id="cmc-btn">Copy for CMC&hellip;</button>
+\t\t\t</div>
+\t\t</div>
+\t`;
+}
+
+function wireSyndication(p) {
+\tconst rb = document.getElementById('resyndicate-btn');
+\tconst cb = document.getElementById('cmc-btn');
+\tif (rb) rb.addEventListener('click', async () => {
+\t\trb.disabled = true; rb.textContent = 'Syndicating…';
+\t\ttry {
+\t\t\tconst { syndication } = await api('resyndicate', { id: p.id });
+\t\t\tconst summary = syndication.map(s => `${s.target}: ${s.status}`).join(' · ');
+\t\t\ttoast(summary || 'Done');
+\t\t\tawait refresh();
+\t\t\tloadEditor(p.id);
+\t\t} catch (e) { toast('Re-syndicate failed: ' + e.message, 'err'); }
+\t\tfinally { rb.disabled = false; rb.textContent = 'Re-syndicate now'; }
+\t});
+\tif (cb) cb.addEventListener('click', async () => {
+\t\ttry {
+\t\t\tconst r = await fetch(`${API}/cmc-copy?id=${encodeURIComponent(p.id)}`);
+\t\t\tconst j = await r.json();
+\t\t\tif (!r.ok) throw new Error(j?.error_description || 'failed');
+\t\t\tawait navigator.clipboard.writeText(j.markdown);
+\t\t\ttoast('Markdown copied to clipboard — paste into CMC');
+\t\t} catch (e) { toast('Copy failed: ' + e.message, 'err'); }
+\t});
}
function updatePreview() {