Merge pull request #10242 from annando/api-lists-missing

API: List handling, dummy endpoints
This commit is contained in:
Hypolite Petovan 2021-05-13 18:09:01 -04:00 committed by GitHub
commit 3f6b079976
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 416 additions and 70 deletions

View File

@ -16,12 +16,13 @@ Supported mobile apps:
- Tusky - Tusky
- Husky - Husky
- twitlatte - twitlatte
- AndStatus
- Twidere
Unsupported mobile apps: Unsupported mobile apps:
- [Subway Tooter](https://github.com/tateisu/SubwayTooter) Uses the wrong grant_type when requesting a token, possibly a problem in the server type detection of the app. See issue https://github.com/tateisu/SubwayTooter/issues/156 - [Subway Tooter](https://github.com/tateisu/SubwayTooter) Uses the wrong grant_type when requesting a token, possibly a problem in the server type detection of the app. See issue https://github.com/tateisu/SubwayTooter/issues/156
- [Mammut](https://github.com/jamiesanson/Mammut) States that the instance doesn't exist. Most likely an issue in the vitality check of the app, see issue https://github.com/jamiesanson/Mammut/issues/19 - [Mammut](https://github.com/jamiesanson/Mammut) States that the instance doesn't exist. Most likely an issue in the vitality check of the app, see issue https://github.com/jamiesanson/Mammut/issues/19
- [AndStatus](https://github.com/andstatus/andstatus) Doesn't provide all data at token request, see issue https://github.com/andstatus/andstatus/issues/537
- [Fedilab](https://framagit.org/tom79/fedilab) Automatically uses the legacy API, see issue: https://framagit.org/tom79/fedilab/-/issues/520 - [Fedilab](https://framagit.org/tom79/fedilab) Automatically uses the legacy API, see issue: https://framagit.org/tom79/fedilab/-/issues/520
## Entities ## Entities

View File

@ -0,0 +1,42 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Api\Mastodon\Accounts;
use Friendica\Core\System;
use Friendica\Module\BaseApi;
/**
* @see https://docs.joinmastodon.org/methods/accounts/
*/
class IdentityProofs extends BaseApi
{
/**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent(array $parameters = [])
{
self::login();
System::jsonExit([]);
}
}

View File

@ -0,0 +1,43 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Api\Mastodon;
use Friendica\Core\System;
use Friendica\Module\BaseApi;
/**
* @see https://docs.joinmastodon.org/methods/announcements/
*/
class Announcements extends BaseApi
{
/**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent(array $parameters = [])
{
self::login();
// @todo Possibly use the message from the pageheader addon for this
System::jsonExit([]);
}
}

View File

@ -0,0 +1,40 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Api\Mastodon;
use Friendica\Core\System;
use Friendica\Module\BaseApi;
/**
* @see https://docs.joinmastodon.org/methods/accounts/endorsements/
*/
class Endorsements extends BaseApi
{
/**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent(array $parameters = [])
{
System::jsonExit([]);
}
}

View File

@ -22,9 +22,9 @@
namespace Friendica\Module\Api\Mastodon; namespace Friendica\Module\Api\Mastodon;
use Friendica\Core\System; use Friendica\Core\System;
use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Module\BaseApi; use Friendica\Module\BaseApi;
use Friendica\Model\Group;
/** /**
* @see https://docs.joinmastodon.org/methods/timelines/lists/ * @see https://docs.joinmastodon.org/methods/timelines/lists/
@ -33,17 +33,55 @@ class Lists extends BaseApi
{ {
public static function delete(array $parameters = []) public static function delete(array $parameters = [])
{ {
self::unsupported('delete'); self::login();
$uid = self::getCurrentUserID();
if (empty($parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
if (!Group::exists($parameters['id'], $uid)) {
DI::mstdnError()->RecordNotFound();
}
if (!Group::remove($parameters['id'])) {
DI::mstdnError()->InternalError();
}
System::jsonExit([]);
} }
public static function post(array $parameters = []) public static function post(array $parameters = [])
{ {
self::unsupported('post'); self::login();
$uid = self::getCurrentUserID();
$title = $_REQUEST['title'] ?? '';
if (empty($title)) {
DI::mstdnError()->UnprocessableEntity();
}
Group::create($uid, $title);
$id = Group::getIdByName($uid, $title);
if (!$id) {
DI::mstdnError()->InternalError();
}
System::jsonExit(DI::mstdnList()->createFromGroupId($id));
} }
public static function put(array $parameters = []) public static function put(array $parameters = [])
{ {
self::unsupported('put'); $data = self::getPutData();
if (empty($data['title']) || empty($parameters['id'])) {
DI::mstdnError()->UnprocessableEntity();
}
Group::update($parameters['id'], $data['title']);
} }
/** /**
@ -58,14 +96,15 @@ class Lists extends BaseApi
if (empty($parameters['id'])) { if (empty($parameters['id'])) {
$lists = []; $lists = [];
$groups = DBA::select('group', ['id'], ['uid' => $uid, 'deleted' => false]); $groups = Group::getByUserId($uid);
while ($group = DBA::fetch($groups)) {
foreach ($groups as $group) {
$lists[] = DI::mstdnList()->createFromGroupId($group['id']); $lists[] = DI::mstdnList()->createFromGroupId($group['id']);
} }
DBA::close($groups);
} else { } else {
$id = $parameters['id']; $id = $parameters['id'];
if (!DBA::exists('group',['uid' => $uid, 'deleted' => false])) {
if (!Group::exists($id, $uid)) {
DI::mstdnError()->RecordNotFound(); DI::mstdnError()->RecordNotFound();
} }
$lists = DI::mstdnList()->createFromGroupId($id); $lists = DI::mstdnList()->createFromGroupId($id);

View File

@ -0,0 +1,47 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Api\Mastodon;
use Friendica\Core\System;
use Friendica\Module\BaseApi;
/**
* @see https://docs.joinmastodon.org/methods/timelines/markers/
*/
class Markers extends BaseApi
{
public static function post(array $parameters = [])
{
self::unsupported('post');
}
/**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent(array $parameters = [])
{
self::login();
System::jsonExit([]);
}
}

View File

@ -33,6 +33,7 @@ class Media extends BaseApi
{ {
public static function put(array $parameters = []) public static function put(array $parameters = [])
{ {
$data = self::getPutData();
self::unsupported('put'); self::unsupported('put');
} }

View File

@ -0,0 +1,40 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Api\Mastodon;
use Friendica\Core\System;
use Friendica\Module\BaseApi;
/**
* @see https://docs.joinmastodon.org/methods/proofs/
*/
class Proofs extends BaseApi
{
/**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent(array $parameters = [])
{
System::jsonError(404, ['error' => 'Record not found']);
}
}

View File

@ -0,0 +1,40 @@
<?php
/**
* @copyright Copyright (C) 2010-2021, the Friendica project
*
* @license GNU AGPL version 3 or any later version
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as
* published by the Free Software Foundation, either version 3 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
namespace Friendica\Module\Api\Mastodon;
use Friendica\Core\System;
use Friendica\Module\BaseApi;
/**
* @see https://docs.joinmastodon.org/methods/statuses/scheduled_statuses/
*/
class ScheduledStatuses extends BaseApi
{
/**
* @param array $parameters
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
*/
public static function rawContent(array $parameters = [])
{
System::jsonExit([]);
}
}

View File

@ -30,6 +30,12 @@ use Friendica\Module\BaseApi;
*/ */
class Statuses extends BaseApi class Statuses extends BaseApi
{ {
public static function post(array $parameters = [])
{
$data = self::getJsonPostData();
self::unsupported('post');
}
public static function delete(array $parameters = []) public static function delete(array $parameters = [])
{ {
self::unsupported('delete'); self::unsupported('delete');

View File

@ -21,7 +21,6 @@
namespace Friendica\Module; namespace Friendica\Module;
use Exception;
use Friendica\BaseModule; use Friendica\BaseModule;
use Friendica\Core\Logger; use Friendica\Core\Logger;
use Friendica\Core\System; use Friendica\Core\System;
@ -30,6 +29,7 @@ use Friendica\Database\DBA;
use Friendica\DI; use Friendica\DI;
use Friendica\Network\HTTPException; use Friendica\Network\HTTPException;
use Friendica\Util\DateTimeFormat; use Friendica\Util\DateTimeFormat;
use Friendica\Util\Network;
require_once __DIR__ . '/../../include/api.php'; require_once __DIR__ . '/../../include/api.php';
@ -127,6 +127,45 @@ class BaseApi extends BaseModule
System::jsonError(501, $errorobj->toArray()); System::jsonError(501, $errorobj->toArray());
} }
/**
* Get post data that is transmitted as JSON
*
* @return array request data
*/
public static function getJsonPostData()
{
$postdata = Network::postdata();
if (empty($postdata)) {
return [];
}
return json_decode($postdata, true);
}
/**
* Get request data for put requests
*
* @return array request data
*/
public static function getPutData()
{
$rawdata = Network::postdata();
if (empty($rawdata)) {
return [];
}
$putdata = [];
foreach (explode('&', $rawdata) as $value) {
$data = explode('=', $value);
if (count($data) == 2) {
$putdata[$data[0]] = urldecode($data[1]);
}
}
return $putdata;
}
/** /**
* Log in user via OAuth1 or Simple HTTP Auth. * Log in user via OAuth1 or Simple HTTP Auth.
* *

View File

@ -85,6 +85,6 @@ class Authorize extends BaseApi
DI::mstdnError()->UnprocessableEntity(); DI::mstdnError()->UnprocessableEntity();
} }
DI::app()->redirect($application['redirect_uri'] . '?' . http_build_query(['code' => $token['code'], 'state' => $state])); DI::app()->redirect($application['redirect_uri'] . (strpos($application['redirect_uri'], '?') ? '&' : '?') . http_build_query(['code' => $token['code'], 'state' => $state]));
} }
} }

View File

@ -41,6 +41,15 @@ class Token extends BaseApi
$client_id = $_REQUEST['client_id'] ?? ''; $client_id = $_REQUEST['client_id'] ?? '';
$client_secret = $_REQUEST['client_secret'] ?? ''; $client_secret = $_REQUEST['client_secret'] ?? '';
// AndStatus transmits the client data in the AUTHORIZATION header field, see https://github.com/andstatus/andstatus/issues/530
if (empty($client_id) && !empty($_SERVER['HTTP_AUTHORIZATION']) && (substr($_SERVER['HTTP_AUTHORIZATION'], 0, 6) == 'Basic ')) {
$datapair = explode(':', base64_decode(trim(substr($_SERVER['HTTP_AUTHORIZATION'], 6))));
if (count($datapair) == 2) {
$client_id = $datapair[0];
$client_secret = $datapair[1];
}
}
if ($grant_type != 'authorization_code') { if ($grant_type != 'authorization_code') {
Logger::warning('Unsupported or missing grant type', ['request' => $_REQUEST]); Logger::warning('Unsupported or missing grant type', ['request' => $_REQUEST]);
DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Unsupported or missing grant type')); DI::mstdnError()->UnprocessableEntity(DI::l10n()->t('Unsupported or missing grant type'));

View File

@ -57,52 +57,52 @@ return [
'/api' => [ '/api' => [
'/v1' => [ '/v1' => [
'/accounts' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/accounts' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/accounts/{id:\d+}' => [Module\Api\Mastodon\Accounts::class, [R::GET ]], '/accounts/{id:\d+}' => [Module\Api\Mastodon\Accounts::class, [R::GET ]],
'/accounts/{id:\d+}/statuses' => [Module\Api\Mastodon\Accounts\Statuses::class, [R::GET ]], '/accounts/{id:\d+}/statuses' => [Module\Api\Mastodon\Accounts\Statuses::class, [R::GET ]],
'/accounts/{id:\d+}/followers' => [Module\Api\Mastodon\Accounts\Followers::class, [R::GET ]], '/accounts/{id:\d+}/followers' => [Module\Api\Mastodon\Accounts\Followers::class, [R::GET ]],
'/accounts/{id:\d+}/following' => [Module\Api\Mastodon\Accounts\Following::class, [R::GET ]], '/accounts/{id:\d+}/following' => [Module\Api\Mastodon\Accounts\Following::class, [R::GET ]],
'/accounts/{id:\d+}/lists' => [Module\Api\Mastodon\Accounts\Lists::class, [R::GET ]], '/accounts/{id:\d+}/lists' => [Module\Api\Mastodon\Accounts\Lists::class, [R::GET ]],
'/accounts/{id:\d+}/identity_proofs' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/accounts/{id:\d+}/identity_proofs' => [Module\Api\Mastodon\Accounts\IdentityProofs::class, [R::GET ]], // Dummy, not supported
'/accounts/{id:\d+}/follow' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/{id:\d+}/follow' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/accounts/{id:\d+}/unfollow' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/{id:\d+}/unfollow' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/accounts/{id:\d+}/block' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/{id:\d+}/block' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/accounts/{id:\d+}/unblock' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/{id:\d+}/unblock' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/accounts/{id:\d+}/mute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/{id:\d+}/mute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/accounts/{id:\d+}/unmute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/{id:\d+}/unmute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/accounts/{id:\d+}/pin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/accounts/{id:\d+}/pin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/accounts/{id:\d+}/unpin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/accounts/{id:\d+}/unpin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/accounts/{id:\d+}/note' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/{id:\d+}/note' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/accounts/relationships' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/accounts/relationships' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/accounts/search' => [Module\Api\Mastodon\Accounts\Search::class, [R::GET ]], '/accounts/search' => [Module\Api\Mastodon\Accounts\Search::class, [R::GET ]],
'/accounts/verify_credentials' => [Module\Api\Mastodon\Accounts\VerifyCredentials::class, [R::GET ]], '/accounts/verify_credentials' => [Module\Api\Mastodon\Accounts\VerifyCredentials::class, [R::GET ]],
'/accounts/update_credentials' => [Module\Api\Mastodon\Unimplemented::class, [R::PATCH ]], '/accounts/update_credentials' => [Module\Api\Mastodon\Unimplemented::class, [R::PATCH ]], // @todo
'/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/accounts/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/admin/accounts/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/accounts/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/admin/accounts/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/admin/reports' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/admin/reports' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/reports/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/admin/reports/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/admin/reports/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/admin/reports/{id:\d+}/{action}' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/announcements' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/announcements' => [Module\Api\Mastodon\Announcements::class, [R::GET ]], // Dummy, not supported
'/announcements/{id:\d+}/dismiss' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/announcements/{id:\d+}/dismiss' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/announcements/{id:\d+}/reactions/{name}' => [Module\Api\Mastodon\Unimplemented::class, [R::PUT, R::DELETE]], // not implemented '/announcements/{id:\d+}/reactions/{name}' => [Module\Api\Mastodon\Unimplemented::class, [R::PUT, R::DELETE]], // not supported
'/apps' => [Module\Api\Mastodon\Apps::class, [ R::POST]], '/apps' => [Module\Api\Mastodon\Apps::class, [ R::POST]],
'/apps/verify_credentials' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/apps/verify_credentials' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
'/blocks' => [Module\Api\Mastodon\Blocks::class, [R::GET ]], '/blocks' => [Module\Api\Mastodon\Blocks::class, [R::GET ]],
'/bookmarks' => [Module\Api\Mastodon\Bookmarks::class, [R::GET ]], '/bookmarks' => [Module\Api\Mastodon\Bookmarks::class, [R::GET ]],
'/conversations' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/conversations' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
'/conversations/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented '/conversations/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented
'/conversations/{id:\d+}/read' => [Module\Api\Mastodon\Unimplemented::class, [R::POST ]], // not implemented '/conversations/{id:\d+}/read' => [Module\Api\Mastodon\Unimplemented::class, [R::POST ]], // not implemented
'/custom_emojis' => [Module\Api\Mastodon\CustomEmojis::class, [R::GET ]], '/custom_emojis' => [Module\Api\Mastodon\CustomEmojis::class, [R::GET ]],
'/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST, R::DELETE]], // not implemented '/domain_blocks' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST, R::DELETE]], // not supported
'/directory' => [Module\Api\Mastodon\Directory::class, [R::GET ]], '/directory' => [Module\Api\Mastodon\Directory::class, [R::GET ]],
'/endorsements' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/endorsements' => [Module\Api\Mastodon\Endorsements::class, [R::GET ]], // Dummy, not supported
'/favourites' => [Module\Api\Mastodon\Favourited::class, [R::GET ]], '/favourites' => [Module\Api\Mastodon\Favourited::class, [R::GET ]],
'/featured_tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST]], // not implemented '/featured_tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST]], // not supported
'/featured_tags/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented '/featured_tags/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not supported
'/featured_tags/suggestions' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/featured_tags/suggestions' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/filters' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/filters' => [Module\Api\Mastodon\Filters::class, [R::GET ]], // Dummy, not supported
'/filters/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST, R::PUT, R::DELETE]], // not implemented '/filters/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST, R::PUT, R::DELETE]], // not supported
'/follow_requests' => [Module\Api\Mastodon\FollowRequests::class, [R::GET ]], '/follow_requests' => [Module\Api\Mastodon\FollowRequests::class, [R::GET ]],
'/follow_requests/{id:\d+}/{action}' => [Module\Api\Mastodon\FollowRequests::class, [ R::POST]], '/follow_requests/{id:\d+}/{action}' => [Module\Api\Mastodon\FollowRequests::class, [ R::POST]],
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]], '/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
@ -111,35 +111,35 @@ return [
'/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]], '/lists' => [Module\Api\Mastodon\Lists::class, [R::GET, R::POST]],
'/lists/{id:\d+}' => [Module\Api\Mastodon\Lists::class, [R::GET, R::PUT, R::DELETE]], '/lists/{id:\d+}' => [Module\Api\Mastodon\Lists::class, [R::GET, R::PUT, R::DELETE]],
'/lists/{id:\d+}/accounts' => [Module\Api\Mastodon\Lists\Accounts::class, [R::GET, R::POST, R::DELETE]], '/lists/{id:\d+}/accounts' => [Module\Api\Mastodon\Lists\Accounts::class, [R::GET, R::POST, R::DELETE]],
'/markers' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST]], // not implemented '/markers' => [Module\Api\Mastodon\Markers::class, [R::GET, R::POST]], // Dummy, not supported
'/media' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/media' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/media/{id:\d+}' => [Module\Api\Mastodon\Media::class, [R::GET, R::PUT]], '/media/{id:\d+}' => [Module\Api\Mastodon\Media::class, [R::GET, R::PUT ]],
'/mutes' => [Module\Api\Mastodon\Mutes::class, [R::GET ]], '/mutes' => [Module\Api\Mastodon\Mutes::class, [R::GET ]],
'/notifications' => [Module\Api\Mastodon\Notifications::class, [R::GET ]], '/notifications' => [Module\Api\Mastodon\Notifications::class, [R::GET ]],
'/notifications/{id:\d+}' => [Module\Api\Mastodon\Notifications::class, [R::GET ]], '/notifications/{id:\d+}' => [Module\Api\Mastodon\Notifications::class, [R::GET ]],
'/notifications/clear' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/notifications/clear' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/notifications/{id:\d+}/dismiss' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/notifications/{id:\d+}/dismiss' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/polls/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/polls/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
'/polls/{id:\d+}/votes' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/polls/{id:\d+}/votes' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/preferences' => [Module\Api\Mastodon\Preferences::class, [R::GET ]], '/preferences' => [Module\Api\Mastodon\Preferences::class, [R::GET ]],
'/reports' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not implemented '/reports' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // not supported
'/scheduled_statuses' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented '/scheduled_statuses' => [Module\Api\Mastodon\ScheduledStatuses::class, [R::GET ]], // Dummy, not supported
'/scheduled_statuses/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::PUT, R::DELETE]], // not implemented '/scheduled_statuses/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::PUT, R::DELETE]], // not supported
'/statuses' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses' => [Module\Api\Mastodon\Statuses::class, [ R::POST]],
'/statuses/{id:\d+}' => [Module\Api\Mastodon\Statuses::class, [R::GET, R::DELETE]], '/statuses/{id:\d+}' => [Module\Api\Mastodon\Statuses::class, [R::GET, R::DELETE]],
'/statuses/{id:\d+}/context' => [Module\Api\Mastodon\Statuses\Context::class, [R::GET ]], '/statuses/{id:\d+}/context' => [Module\Api\Mastodon\Statuses\Context::class, [R::GET ]],
'/statuses/{id:\d+}/reblogged_by' => [Module\Api\Mastodon\Statuses\RebloggedBy::class, [R::GET ]], '/statuses/{id:\d+}/reblogged_by' => [Module\Api\Mastodon\Statuses\RebloggedBy::class, [R::GET ]],
'/statuses/{id:\d+}/favourited_by' => [Module\Api\Mastodon\Statuses\FavouritedBy::class, [R::GET ]], '/statuses/{id:\d+}/favourited_by' => [Module\Api\Mastodon\Statuses\FavouritedBy::class, [R::GET ]],
'/statuses/{id:\d+}/favourite' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/favourite' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/unfavourite' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/unfavourite' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/reblog' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/reblog' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/unreblog' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/unreblog' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/bookmark' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/bookmark' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/unbookmark' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/unbookmark' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/mute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/mute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/unmute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/unmute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/pin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/pin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/statuses/{id:\d+}/unpin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/unpin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], // @todo
'/suggestions' => [Module\Api\Mastodon\Suggestions::class, [R::GET ]], '/suggestions' => [Module\Api\Mastodon\Suggestions::class, [R::GET ]],
'/suggestions/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented '/suggestions/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented
'/timelines/home' => [Module\Api\Mastodon\Timelines\Home::class, [R::GET ]], '/timelines/home' => [Module\Api\Mastodon\Timelines\Home::class, [R::GET ]],
@ -152,14 +152,15 @@ return [
'/search' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo '/search' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
], ],
'/friendica' => [ '/friendica' => [
'/profile/show' => [Module\Api\Friendica\Profile\Show::class , [R::GET ]], '/profile/show' => [Module\Api\Friendica\Profile\Show::class, [R::GET ]],
'/events' => [Module\Api\Friendica\Events\Index::class , [R::GET ]], '/events' => [Module\Api\Friendica\Events\Index::class, [R::GET ]],
], ],
'/followers/ids' => [Module\Api\Twitter\FollowersIds::class , [R::GET ]], '/followers/ids' => [Module\Api\Twitter\FollowersIds::class, [R::GET ]],
'/followers/list' => [Module\Api\Twitter\FollowersList::class , [R::GET ]], '/followers/list' => [Module\Api\Twitter\FollowersList::class, [R::GET ]],
'/friends/ids' => [Module\Api\Twitter\FriendsIds::class , [R::GET ]], '/friends/ids' => [Module\Api\Twitter\FriendsIds::class, [R::GET ]],
'/friends/list' => [Module\Api\Twitter\FriendsList::class , [R::GET ]], '/friends/list' => [Module\Api\Twitter\FriendsList::class, [R::GET ]],
'/oembed' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/oembed' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]],
'/proofs' => [Module\Api\Mastodon\Proofs::class, [R::GET ]], // Dummy, not supported
], ],
'/admin' => [ '/admin' => [
@ -363,8 +364,6 @@ return [
'/pretheme' => [Module\ThemeDetails::class, [R::GET]], '/pretheme' => [Module\ThemeDetails::class, [R::GET]],
'/probe' => [Module\Debug\Probe::class, [R::GET]], '/probe' => [Module\Debug\Probe::class, [R::GET]],
'/proofs' => [Module\Api\Mastodon\Unimplemented::class, [R::GET]],
'/profile/{nickname}' => $profileRoutes, '/profile/{nickname}' => $profileRoutes,
'/u/{nickname}' => $profileRoutes, '/u/{nickname}' => $profileRoutes,
'/~{nickname}' => $profileRoutes, '/~{nickname}' => $profileRoutes,