API: Support new tag endpoints
This commit is contained in:
parent
1cecc51796
commit
0e2c2cd0e0
|
@ -51,6 +51,6 @@ AddType audio/ogg .oga
|
||||||
|
|
||||||
RewriteCond %{REQUEST_FILENAME} !-f
|
RewriteCond %{REQUEST_FILENAME} !-f
|
||||||
RewriteCond %{REQUEST_FILENAME} !-d
|
RewriteCond %{REQUEST_FILENAME} !-d
|
||||||
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA]
|
RewriteRule ^(.*)$ index.php?pagename=$1 [E=REMOTE_USER:%{HTTP:Authorization},L,QSA,B]
|
||||||
|
|
||||||
</IfModule>
|
</IfModule>
|
||||||
|
|
|
@ -0,0 +1,48 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2010-2022, 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\App\Router;
|
||||||
|
use Friendica\Core\Logger;
|
||||||
|
use Friendica\DI;
|
||||||
|
use Friendica\Module\BaseApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see https://docs.joinmastodon.org/methods/tags/
|
||||||
|
*/
|
||||||
|
class Tags extends BaseApi
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||||
|
*/
|
||||||
|
protected function rawContent(array $request = [])
|
||||||
|
{
|
||||||
|
self::checkAllowedScope(self::SCOPE_READ);
|
||||||
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
|
if (empty($this->parameters['hashtag'])) {
|
||||||
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response->unsupported(Router::GET, $request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2010-2022, 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\Tags;
|
||||||
|
|
||||||
|
use Friendica\App\Router;
|
||||||
|
use Friendica\DI;
|
||||||
|
use Friendica\Module\BaseApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see https://docs.joinmastodon.org/methods/tags/#follow
|
||||||
|
*/
|
||||||
|
class Follow extends BaseApi
|
||||||
|
{
|
||||||
|
protected function post(array $request = [])
|
||||||
|
{
|
||||||
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
|
if (empty($this->parameters['hashtag'])) {
|
||||||
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response->unsupported(Router::POST, $request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* @copyright Copyright (C) 2010-2022, 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\Tags;
|
||||||
|
|
||||||
|
use Friendica\App\Router;
|
||||||
|
use Friendica\DI;
|
||||||
|
use Friendica\Module\BaseApi;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see https://docs.joinmastodon.org/methods/tags/#unfollow
|
||||||
|
*/
|
||||||
|
class Unfollow extends BaseApi
|
||||||
|
{
|
||||||
|
protected function post(array $request = [])
|
||||||
|
{
|
||||||
|
self::checkAllowedScope(self::SCOPE_WRITE);
|
||||||
|
$uid = self::getCurrentUserID();
|
||||||
|
|
||||||
|
if (empty($this->parameters['hashtag'])) {
|
||||||
|
DI::mstdnError()->UnprocessableEntity();
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->response->unsupported(Router::POST, $request);
|
||||||
|
}
|
||||||
|
}
|
|
@ -235,10 +235,10 @@ return [
|
||||||
'/featured_tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::POST]], // not supported
|
'/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 supported
|
'/featured_tags/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not supported
|
||||||
'/featured_tags/suggestions' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
|
'/featured_tags/suggestions' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
|
||||||
'/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 supported
|
'/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]],
|
||||||
|
'/followed_tags' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
|
||||||
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
|
'/instance' => [Module\Api\Mastodon\Instance::class, [R::GET ]],
|
||||||
'/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
|
'/instance/activity' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // @todo
|
||||||
'/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]],
|
'/instance/peers' => [Module\Api\Mastodon\Instance\Peers::class, [R::GET ]],
|
||||||
|
@ -289,6 +289,9 @@ return [
|
||||||
'/streaming/user' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
|
'/streaming/user' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
|
||||||
'/streaming/user/notification' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
|
'/streaming/user/notification' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not implemented
|
||||||
'/suggestions/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented
|
'/suggestions/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], // not implemented
|
||||||
|
'/tags/{hashtag}' => [Module\Api\Mastodon\Tags::class, [R::GET ]],
|
||||||
|
'/tags/{hashtag}/follow' => [Module\Api\Mastodon\Tags\Follow::class, [ R::POST]],
|
||||||
|
'/tags/{hashtag}/unfollow' => [Module\Api\Mastodon\Tags\Unfollow::class, [ R::POST]],
|
||||||
'/timelines/direct' => [Module\Api\Mastodon\Timelines\Direct::class, [R::GET ]],
|
'/timelines/direct' => [Module\Api\Mastodon\Timelines\Direct::class, [R::GET ]],
|
||||||
'/timelines/home' => [Module\Api\Mastodon\Timelines\Home::class, [R::GET ]],
|
'/timelines/home' => [Module\Api\Mastodon\Timelines\Home::class, [R::GET ]],
|
||||||
'/timelines/list/{id:\d+}' => [Module\Api\Mastodon\Timelines\ListTimeline::class, [R::GET ]],
|
'/timelines/list/{id:\d+}' => [Module\Api\Mastodon\Timelines\ListTimeline::class, [R::GET ]],
|
||||||
|
@ -301,6 +304,7 @@ return [
|
||||||
],
|
],
|
||||||
'/v{version:\d+}' => [
|
'/v{version:\d+}' => [
|
||||||
'/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
|
'/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], // not supported
|
||||||
|
'/filters' => [Module\Api\Mastodon\Filters::class, [R::GET ]], // Dummy, not supported
|
||||||
'/media' => [Module\Api\Mastodon\Media::class, [ R::POST]],
|
'/media' => [Module\Api\Mastodon\Media::class, [ R::POST]],
|
||||||
'/search' => [Module\Api\Mastodon\Search::class, [R::GET ]],
|
'/search' => [Module\Api\Mastodon\Search::class, [R::GET ]],
|
||||||
'/suggestions' => [Module\Api\Mastodon\Suggestions::class, [R::GET ]],
|
'/suggestions' => [Module\Api\Mastodon\Suggestions::class, [R::GET ]],
|
||||||
|
|
Loading…
Reference in New Issue
Block a user