mirror of
https://github.com/svemagie/blog-eleventy-indiekit.git
synced 2026-04-02 16:44:56 +02:00
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
This commit is contained in:
@@ -594,15 +594,23 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
function detectPlatform(item) {
|
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 source = item['wm-source'] || '';
|
||||||
var authorUrl = (item.author && item.author.url) || '';
|
var authorUrl = (item.author && item.author.url) || '';
|
||||||
if (source.includes('brid.gy/') && source.includes('/mastodon/')) return 'mastodon';
|
if (source.includes('brid.gy/') && source.includes('/mastodon/')) return 'mastodon';
|
||||||
if (source.includes('brid.gy/') && source.includes('/bluesky/')) return 'bluesky';
|
if (source.includes('brid.gy/') && source.includes('/bluesky/')) return 'bluesky';
|
||||||
if (source.includes('fed.brid.gy')) return 'activitypub';
|
if (source.includes('fed.brid.gy')) return 'activitypub';
|
||||||
if (authorUrl.includes('bsky.app')) return 'bluesky';
|
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';
|
return 'webmention';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user