diff --git a/doc/API-Mastodon.md b/doc/API-Mastodon.md index 588947cc3..574c5eb7f 100644 --- a/doc/API-Mastodon.md +++ b/doc/API-Mastodon.md @@ -17,6 +17,7 @@ These endpoints use the [Mastodon API entities](https://docs.joinmastodon.org/en - [`GET /api/v1//accounts/:id`](https://docs.joinmastodon.org/methods/accounts/#retrieve-information) - [`GET /api/v1//accounts/:id/statuses`](https://docs.joinmastodon.org/methods/accounts/#retrieve-information) +- [`GET /api/v1//accounts/verify_credentials`](https://docs.joinmastodon.org/methods/accounts) - [`GET /api/v1/custom_emojis`](https://docs.joinmastodon.org/methods/instance/custom_emojis/) - Doesn't return unicode emojis since they aren't using an image URL @@ -36,7 +37,12 @@ These endpoints use the [Mastodon API entities](https://docs.joinmastodon.org/en - [`GET /api/v1/instance`](https://docs.joinmastodon.org/methods/instance#fetch-instance) - [`GET /api/v1/instance/peers`](https://docs.joinmastodon.org/methods/instance#list-of-connected-domains) +- [`GET /api/v1/statuses/:id`](https://docs.joinmastodon.org/methods/statuses/) +- [`GET /api/v1/suggestions`](https://docs.joinmastodon.org/methods/accounts/suggestions/) +- [`GET /api/v1/timelines/home`](https://docs.joinmastodon.org/methods/timelines/) +- [`GET /api/v1/timelines/list/:id`](https://docs.joinmastodon.org/methods/timelines/) - [`GET /api/v1/timelines/public`](https://docs.joinmastodon.org/methods/timelines/) +- [`GET /api/v1/timelines/tag/:hashtag`](https://docs.joinmastodon.org/methods/timelines/) - [`GET /api/v1/trends`](https://docs.joinmastodon.org/methods/instance/trends/) ## Non-implemented endpoints diff --git a/src/App/Module.php b/src/App/Module.php index 4771ecf58..7ad4261aa 100644 --- a/src/App/Module.php +++ b/src/App/Module.php @@ -276,11 +276,23 @@ class Module $profiler->set(microtime(true) - $timestamp, 'init'); - if ($server['REQUEST_METHOD'] === 'POST') { + if ($server['REQUEST_METHOD'] === Router::DELETE) { + call_user_func([$this->module_class, 'delete'], $this->module_parameters); + } + + if ($server['REQUEST_METHOD'] === Router::PATCH) { + call_user_func([$this->module_class, 'patch'], $this->module_parameters); + } + + if ($server['REQUEST_METHOD'] === Router::POST) { Core\Hook::callAll($this->module . '_mod_post', $post); call_user_func([$this->module_class, 'post'], $this->module_parameters); } + if ($server['REQUEST_METHOD'] === Router::PUT) { + call_user_func([$this->module_class, 'put'], $this->module_parameters); + } + Core\Hook::callAll($this->module . '_mod_afterpost', $placeholder); call_user_func([$this->module_class, 'afterpost'], $this->module_parameters); diff --git a/src/BaseModule.php b/src/BaseModule.php index 19b58ad06..cb8f8c790 100644 --- a/src/BaseModule.php +++ b/src/BaseModule.php @@ -72,6 +72,26 @@ abstract class BaseModule return $o; } + /** + * Module DELETE method to process submitted data + * + * Extend this method if the module is supposed to process DELETE requests. + * Doesn't display any content + */ + public static function delete(array $parameters = []) + { + } + + /** + * Module PATCH method to process submitted data + * + * Extend this method if the module is supposed to process PATCH requests. + * Doesn't display any content + */ + public static function patch(array $parameters = []) + { + } + /** * Module POST method to process submitted data * @@ -92,6 +112,16 @@ abstract class BaseModule { } + /** + * Module PUT method to process submitted data + * + * Extend this method if the module is supposed to process PUT requests. + * Doesn't display any content + */ + public static function put(array $parameters = []) + { + } + /* * Functions used to protect against Cross-Site Request Forgery * The security token has to base on at least one value that an attacker can't know - here it's the session ID and the private key. diff --git a/src/Factory/Api/Mastodon/Status.php b/src/Factory/Api/Mastodon/Status.php index b157d809a..310fa26bb 100644 --- a/src/Factory/Api/Mastodon/Status.php +++ b/src/Factory/Api/Mastodon/Status.php @@ -23,6 +23,7 @@ namespace Friendica\Factory\Api\Mastodon; use Friendica\App\BaseURL; use Friendica\BaseFactory; +use Friendica\Content\ContactSelector; use Friendica\Content\Text\BBCode; use Friendica\Database\DBA; use Friendica\DI; @@ -60,9 +61,9 @@ class Status extends BaseFactory */ public function createFromUriId(int $uriId, $uid = 0) { - $fields = ['uri-id', 'uid', 'author-id', 'starred', 'app', 'title', 'body', 'raw-body', 'created', + $fields = ['uri-id', 'uid', 'author-id', 'author-link', 'starred', 'app', 'title', 'body', 'raw-body', 'created', 'network', 'thr-parent-id', 'parent-author-id', 'language', 'uri', 'plink', 'private', 'vid', 'gravity']; - $item = Post::selectFirst($fields, ['uri-id' => $uriId, 'uid' => $uid]); + $item = Post::selectFirst($fields, ['uri-id' => $uriId, 'uid' => [0, $uid]], ['order' => ['uid' => true]]); if (!$item) { throw new HTTPException\NotFoundException('Item with URI ID ' . $uriId . 'not found' . ($uid ? ' for user ' . $uid : '.')); } @@ -70,21 +71,21 @@ class Status extends BaseFactory $account = DI::mstdnAccount()->createFromContactId($item['author-id']); $counts = new \Friendica\Object\Api\Mastodon\Status\Counts( - Post::count(['thr-parent-id' => $uriId, 'uid' => $uid, 'gravity' => GRAVITY_COMMENT]), - Post::count(['thr-parent-id' => $uriId, 'uid' => $uid, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::ANNOUNCE)]), - Post::count(['thr-parent-id' => $uriId, 'uid' => $uid, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::LIKE)]) + Post::count(['thr-parent-id' => $uriId, 'gravity' => GRAVITY_COMMENT], [], false), + Post::count(['thr-parent-id' => $uriId, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::ANNOUNCE)], [], false), + Post::count(['thr-parent-id' => $uriId, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::LIKE)], [], false) ); $userAttributes = new \Friendica\Object\Api\Mastodon\Status\UserAttributes( Post::exists(['thr-parent-id' => $uriId, 'uid' => $uid, 'origin' => true, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::LIKE)]), Post::exists(['thr-parent-id' => $uriId, 'uid' => $uid, 'origin' => true, 'gravity' => GRAVITY_ACTIVITY, 'vid' => Verb::getID(Activity::ANNOUNCE)]), - Post\ThreadUser::getIgnored($uriId, $item['uid']), + Post\ThreadUser::getIgnored($uriId, $uid), (bool)$item['starred'], - Post\ThreadUser::getPinned($uriId, $item['uid']) + Post\ThreadUser::getPinned($uriId, $uid) ); $sensitive = DBA::exists('tag-view', ['uri-id' => $uriId, 'name' => 'nsfw']); - $application = new \Friendica\Object\Api\Mastodon\Application($item['app'] ?? ''); + $application = new \Friendica\Object\Api\Mastodon\Application($item['app'] ?: ContactSelector::networkToName($item['network'], $item['author-link'])); $mentions = DI::mstdnMention()->createFromUriId($uriId); $tags = DI::mstdnTag()->createFromUriId($uriId); @@ -95,7 +96,7 @@ class Status extends BaseFactory if ($item['vid'] == Verb::getID(Activity::ANNOUNCE)) { $reshare = $this->createFromUriId($item['thr-parent-id'], $uid)->toArray(); - $reshared_item = Post::selectFirst(['title', 'body'], ['uri-id' => $item['thr-parent-id'], 'uid' => $uid]); + $reshared_item = Post::selectFirst(['title', 'body'], ['uri-id' => $item['thr-parent-id'], 'uid' => [0, $uid]]); $item['title'] = $reshared_item['title'] ?? $item['title']; $item['body'] = $reshared_item['body'] ?? $item['body']; } else { diff --git a/src/Model/Post.php b/src/Model/Post.php index 864e2a574..9ce301ade 100644 --- a/src/Model/Post.php +++ b/src/Model/Post.php @@ -127,12 +127,13 @@ class Post * Check if post data exists * * @param array $condition array of fields for condition + * @param bool $user_mode true = post-user-view, false = post-view * * @return boolean Are there rows for that condition? * @throws \Exception */ - public static function exists($condition) { - return DBA::exists('post-user-view', $condition); + public static function exists($condition, bool $user_mode = true) { + return DBA::exists($user_mode ? 'post-user-view' : 'post-view', $condition); } /** @@ -140,6 +141,7 @@ class Post * * @param array $condition array of fields for condition * @param array $params Array of several parameters + * @param bool $user_mode true = post-user-view, false = post-view * * @return int * @@ -151,9 +153,9 @@ class Post * $count = Post::count($condition); * @throws \Exception */ - public static function count(array $condition = [], array $params = []) + public static function count(array $condition = [], array $params = [], bool $user_mode = true) { - return DBA::count('post-user-view', $condition, $params); + return DBA::count($user_mode ? 'post-user-view' : 'post-view', $condition, $params); } /** diff --git a/src/Model/Post/Media.php b/src/Model/Post/Media.php index b975a0902..6f78b0905 100644 --- a/src/Model/Post/Media.php +++ b/src/Model/Post/Media.php @@ -21,7 +21,6 @@ namespace Friendica\Model\Post; -use Friendica\Content\PageInfo; use Friendica\Content\Text\BBCode; use Friendica\Core\Logger; use Friendica\Core\System; @@ -67,6 +66,11 @@ class Media return; } + if (DBA::exists('post-media', ['uri-id' => $media['uri-id'], 'preview' => $media['url']])) { + Logger::info('Media already exists as preview', ['uri-id' => $media['uri-id'], 'url' => $media['url'], 'callstack' => System::callstack()]); + return; + } + // "document" has got the lowest priority. So when the same file is both attached as document // and embedded as picture then we only store the picture or replace the document $found = DBA::selectFirst('post-media', ['type'], ['uri-id' => $media['uri-id'], 'url' => $media['url']]); @@ -499,6 +503,7 @@ class Media $height = 0; $selected = ''; + $previews = []; foreach ($media as $medium) { foreach ($links as $link) { @@ -507,6 +512,17 @@ class Media } } + // Avoid adding separate media entries for previews + foreach ($previews as $preview) { + if (Strings::compareLink($preview, $medium['url'])) { + continue 2; + } + } + + if (!empty($medium['preview'])) { + $previews[] = $medium['preview']; + } + $type = explode('/', current(explode(';', $medium['mimetype']))); if (count($type) < 2) { Logger::info('Unknown MimeType', ['type' => $type, 'media' => $medium]); diff --git a/src/Module/Api/Mastodon/Accounts.php b/src/Module/Api/Mastodon/Accounts.php index 6e868d131..0d48744a4 100644 --- a/src/Module/Api/Mastodon/Accounts.php +++ b/src/Module/Api/Mastodon/Accounts.php @@ -46,7 +46,7 @@ class Accounts extends BaseApi DI::mstdnError()->RecordNotFound(); } - $account = DI::mstdnAccount()->createFromContactId($id); + $account = DI::mstdnAccount()->createFromContactId($id, self::getCurrentUserID()); System::jsonExit($account); } } diff --git a/src/Module/Api/Mastodon/Accounts/Followers.php b/src/Module/Api/Mastodon/Accounts/Followers.php new file mode 100644 index 000000000..739341a2f --- /dev/null +++ b/src/Module/Api/Mastodon/Accounts/Followers.php @@ -0,0 +1,86 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon\Accounts; + +use Friendica\Core\System; +use Friendica\Database\DBA; +use Friendica\DI; +use Friendica\Module\BaseApi; + +/** + * @see https://docs.joinmastodon.org/methods/accounts/ + */ +class Followers extends BaseApi +{ + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + self::login(); + $uid = self::getCurrentUserID(); + + if (empty($parameters['id'])) { + DI::mstdnError()->RecordNotFound(); + } + + $id = $parameters['id']; + if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { + DI::mstdnError()->RecordNotFound(); + } + + // Return results older than this id + $max_id = (int)!isset($_REQUEST['max_id']) ? 0 : $_REQUEST['max_id']; + // Return results newer than this id + $since_id = (int)!isset($_REQUEST['since_id']) ? 0 : $_REQUEST['since_id']; + // Maximum number of results to return. Defaults to 20. + $limit = (int)!isset($_REQUEST['limit']) ? 20 : $_REQUEST['limit']; + + + $params = ['order' => ['cid' => true], 'limit' => $limit]; + + $condition = ['relation-cid' => $id, 'follows' => true]; + + if (!empty($max_id)) { + $condition = DBA::mergeConditions($condition, ["`cid` < ?", $max_id]); + } + + if (!empty($since_id)) { + $condition = DBA::mergeConditions($condition, ["`cid` > ?", $since_id]); + } + + if (!empty($min_id)) { + $condition = DBA::mergeConditions($condition, ["`cid` > ?", $min_id]); + + $params['order'] = ['cid']; + } + + $followers = DBA::select('contact-relation', ['cid'], $condition, $parameters); + while ($follower = DBA::fetch($followers)) { + $accounts[] = DI::mstdnAccount()->createFromContactId($follower['cid'], $uid); + } + DBA::close($followers); + + System::jsonExit($accounts); + } +} diff --git a/src/Module/Api/Mastodon/Accounts/Following.php b/src/Module/Api/Mastodon/Accounts/Following.php new file mode 100644 index 000000000..10d73e907 --- /dev/null +++ b/src/Module/Api/Mastodon/Accounts/Following.php @@ -0,0 +1,86 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon\Accounts; + +use Friendica\Core\System; +use Friendica\Database\DBA; +use Friendica\DI; +use Friendica\Module\BaseApi; + +/** + * @see https://docs.joinmastodon.org/methods/accounts/ + */ +class Following extends BaseApi +{ + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + self::login(); + $uid = self::getCurrentUserID(); + + if (empty($parameters['id'])) { + DI::mstdnError()->RecordNotFound(); + } + + $id = $parameters['id']; + if (!DBA::exists('contact', ['id' => $id, 'uid' => 0])) { + DI::mstdnError()->RecordNotFound(); + } + + // Return results older than this id + $max_id = (int)!isset($_REQUEST['max_id']) ? 0 : $_REQUEST['max_id']; + // Return results newer than this id + $since_id = (int)!isset($_REQUEST['since_id']) ? 0 : $_REQUEST['since_id']; + // Maximum number of results to return. Defaults to 20. + $limit = (int)!isset($_REQUEST['limit']) ? 20 : $_REQUEST['limit']; + + + $params = ['order' => ['relation-cid' => true], 'limit' => $limit]; + + $condition = ['cid' => $id, 'follows' => true]; + + if (!empty($max_id)) { + $condition = DBA::mergeConditions($condition, ["`relation-cid` < ?", $max_id]); + } + + if (!empty($since_id)) { + $condition = DBA::mergeConditions($condition, ["`relation-cid` > ?", $since_id]); + } + + if (!empty($min_id)) { + $condition = DBA::mergeConditions($condition, ["`relation-cid` > ?", $min_id]); + + $params['order'] = ['cid']; + } + + $followers = DBA::select('contact-relation', ['relation-cid'], $condition, $parameters); + while ($follower = DBA::fetch($followers)) { + $accounts[] = DI::mstdnAccount()->createFromContactId($follower['relation-cid'], $uid); + } + DBA::close($followers); + + System::jsonExit($accounts); + } +} diff --git a/src/Module/Api/Mastodon/Accounts/Statuses.php b/src/Module/Api/Mastodon/Accounts/Statuses.php index d21a1f535..14cd19e42 100644 --- a/src/Module/Api/Mastodon/Accounts/Statuses.php +++ b/src/Module/Api/Mastodon/Accounts/Statuses.php @@ -64,12 +64,23 @@ class Statuses extends BaseApi $params = ['order' => ['uri-id' => true], 'limit' => $limit]; - $condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], - 'uid' => 0, 'network' => Protocol::FEDERATED]; + $uid = self::getCurrentUserID(); + + if (!$uid) { + $condition = ['author-id' => $id, 'private' => [Item::PUBLIC, Item::UNLISTED], + 'uid' => 0, 'network' => Protocol::FEDERATED]; + } else { + $condition = ["`author-id` = ? AND (`uid` = 0 OR (`uid` = ? AND NOT `global`))", $id, $uid]; + } $condition = DBA::mergeConditions($condition, ["(`gravity` IN (?, ?) OR (`gravity` = ? AND `vid` = ?))", GRAVITY_PARENT, GRAVITY_COMMENT, GRAVITY_ACTIVITY, Verb::getID(Activity::ANNOUNCE)]); + if ($only_media) { + $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))", + Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]); + } + if (!empty($max_id)) { $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $max_id]); } @@ -83,11 +94,11 @@ class Statuses extends BaseApi $params['order'] = ['uri-id']; } - $items = Post::selectForUser(0, ['uri-id', 'uid'], $condition, $params); + $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); $statuses = []; while ($item = Post::fetch($items)) { - $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $item['uid']); + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); } DBA::close($items); diff --git a/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php b/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php new file mode 100644 index 000000000..94fa32684 --- /dev/null +++ b/src/Module/Api/Mastodon/Accounts/VerifyCredentials.php @@ -0,0 +1,58 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon\Accounts; + +use Friendica\Core\System; +use Friendica\DI; +use Friendica\Model\Contact; +use Friendica\Model\User; +use Friendica\Module\BaseApi; + +/** + * @see https://docs.joinmastodon.org/methods/accounts/ + */ +class VerifyCredentials extends BaseApi +{ + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + self::login(); + $uid = self::getCurrentUserID(); + + $self = User::getOwnerDataById($uid); + if (empty($self)) { + DI::mstdnError()->RecordNotFound(); + } + + $cdata = Contact::getPublicAndUserContacID($self['id'], $uid); + if (empty($cdata)) { + DI::mstdnError()->RecordNotFound(); + } + + // @todo Support the source property, + $account = DI::mstdnAccount()->createFromContactId($cdata['user'], $uid); + System::jsonExit($account); + } +} diff --git a/src/Module/Api/Mastodon/Statuses.php b/src/Module/Api/Mastodon/Statuses.php new file mode 100644 index 000000000..042d038a2 --- /dev/null +++ b/src/Module/Api/Mastodon/Statuses.php @@ -0,0 +1,50 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon; + +use Friendica\Core\System; +use Friendica\DI; +use Friendica\Module\BaseApi; + +/** + * @see https://docs.joinmastodon.org/methods/statuses/ + */ +class Statuses extends BaseApi +{ + public static function delete(array $parameters = []) + { + self::unsupported('delete'); + } + + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + if (empty($parameters['id'])) { + DI::mstdnError()->RecordNotFound(); + } + + System::jsonExit(DI::mstdnStatus()->createFromUriId($parameters['id'], self::getCurrentUserID())); + } +} diff --git a/src/Module/Api/Mastodon/Suggestions.php b/src/Module/Api/Mastodon/Suggestions.php new file mode 100644 index 000000000..97cfa11d3 --- /dev/null +++ b/src/Module/Api/Mastodon/Suggestions.php @@ -0,0 +1,56 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon; + +use Friendica\Core\System; +use Friendica\DI; +use Friendica\Model\Contact; +use Friendica\Module\BaseApi; + +/** + * @see https://docs.joinmastodon.org/methods/accounts/suggestions/ + */ +class Suggestions extends BaseApi +{ + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + self::login(); + $uid = self::getCurrentUserID(); + + // Maximum number of results to return. Defaults to 40. + $limit = (int)!isset($_REQUEST['limit']) ? 40 : $_REQUEST['limit']; + + $suggestions = Contact\Relation::getSuggestions($uid, 0, $limit); + + $accounts = []; + + foreach ($suggestions as $suggestion) { + $accounts[] = DI::mstdnAccount()->createFromContactId($suggestion['id'], $uid); + } + + System::jsonExit($accounts); + } +} diff --git a/src/Module/Api/Mastodon/Timelines/Home.php b/src/Module/Api/Mastodon/Timelines/Home.php new file mode 100644 index 000000000..c46c485fa --- /dev/null +++ b/src/Module/Api/Mastodon/Timelines/Home.php @@ -0,0 +1,92 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon\Timelines; + +use Friendica\Core\System; +use Friendica\Database\DBA; +use Friendica\DI; +use Friendica\Model\Post; +use Friendica\Module\BaseApi; +use Friendica\Network\HTTPException; + +/** + * @see https://docs.joinmastodon.org/methods/timelines/ + */ +class Home extends BaseApi +{ + /** + * @param array $parameters + * @throws HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + self::login(); + $uid = self::getCurrentUserID(); + + // Return results older than id + $max_id = (int)!isset($_REQUEST['max_id']) ? 0 : $_REQUEST['max_id']; + // Return results newer than id + $since_id = (int)!isset($_REQUEST['since_id']) ? 0 : $_REQUEST['since_id']; + // Return results immediately newer than id + $min_id = (int)!isset($_REQUEST['min_id']) ? 0 : $_REQUEST['min_id']; + // Maximum number of results to return. Defaults to 20. + $limit = (int)!isset($_REQUEST['limit']) ? 20 : $_REQUEST['limit']; + // Return only local statuses? Defaults to false. + $local = (bool)!isset($_REQUEST['local']) ? false : ($_REQUEST['local'] == 'true'); + + $params = ['order' => ['uri-id' => true], 'limit' => $limit]; + + $condition = ['gravity' => [GRAVITY_PARENT, GRAVITY_COMMENT], 'uid' => $uid]; + + if ($local) { + $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]); + } + + if (!empty($max_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $max_id]); + } + + if (!empty($since_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $since_id]); + } + + if (!empty($min_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $min_id]); + + $params['order'] = ['uri-id']; + } + + $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); + + $statuses = []; + while ($item = Post::fetch($items)) { + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + } + DBA::close($items); + + if (!empty($min_id)) { + array_reverse($statuses); + } + + System::jsonExit($statuses); + } +} diff --git a/src/Module/Api/Mastodon/Timelines/ListTimeline.php b/src/Module/Api/Mastodon/Timelines/ListTimeline.php new file mode 100644 index 000000000..df5c21122 --- /dev/null +++ b/src/Module/Api/Mastodon/Timelines/ListTimeline.php @@ -0,0 +1,91 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon\Timelines; + +use Friendica\Core\System; +use Friendica\Database\DBA; +use Friendica\DI; +use Friendica\Model\Post; +use Friendica\Module\BaseApi; +use Friendica\Network\HTTPException; + +/** + * @see https://docs.joinmastodon.org/methods/timelines/ + */ +class ListTimeline extends BaseApi +{ + /** + * @param array $parameters + * @throws HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + self::login(); + $uid = self::getCurrentUserID(); + + if (empty($parameters['id'])) { + DI::mstdnError()->RecordNotFound(); + } + + // Return results older than id + $max_id = (int)!isset($_REQUEST['max_id']) ? 0 : $_REQUEST['max_id']; + // Return results newer than id + $since_id = (int)!isset($_REQUEST['since_id']) ? 0 : $_REQUEST['since_id']; + // Return results immediately newer than id + $min_id = (int)!isset($_REQUEST['min_id']) ? 0 : $_REQUEST['min_id']; + // Maximum number of results to return. Defaults to 20. + $limit = (int)!isset($_REQUEST['limit']) ? 20 : $_REQUEST['limit']; + + $params = ['order' => ['uri-id' => true], 'limit' => $limit]; + + $condition = ["`uid` = ? AND `gravity` IN (?, ?) AND `contact-id` IN (SELECT `contact-id` FROM `group_member` WHERE `gid` = ?)", + $uid, GRAVITY_PARENT, GRAVITY_COMMENT, $parameters['id']]; + + if (!empty($max_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $max_id]); + } + + if (!empty($since_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $since_id]); + } + + if (!empty($min_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $min_id]); + + $params['order'] = ['uri-id']; + } + + $items = Post::selectForUser($uid, ['uri-id'], $condition, $params); + + $statuses = []; + while ($item = Post::fetch($items)) { + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + } + DBA::close($items); + + if (!empty($min_id)) { + array_reverse($statuses); + } + + System::jsonExit($statuses); + } +} diff --git a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php index 694ed46b8..a0a975d20 100644 --- a/src/Module/Api/Mastodon/Timelines/PublicTimeline.php +++ b/src/Module/Api/Mastodon/Timelines/PublicTimeline.php @@ -69,6 +69,11 @@ class PublicTimeline extends BaseApi $condition = DBA::mergeConditions($condition, ["NOT `uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]); } + if ($only_media) { + $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))", + Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]); + } + if (!empty($max_id)) { $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $max_id]); } diff --git a/src/Module/Api/Mastodon/Timelines/Tag.php b/src/Module/Api/Mastodon/Timelines/Tag.php new file mode 100644 index 000000000..f61e3c3f7 --- /dev/null +++ b/src/Module/Api/Mastodon/Timelines/Tag.php @@ -0,0 +1,106 @@ +. + * + */ + +namespace Friendica\Module\Api\Mastodon\Timelines; + +use Friendica\Core\Protocol; +use Friendica\Core\System; +use Friendica\Database\DBA; +use Friendica\DI; +use Friendica\Model\Post; +use Friendica\Module\BaseApi; +use Friendica\Network\HTTPException; + +/** + * @see https://docs.joinmastodon.org/methods/timelines/ + */ +class Tag extends BaseApi +{ + /** + * @param array $parameters + * @throws HTTPException\InternalServerErrorException + */ + public static function rawContent(array $parameters = []) + { + self::login(); + $uid = self::getCurrentUserID(); + + if (empty($parameters['hashtag'])) { + DI::mstdnError()->RecordNotFound(); + } + + // If true, return only local statuses. Defaults to false. + $local = (bool)!isset($_REQUEST['local']) ? false : ($_REQUEST['local'] == 'true'); + // If true, return only statuses with media attachments. Defaults to false. + $only_media = (bool)!isset($_REQUEST['only_media']) ? false : ($_REQUEST['only_media'] == 'true'); // Currently not supported + // Return results older than this ID. + $max_id = (int)!isset($_REQUEST['max_id']) ? 0 : $_REQUEST['max_id']; + // Return results newer than this ID. + $since_id = (int)!isset($_REQUEST['since_id']) ? 0 : $_REQUEST['since_id']; + // Return results immediately newer than this ID. + $min_id = (int)!isset($_REQUEST['min_id']) ? 0 : $_REQUEST['min_id']; + // Maximum number of results to return. Defaults to 20. + $limit = (int)!isset($_REQUEST['limit']) ? 20 : $_REQUEST['limit']; + + $params = ['order' => ['uri-id' => true], 'limit' => $limit]; + + $condition = ["`name` = ? AND (`uid` = ? OR (`uid` = ? AND NOT `global`)) + AND (`network` IN (?, ?, ?, ?) OR (`uid` = ? AND `uid` != ?))", + $parameters['hashtag'], 0, $uid, Protocol::ACTIVITYPUB, Protocol::DFRN, Protocol::DIASPORA, Protocol::OSTATUS, $uid, 0]; + + if ($local) { + $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-user` WHERE `origin`)"]); + } + + if ($only_media) { + $condition = DBA::mergeConditions($condition, ["`uri-id` IN (SELECT `uri-id` FROM `post-media` WHERE `type` IN (?, ?, ?))", + Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO]); + } + + if (!empty($max_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` < ?", $max_id]); + } + + if (!empty($since_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $since_id]); + } + + if (!empty($min_id)) { + $condition = DBA::mergeConditions($condition, ["`uri-id` > ?", $min_id]); + + $params['order'] = ['uri-id']; + } + + $items = DBA::select('tag-search-view', ['uri-id'], $condition, $params); + + $statuses = []; + while ($item = Post::fetch($items)) { + $statuses[] = DI::mstdnStatus()->createFromUriId($item['uri-id'], $uid); + } + DBA::close($items); + + if (!empty($min_id)) { + array_reverse($statuses); + } + + System::jsonExit($statuses); + } +} diff --git a/src/Module/Api/Mastodon/Unimplemented.php b/src/Module/Api/Mastodon/Unimplemented.php index 082bd38f0..fa9618818 100644 --- a/src/Module/Api/Mastodon/Unimplemented.php +++ b/src/Module/Api/Mastodon/Unimplemented.php @@ -21,9 +21,6 @@ namespace Friendica\Module\Api\Mastodon; -use Friendica\Core\Logger; -use Friendica\Core\System; -use Friendica\DI; use Friendica\Module\BaseApi; /** @@ -31,17 +28,48 @@ use Friendica\Module\BaseApi; */ class Unimplemented extends BaseApi { + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function delete(array $parameters = []) + { + self::unsupported('delete'); + } + + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function patch(array $parameters = []) + { + self::unsupported('patch'); + } + + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function post(array $parameters = []) + { + self::unsupported('post'); + } + + /** + * @param array $parameters + * @throws \Friendica\Network\HTTPException\InternalServerErrorException + */ + public static function put(array $parameters = []) + { + self::unsupported('put'); + } + /** * @param array $parameters * @throws \Friendica\Network\HTTPException\InternalServerErrorException */ public static function rawContent(array $parameters = []) { - $path = DI::args()->getQueryString(); - Logger::info('Unimplemented API call', ['path' => $path]); - $error = DI::l10n()->t('API endpoint "%s" is not implemented', $path); - $error_description = DI::l10n()->t('The API endpoint is currently not implemented but might be in the future.');; - $errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description); - System::jsonError(501, $errorobj->toArray()); + self::unsupported('get'); } } diff --git a/src/Module/BaseApi.php b/src/Module/BaseApi.php index c161159e2..c3f11b0eb 100644 --- a/src/Module/BaseApi.php +++ b/src/Module/BaseApi.php @@ -22,6 +22,8 @@ namespace Friendica\Module; use Friendica\BaseModule; +use Friendica\Core\Logger; +use Friendica\Core\System; use Friendica\DI; use Friendica\Network\HTTPException; @@ -53,6 +55,32 @@ class BaseApi extends BaseModule } } + public static function delete(array $parameters = []) + { + if (!api_user()) { + throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); + } + + $a = DI::app(); + + if (!empty($a->user['uid']) && $a->user['uid'] != api_user()) { + throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); + } + } + + public static function patch(array $parameters = []) + { + if (!api_user()) { + throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); + } + + $a = DI::app(); + + if (!empty($a->user['uid']) && $a->user['uid'] != api_user()) { + throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); + } + } + public static function post(array $parameters = []) { if (!api_user()) { @@ -66,6 +94,29 @@ class BaseApi extends BaseModule } } + public static function put(array $parameters = []) + { + if (!api_user()) { + throw new HTTPException\UnauthorizedException(DI::l10n()->t('Permission denied.')); + } + + $a = DI::app(); + + if (!empty($a->user['uid']) && $a->user['uid'] != api_user()) { + throw new HTTPException\ForbiddenException(DI::l10n()->t('Permission denied.')); + } + } + + public static function unsupported(string $method = 'all') + { + $path = DI::args()->getQueryString(); + Logger::info('Unimplemented API call', ['path' => $path, 'method' => $method]); + $error = DI::l10n()->t('API endpoint %s %s is not implemented', strtoupper($method), $path); + $error_description = DI::l10n()->t('The API endpoint is currently not implemented but might be in the future.');; + $errorobj = new \Friendica\Object\Api\Mastodon\Error($error, $error_description); + System::jsonError(501, $errorobj->toArray()); + } + /** * Log in user via OAuth1 or Simple HTTP Auth. * diff --git a/static/routes.config.php b/static/routes.config.php index ec92b37ad..d66169559 100644 --- a/static/routes.config.php +++ b/static/routes.config.php @@ -60,8 +60,8 @@ return [ '/accounts' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/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+}/followers' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], - '/accounts/{id:\d+}/following' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], + '/accounts/{id:\d+}/followers' => [Module\Api\Mastodon\Accounts\Followers::class, [R::GET ]], + '/accounts/{id:\d+}/following' => [Module\Api\Mastodon\Accounts\Followers::class, [R::GET ]], '/accounts/{id:\d+}/lists' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/accounts/{id:\d+}/identity_proofs' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/accounts/{id:\d+}/follow' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], @@ -75,7 +75,7 @@ return [ '/accounts/{id:\d+}/note' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/accounts/relationships' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/accounts/search' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], - '/accounts/verify_credentials' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], + '/accounts/verify_credentials' => [Module\Api\Mastodon\Accounts\VerifyCredentials::class, [R::GET ]], '/accounts/update_credentials' => [Module\Api\Mastodon\Unimplemented::class, [R::PATCH ]], '/admin/accounts' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/admin/accounts/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], @@ -126,7 +126,7 @@ return [ '/scheduled_statuses' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/scheduled_statuses/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::PUT, R::DELETE]], '/statuses' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], - '/statuses/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET, R::DELETE]], + '/statuses/{id:\d+}' => [Module\Api\Mastodon\Statuses::class, [R::GET, R::DELETE]], '/statuses/{id:\d+}/context' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/statuses/{id:\d+}/reblogged_by' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], '/statuses/{id:\d+}/favourited_by' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], @@ -140,12 +140,12 @@ return [ '/statuses/{id:\d+}/unmute' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/pin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], '/statuses/{id:\d+}/unpin' => [Module\Api\Mastodon\Unimplemented::class, [ R::POST]], - '/suggestions' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], + '/suggestions' => [Module\Api\Mastodon\Suggestions::class, [R::GET ]], '/suggestions/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::class, [R::DELETE ]], - '/timelines/home' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], - '/timelines/list/{id:\d+}' => [Module\Api\Mastodon\Unimplemented::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/public' => [Module\Api\Mastodon\Timelines\PublicTimeline::class, [R::GET ]], - '/timelines/tag/{hashtag}' => [Module\Api\Mastodon\Unimplemented::class, [R::GET ]], + '/timelines/tag/{hashtag}' => [Module\Api\Mastodon\Timelines\Tag::class, [R::GET ]], '/trends' => [Module\Api\Mastodon\Trends::class, [R::GET ]], ], '/v2' => [ diff --git a/view/lang/C/messages.po b/view/lang/C/messages.po index ca67882c8..2cf315854 100644 --- a/view/lang/C/messages.po +++ b/view/lang/C/messages.po @@ -8,7 +8,7 @@ msgid "" msgstr "" "Project-Id-Version: 2021.06-dev\n" "Report-Msgid-Bugs-To: \n" -"POT-Creation-Date: 2021-05-04 09:08-0400\n" +"POT-Creation-Date: 2021-05-08 12:25+0000\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME \n" "Language-Team: LANGUAGE \n" @@ -829,7 +829,10 @@ msgstr "" #: mod/unfollow.php:82 mod/wall_attach.php:78 mod/wall_attach.php:81 #: mod/wall_upload.php:99 mod/wall_upload.php:102 mod/wallmessage.php:35 #: mod/wallmessage.php:59 mod/wallmessage.php:96 mod/wallmessage.php:120 -#: src/Module/Attach.php:56 src/Module/BaseApi.php:59 src/Module/BaseApi.php:65 +#: src/Module/Attach.php:56 src/Module/BaseApi.php:61 src/Module/BaseApi.php:67 +#: src/Module/BaseApi.php:74 src/Module/BaseApi.php:80 +#: src/Module/BaseApi.php:87 src/Module/BaseApi.php:93 +#: src/Module/BaseApi.php:100 src/Module/BaseApi.php:106 #: src/Module/BaseNotifications.php:88 src/Module/Contact.php:385 #: src/Module/Contact/Advanced.php:43 src/Module/Delegation.php:118 #: src/Module/FollowConfirm.php:16 src/Module/FriendSuggest.php:44 @@ -1163,8 +1166,8 @@ msgstr "" #: mod/dfrn_request.php:600 mod/display.php:179 mod/photos.php:836 #: mod/videos.php:129 src/Module/Conversation/Community.php:188 #: src/Module/Debug/Probe.php:39 src/Module/Debug/WebFinger.php:38 -#: src/Module/Directory.php:49 src/Module/Search/Index.php:51 -#: src/Module/Search/Index.php:56 +#: src/Module/Directory.php:49 src/Module/Search/Index.php:50 +#: src/Module/Search/Index.php:55 msgid "Public access denied." msgstr "" @@ -3043,31 +3046,31 @@ msgstr "" msgid "Page not found." msgstr "" -#: src/BaseModule.php:150 +#: src/BaseModule.php:180 msgid "" "The form security token was not correct. This probably happened because the " "form has been opened for too long (>3 hours) before submitting it." msgstr "" -#: src/BaseModule.php:179 +#: src/BaseModule.php:209 msgid "All contacts" msgstr "" -#: src/BaseModule.php:184 src/Content/Widget.php:238 src/Core/ACL.php:183 +#: src/BaseModule.php:214 src/Content/Widget.php:238 src/Core/ACL.php:183 #: src/Module/Contact.php:860 src/Module/PermissionTooltip.php:77 #: src/Module/PermissionTooltip.php:99 msgid "Followers" msgstr "" -#: src/BaseModule.php:189 src/Content/Widget.php:239 src/Module/Contact.php:861 +#: src/BaseModule.php:219 src/Content/Widget.php:239 src/Module/Contact.php:861 msgid "Following" msgstr "" -#: src/BaseModule.php:194 src/Content/Widget.php:240 src/Module/Contact.php:862 +#: src/BaseModule.php:224 src/Content/Widget.php:240 src/Module/Contact.php:862 msgid "Mutual friends" msgstr "" -#: src/BaseModule.php:202 +#: src/BaseModule.php:232 msgid "Common" msgstr "" @@ -3504,7 +3507,7 @@ msgid "Addon applications, utilities, games" msgstr "" #: src/Content/Nav.php:220 src/Content/Text/HTML.php:899 -#: src/Module/Search/Index.php:100 +#: src/Module/Search/Index.php:99 msgid "Search" msgstr "" @@ -3662,39 +3665,39 @@ msgstr "" msgid "last" msgstr "" -#: src/Content/Text/BBCode.php:941 src/Content/Text/BBCode.php:1615 -#: src/Content/Text/BBCode.php:1616 +#: src/Content/Text/BBCode.php:942 src/Content/Text/BBCode.php:1605 +#: src/Content/Text/BBCode.php:1606 msgid "Image/photo" msgstr "" -#: src/Content/Text/BBCode.php:1063 +#: src/Content/Text/BBCode.php:1064 #, php-format msgid "" "%2$s %3$s" msgstr "" -#: src/Content/Text/BBCode.php:1088 src/Model/Item.php:3020 -#: src/Model/Item.php:3026 +#: src/Content/Text/BBCode.php:1089 src/Model/Item.php:3024 +#: src/Model/Item.php:3030 msgid "link to source" msgstr "" -#: src/Content/Text/BBCode.php:1533 src/Content/Text/HTML.php:951 +#: src/Content/Text/BBCode.php:1523 src/Content/Text/HTML.php:951 msgid "Click to open/close" msgstr "" -#: src/Content/Text/BBCode.php:1564 +#: src/Content/Text/BBCode.php:1554 msgid "$1 wrote:" msgstr "" -#: src/Content/Text/BBCode.php:1618 src/Content/Text/BBCode.php:1619 +#: src/Content/Text/BBCode.php:1608 src/Content/Text/BBCode.php:1609 msgid "Encrypted content" msgstr "" -#: src/Content/Text/BBCode.php:1832 +#: src/Content/Text/BBCode.php:1822 msgid "Invalid source protocol" msgstr "" -#: src/Content/Text/BBCode.php:1847 +#: src/Content/Text/BBCode.php:1837 msgid "Invalid link protocol" msgstr "" @@ -4846,15 +4849,15 @@ msgstr "" msgid "Content warning: %s" msgstr "" -#: src/Model/Item.php:2985 +#: src/Model/Item.php:2989 msgid "bytes" msgstr "" -#: src/Model/Item.php:3014 +#: src/Model/Item.php:3018 msgid "View on separate page" msgstr "" -#: src/Model/Item.php:3015 +#: src/Model/Item.php:3019 msgid "view on separate page" msgstr "" @@ -7218,16 +7221,6 @@ msgstr "" msgid "Deny" msgstr "" -#: src/Module/Api/Mastodon/Unimplemented.php:42 -#, php-format -msgid "API endpoint \"%s\" is not implemented" -msgstr "" - -#: src/Module/Api/Mastodon/Unimplemented.php:43 -msgid "" -"The API endpoint is currently not implemented but might be in the future." -msgstr "" - #: src/Module/Api/Twitter/ContactEndpoint.php:65 src/Module/Contact.php:400 msgid "Contact not found" msgstr "" @@ -7330,6 +7323,16 @@ msgstr "" msgid "User registrations waiting for confirmation" msgstr "" +#: src/Module/BaseApi.php:114 +#, php-format +msgid "API endpoint %s %s is not implemented" +msgstr "" + +#: src/Module/BaseApi.php:115 +msgid "" +"The API endpoint is currently not implemented but might be in the future." +msgstr "" + #: src/Module/BaseProfile.php:55 src/Module/Contact.php:947 msgid "Profile Details" msgstr "" @@ -7684,7 +7687,7 @@ msgstr "" msgid "Search your contacts" msgstr "" -#: src/Module/Contact.php:883 src/Module/Search/Index.php:193 +#: src/Module/Contact.php:883 src/Module/Search/Index.php:192 #, php-format msgid "Results for: %s" msgstr "" @@ -7924,8 +7927,8 @@ msgstr "" msgid "Hide" msgstr "" -#: src/Module/Conversation/Community.php:149 src/Module/Search/Index.php:140 -#: src/Module/Search/Index.php:180 +#: src/Module/Conversation/Community.php:149 src/Module/Search/Index.php:139 +#: src/Module/Search/Index.php:179 msgid "No results." msgstr "" @@ -9107,15 +9110,15 @@ msgid "" "or %s directly on your system." msgstr "" -#: src/Module/Search/Index.php:55 +#: src/Module/Search/Index.php:54 msgid "Only logged in users are permitted to perform a search." msgstr "" -#: src/Module/Search/Index.php:77 +#: src/Module/Search/Index.php:76 msgid "Only one search per minute is permitted for not logged in users." msgstr "" -#: src/Module/Search/Index.php:191 +#: src/Module/Search/Index.php:190 #, php-format msgid "Items tagged with: %s" msgstr ""