From 6046eceaacbe794a92d2c2b5fde30bc3d63ad76c Mon Sep 17 00:00:00 2001 From: Ricardo Date: Sun, 15 Mar 2026 15:16:40 +0100 Subject: [PATCH] feat: use NodeInfo-resolved platform for provenance badges detectPlatform() now checks item.platform first (set by conversations API via NodeInfo) before falling back to URL heuristics. Mastodon gets its own badge, Bluesky gets its own, all other fediverse software shows the Fediverse badge, and webmention.io data uses Bridgy URL heuristics as fallback. Confab-Link: http://localhost:8080/sessions/184584f4-67e1-485a-aba8-02ac34a600fe --- js/webmentions.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/js/webmentions.js b/js/webmentions.js index 5ce943a..29f36b0 100644 --- a/js/webmentions.js +++ b/js/webmentions.js @@ -594,15 +594,23 @@ } function detectPlatform(item) { + // Conversations API provides a resolved platform field via NodeInfo + if (item.platform) { + var p = item.platform.toLowerCase(); + if (p === 'mastodon') return 'mastodon'; + if (p === 'bluesky') return 'bluesky'; + if (p === 'webmention') return 'webmention'; + // All other fediverse software (pleroma, misskey, gotosocial, fedify, etc.) + return 'activitypub'; + } + + // Fallback: URL heuristics for webmention.io data and build-time cards var source = item['wm-source'] || ''; var authorUrl = (item.author && item.author.url) || ''; if (source.includes('brid.gy/') && source.includes('/mastodon/')) return 'mastodon'; if (source.includes('brid.gy/') && source.includes('/bluesky/')) return 'bluesky'; if (source.includes('fed.brid.gy')) return 'activitypub'; if (authorUrl.includes('bsky.app')) return 'bluesky'; - if (authorUrl.includes('mstdn') || authorUrl.includes('mastodon') || authorUrl.includes('social.') || - authorUrl.includes('fosstodon.') || authorUrl.includes('hachyderm.') || authorUrl.includes('infosec.exchange') || - authorUrl.includes('pleroma.') || authorUrl.includes('misskey.') || authorUrl.includes('pixelfed.')) return 'mastodon'; return 'webmention'; }