From 945f482ba3c03603ab9dd702583501c8e57053fe Mon Sep 17 00:00:00 2001 From: Michael Date: Thu, 10 Jun 2021 19:10:33 +0000 Subject: [PATCH] API: Some more apps are now supported --- doc/API-Mastodon.md | 10 +++++----- src/Object/Api/Mastodon/Conversation.php | 2 +- src/Object/Api/Mastodon/Instance.php | 9 ++++++++- src/Object/Api/Mastodon/Mention.php | 4 +++- src/Object/Api/Mastodon/Relationship.php | 2 +- 5 files changed, 18 insertions(+), 9 deletions(-) diff --git a/doc/API-Mastodon.md b/doc/API-Mastodon.md index d453883b0e..d76b751a0f 100644 --- a/doc/API-Mastodon.md +++ b/doc/API-Mastodon.md @@ -17,6 +17,7 @@ Authentication is the same as described in [Using the APIs](help/api#Authenticat - [AndStatus](http://andstatus.org) - [B4X for Pleroma & Mastodon](https://github.com/AnywhereSoftware/B4X-Pleroma) +- [Fedi](https://play.google.com/store/apps/details?id=com.fediverse.app) - [Husky](https://husky.fwgs.ru) - [Roma](https://play.google.com/store/apps/details?id=tech.bigfig.roma) - [Subway Tooter](https://github.com/tateisu/SubwayTooter) @@ -28,27 +29,26 @@ Authentication is the same as described in [Using the APIs](help/api#Authenticat #### iOS - [Amaroq](https://github.com/ReticentJohn/Amaroq/tree/master) - [B4X for Pleroma & Mastodon](https://github.com/AnywhereSoftware/B4X-Pleroma) +- [Fedi](https://apps.apple.com/de/app/fedi-for-pleroma-and-mastodon/id1478806281) +- [Roma](https://apps.apple.com/de/app/roma-for-pleroma-and-mastodon/id1445328699) - [StarPterano](https://apps.apple.com/de/app/starpterano/id1436972796) Uses an OAuth method where you have to manually copy and paste the provided code. - [Stella](https://apps.apple.com/us/app/stella-for-mastodon-twitter/id921372048?l=ms) +- [Tootle](https://apps.apple.com/de/app/tootle-for-mastodon/id1236013466) entered hostname must match in upper/lower case. Currently crashes on "Status" type notifications. ### Unsupported apps #### Android -- [Fedi](https://play.google.com/store/apps/details?id=com.fediverse.app) Authenticates, but doesn't load posts and throws several errors - [Fedilab](https://framagit.org/tom79/fedilab) Automatically uses the legacy API, see issue: https://framagit.org/tom79/fedilab/-/issues/520 - [Mammut](https://github.com/jamiesanson/Mammut) There are problems with the token request, see issue https://github.com/jamiesanson/Mammut/issues/19 #### iOS -- [Fedi](https://apps.apple.com/de/app/fedi-for-pleroma-and-mastodon/id1478806281) Authenticates, but doesn't load posts and throws several errors - [Mast](https://github.com/Beesitech/Mast) Doesn't accept the entered instance name. Claims that it is invalid (Message is: "Not a valid instance (may be closed or dead)") -- [Mastonaut](https://mastonaut.app/) -- [Roma](https://apps.apple.com/de/app/roma-for-pleroma-and-mastodon/id1445328699) Authenticates, but doesn't load content - [Toot!](https://apps.apple.com/app/toot/id1229021451) -- [Tootle](https://apps.apple.com/de/app/tootle-for-mastodon/id1236013466) Doesn't recognize server, loads /api/v1/instance in some endless loop #### Other - [Halycon](https://www.halcyon.social/) Doesn't load content, creates masses of HTTP requests +- [Mastonaut](https://mastonaut.app/) - [Pinafore](https://github.com/nolanlawson/pinafore) Returns message "Error: NetworkError when attempting to fetch resource.. Is this a valid Mastodon instance?" ## Entities diff --git a/src/Object/Api/Mastodon/Conversation.php b/src/Object/Api/Mastodon/Conversation.php index 0b0136044f..e0950e555e 100644 --- a/src/Object/Api/Mastodon/Conversation.php +++ b/src/Object/Api/Mastodon/Conversation.php @@ -46,7 +46,7 @@ class Conversation extends BaseDataTransferObject public function __construct(string $id, array $accounts, bool $unread, \Friendica\Object\Api\Mastodon\Status $last_status) { - $this->id = $id; + $this->id = (string)$id; $this->accounts = $accounts; $this->unread = $unread; $this->last_status = $last_status; diff --git a/src/Object/Api/Mastodon/Instance.php b/src/Object/Api/Mastodon/Instance.php index 031e5bcb06..82f30390d7 100644 --- a/src/Object/Api/Mastodon/Instance.php +++ b/src/Object/Api/Mastodon/Instance.php @@ -39,6 +39,8 @@ class Instance extends BaseDataTransferObject /** @var string */ protected $title; /** @var string */ + protected $short_description; + /** @var string */ protected $description; /** @var string */ protected $email; @@ -58,8 +60,12 @@ class Instance extends BaseDataTransferObject protected $registrations; /** @var bool */ protected $approval_required; + /** @var bool */ + protected $invites_enabled; /** @var Account|null */ protected $contact_account = null; + /** @var array */ + protected $rules = []; /** * Creates an instance record @@ -77,7 +83,7 @@ class Instance extends BaseDataTransferObject $instance = new Instance(); $instance->uri = $baseUrl->get(); $instance->title = DI::config()->get('config', 'sitename'); - $instance->description = DI::config()->get('config', 'info'); + $instance->short_description = $instance->description = DI::config()->get('config', 'info'); $instance->email = DI::config()->get('config', 'admin_email'); $instance->version = FRIENDICA_VERSION; $instance->urls = null; // Not supported @@ -87,6 +93,7 @@ class Instance extends BaseDataTransferObject $instance->max_toot_chars = (int)DI::config()->get('config', 'api_import_size', DI::config()->get('config', 'max_import_size')); $instance->registrations = ($register_policy != Register::CLOSED); $instance->approval_required = ($register_policy == Register::APPROVE); + $instance->invites_enabled = false; $instance->contact_account = []; if (!empty(DI::config()->get('config', 'admin_email'))) { diff --git a/src/Object/Api/Mastodon/Mention.php b/src/Object/Api/Mastodon/Mention.php index d64fe6b5fc..3fd2507c4a 100644 --- a/src/Object/Api/Mastodon/Mention.php +++ b/src/Object/Api/Mastodon/Mention.php @@ -50,7 +50,7 @@ class Mention extends BaseDataTransferObject */ public function __construct(BaseURL $baseUrl, array $tag, array $contact) { - $this->id = $contact['id'] ?? 0; + $this->id = (string)($contact['id'] ?? 0); $this->username = $tag['name']; $this->url = $tag['url']; @@ -59,6 +59,8 @@ class Mention extends BaseDataTransferObject strpos($contact['url'], $baseUrl->get() . '/') === 0 ? $contact['nick'] : $contact['addr']; + + $this->username = $contact['nick']; } else { $this->acct = ''; } diff --git a/src/Object/Api/Mastodon/Relationship.php b/src/Object/Api/Mastodon/Relationship.php index 870acb5446..5d7169b893 100644 --- a/src/Object/Api/Mastodon/Relationship.php +++ b/src/Object/Api/Mastodon/Relationship.php @@ -79,7 +79,7 @@ class Relationship extends BaseDataTransferObject */ public function __construct(int $contactId, array $contactRecord = [], bool $blocked = false, bool $muted = false) { - $this->id = $contactId; + $this->id = (string)$contactId; $this->following = false; $this->requested = false; $this->endorsed = false;