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.
merge-requests/159/merge
Jason Robinson 2019-12-29 22:57:02 +02:00
rodzic 9700af7bee
commit 8c4e4a2197
2 zmienionych plików z 5 dodań i 2 usunięć

Wyświetl plik

@ -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

Wyświetl plik

@ -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)