From 8c4e4a21979653c81b7ef1beae6726e986984bf1 Mon Sep 17 00:00:00 2001 From: Jason Robinson Date: Sun, 29 Dec 2019 22:57:02 +0200 Subject: [PATCH] Correctly identify some platforms that emulate the Mastodon API Ensure Pixelfed, Kroeg and Kibou instances that emulate the Mastodon API don't get identified as Mastodon instances. --- CHANGELOG.md | 4 +++- federation/hostmeta/parsers.py | 3 ++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1d5964d..c88efb6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,7 +11,9 @@ fetching by domain and path. * Don't crash when parsing an invalid NodeInfo document where the usage dictionary - is not following specification. + is not following specification. + +* Ensure Pixelfed, Kroeg and Kibou instances that emulate the Mastodon API don't get identified as Mastodon instances. ## [0.19.0] - 2019-12-15 diff --git a/federation/hostmeta/parsers.py b/federation/hostmeta/parsers.py index 52d0269..8fb414c 100644 --- a/federation/hostmeta/parsers.py +++ b/federation/hostmeta/parsers.py @@ -55,7 +55,8 @@ def int_or_none(value): def parse_mastodon_document(doc, host): # Check first this is not actually Pleroma or Misskey - if doc.get('version', '').find('Pleroma') > -1: + if doc.get('version', '').find('Pleroma') > -1 or doc.get('version', '').find('Pixelfed') > -1 or \ + doc.get('version', '').find('Kibou') > -1 or doc.get('version', '').find('Kroeg') > -1: # Use NodeInfo instead, otherwise this is logged as Mastodon from federation.hostmeta.fetchers import fetch_nodeinfo_document return fetch_nodeinfo_document(host)