diff options
author | Maxence Lange <maxence@artificial-owl.com> | 2018-12-05 09:05:21 -0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-12-05 09:05:21 -0100 |
commit | 5c6081f2cc2bbff141ae6ea439e4af190e04046a (patch) | |
tree | d0b9444f7c0e7413b7a794e90e857d975671d70a | |
parent | 523e2304392d9247f5e7872ab8ea11230174b66e (diff) | |
parent | c3bd113694ef1e50f811684f8a71e9132ed10733 (diff) |
Merge pull request #134 from nextcloud-gmbh/fix-timeline
Timeline, followers & account public messages
-rw-r--r-- | appinfo/routes.php | 1 | ||||
-rw-r--r-- | lib/Controller/ActivityPubController.php | 14 | ||||
-rw-r--r-- | lib/Controller/LocalController.php | 88 | ||||
-rw-r--r-- | lib/Db/CoreRequestBuilder.php | 37 | ||||
-rw-r--r-- | lib/Db/FollowsRequest.php | 3 | ||||
-rw-r--r-- | lib/Db/FollowsRequestBuilder.php | 4 | ||||
-rw-r--r-- | lib/Db/NotesRequest.php | 57 | ||||
-rw-r--r-- | lib/Db/NotesRequestBuilder.php | 17 | ||||
-rw-r--r-- | lib/Model/ActivityPub/Follow.php | 28 | ||||
-rw-r--r-- | lib/Service/ActivityPub/FollowService.php | 12 | ||||
-rw-r--r-- | lib/Service/ActivityPub/NoteService.php | 59 | ||||
-rw-r--r-- | lib/Service/ActivityService.php | 3 | ||||
-rw-r--r-- | lib/Service/CurlService.php | 8 | ||||
-rw-r--r-- | src/components/Composer.vue | 4 | ||||
-rw-r--r-- | src/components/TimelineEntry.vue | 7 | ||||
-rw-r--r-- | src/components/TimelineList.vue | 122 | ||||
-rw-r--r-- | src/store/timeline.js | 26 | ||||
-rw-r--r-- | src/views/ProfileTimeline.vue | 20 | ||||
-rw-r--r-- | src/views/Timeline.vue | 117 |
19 files changed, 431 insertions, 196 deletions
diff --git a/appinfo/routes.php b/appinfo/routes.php index 7fc4b1fb..6a595a4e 100644 --- a/appinfo/routes.php +++ b/appinfo/routes.php @@ -68,6 +68,7 @@ return [ ['name' => 'Local#streamTimeline', 'url' => '/api/v1/stream/timeline', 'verb' => 'GET'], ['name' => 'Local#streamFederated', 'url' => '/api/v1/stream/federated', 'verb' => 'GET'], ['name' => 'Local#streamDirect', 'url' => '/api/v1/stream/direct', 'verb' => 'GET'], + ['name' => 'Local#streamAccount', 'url' => '/api/v1/account/{username}/stream', 'verb' => 'GET'], ['name' => 'Local#postCreate', 'url' => '/api/v1/post', 'verb' => 'POST'], ['name' => 'Local#postDelete', 'url' => '/api/v1/post', 'verb' => 'DELETE'], diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php index b4cc6de5..ce92a2e5 100644 --- a/lib/Controller/ActivityPubController.php +++ b/lib/Controller/ActivityPubController.php @@ -170,7 +170,7 @@ class ActivityPubController extends Controller { try { $body = file_get_contents('php://input'); - $this->miscService->log('Shared Inbox: ' . $body, 0); + $this->miscService->log('[<<] shared-inbox: ' . $body, 1); $origin = $this->activityService->checkRequest($this->request); @@ -205,7 +205,7 @@ class ActivityPubController extends Controller { try { $body = file_get_contents('php://input'); - $this->miscService->log('Inbox: ' . $body, 0); + $this->miscService->log('[<<] inbox: ' . $body, 1); $origin = $this->activityService->checkRequest($this->request); @@ -323,6 +323,16 @@ class ActivityPubController extends Controller { // uncomment this line to display the result that would be return to an ActivityPub service (TEST) // return true; + // TODO - cleaner to being able to parse: + // - 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' + // - 'application/activity+json, application/ld+json' + $accept = explode(',', $this->request->getHeader('Accept')); + $accept = array_map('trim', $accept); + + if (in_array('application/ld+json', $accept)) { + return true; + } + if ($this->request->getHeader('Accept') === 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"') { return true; diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index a1c564b4..2e31350a 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -33,12 +33,11 @@ namespace OCA\Social\Controller; use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse; use daita\MySmallPhpTools\Traits\TArrayTools; use Exception; -use OC\User\NoUserException; use OCA\Social\AppInfo\Application; -use OCA\Social\Exceptions\AccountAlreadyExistsException; -use OCA\Social\Exceptions\ActorDoesNotExistException; +use OCA\Social\Exceptions\AccountDoesNotExistException; use OCA\Social\Exceptions\InvalidResourceException; use OCA\Social\Model\ActivityPub\ACore; +use OCA\Social\Model\ActivityPub\Person; use OCA\Social\Model\Post; use OCA\Social\Service\ActivityPub\DocumentService; use OCA\Social\Service\ActivityPub\FollowService; @@ -51,7 +50,6 @@ use OCP\AppFramework\Controller; use OCP\AppFramework\Http; use OCP\AppFramework\Http\DataResponse; use OCP\AppFramework\Http\FileDisplayResponse; -use OCP\AppFramework\Http\NotFoundResponse; use OCP\AppFramework\Http\Response; use OCP\IRequest; @@ -93,6 +91,10 @@ class LocalController extends Controller { private $miscService; + /** @var Person */ + private $viewer; + + /** * LocalController constructor. * @@ -204,10 +206,36 @@ class LocalController extends Controller { * @return DataResponse */ public function streamHome($since = 0, int $limit = 5): DataResponse { + try { + $this->initViewer(true); + $posts = $this->noteService->getStreamHome($this->viewer->getId(), $since, $limit); + + return $this->success($posts); + } catch (Exception $e) { + return $this->fail($e); + } + } + + /** + * // TODO: Delete the NoCSRF check + * + * @NoCSRFRequired + * @NoAdminRequired + * @NoSubAdminRequired + * + * @param string $username + * @param int $since + * @param int $limit + * + * @return DataResponse + */ + public function streamAccount(string $username, $since = 0, int $limit = 5): DataResponse { try { - $actor = $this->actorService->getActorFromUserId($this->userId); - $posts = $this->noteService->getHomeNotesForActor($actor, $since, $limit); + $this->initViewer(); + + $account = $this->actorService->getActor($username); + $posts = $this->noteService->getStreamAccount($account->getId(), $since, $limit); return $this->success($posts); } catch (Exception $e) { @@ -229,10 +257,9 @@ class LocalController extends Controller { * @return DataResponse */ public function streamDirect(int $since = 0, int $limit = 5): DataResponse { - try { - $actor = $this->actorService->getActorFromUserId($this->userId); - $posts = $this->noteService->getDirectNotesForActor($actor, $since, $limit); + $this->initViewer(); + $posts = $this->noteService->getStreamDirect($this->viewer->getId(), $since, $limit); return $this->success($posts); } catch (Exception $e) { @@ -257,7 +284,7 @@ class LocalController extends Controller { */ public function streamTimeline(int $since = 0, int $limit = 5): DataResponse { try { - $posts = $this->noteService->getLocalTimeline($since, $limit); + $posts = $this->noteService->getStreamLocalTimeline($since, $limit); return $this->success($posts); } catch (Exception $e) { @@ -281,7 +308,7 @@ class LocalController extends Controller { */ public function streamFederated(int $since = 0, int $limit = 5): DataResponse { try { - $posts = $this->noteService->getFederatedTimeline($since, $limit); + $posts = $this->noteService->getStreamGlobalTimeline($since, $limit); return $this->success($posts); } catch (Exception $e) { @@ -368,9 +395,9 @@ class LocalController extends Controller { * @return DataResponse */ public function currentFollowers(): DataResponse { - $this->initViewer(); - try { + $this->initViewer(); + $actor = $this->actorService->getActorFromUserId($this->userId); $followers = $this->followService->getFollowers($actor); @@ -389,9 +416,9 @@ class LocalController extends Controller { * @return DataResponse */ public function currentFollowing(): DataResponse { - $this->initViewer(); - try { + $this->initViewer(); + $actor = $this->actorService->getActorFromUserId($this->userId); $followers = $this->followService->getFollowing($actor); @@ -415,9 +442,8 @@ class LocalController extends Controller { * @return DataResponse */ public function accountInfo(string $username): DataResponse { - $this->initViewer(); - try { + $this->initViewer(); $actor = $this->actorService->getActor($username); $actor = $this->personService->getFromLocalAccount($actor->getPreferredUsername()); @@ -462,9 +488,10 @@ class LocalController extends Controller { * @return DataResponse */ public function accountFollowing(string $username): DataResponse { - $this->initViewer(); try { + $this->initViewer(); + $actor = $this->actorService->getActor($username); $following = $this->followService->getFollowing($actor); @@ -488,9 +515,9 @@ class LocalController extends Controller { * @return DataResponse */ public function globalAccountInfo(string $account): DataResponse { - $this->initViewer(); - try { + $this->initViewer(); + $actor = $this->personService->getFromAccount($account); return $this->success(['account' => $actor]); @@ -513,9 +540,8 @@ class LocalController extends Controller { * @return DataResponse */ public function globalActorInfo(string $id): DataResponse { - $this->initViewer(); - try { + $this->initViewer(); $actor = $this->personService->getFromId($id); return $this->success(['actor' => $actor]); @@ -617,14 +643,22 @@ class LocalController extends Controller { /** - * @throws Exception + * + * @param bool $exception + * + * @throws AccountDoesNotExistException */ - private function initViewer() { + private function initViewer(bool $exception = false) { try { - $viewer = $this->actorService->getActorFromUserId($this->userId, true); - $this->followService->setViewerId($viewer->getId()); - $this->personService->setViewerId($viewer->getId()); + $this->viewer = $this->actorService->getActorFromUserId($this->userId, true); + + $this->followService->setViewerId($this->viewer->getId()); + $this->personService->setViewerId($this->viewer->getId()); + $this->noteService->setViewerId($this->viewer->getId()); } catch (Exception $e) { + if ($exception) { + throw new AccountDoesNotExistException(); + } } } diff --git a/lib/Db/CoreRequestBuilder.php b/lib/Db/CoreRequestBuilder.php index 9db10b90..b6e0780e 100644 --- a/lib/Db/CoreRequestBuilder.php +++ b/lib/Db/CoreRequestBuilder.php @@ -218,10 +218,10 @@ class CoreRequestBuilder { * * @param IQueryBuilder $qb * @param bool $accepted + * @param string $alias */ - protected function limitToAccepted(IQueryBuilder &$qb, bool $accepted) { - $this->limitToDBField($qb, 'accepted', ($accepted) ? '1' : '0'); - + protected function limitToAccepted(IQueryBuilder &$qb, bool $accepted, string $alias = '') { + $this->limitToDBField($qb, 'accepted', ($accepted) ? '1' : '0', true, $alias); } @@ -458,13 +458,37 @@ class CoreRequestBuilder { * @param IQueryBuilder $qb * @param string $field * @param int $value + * @param string $alias + */ + protected function limitToDBFieldInt( + IQueryBuilder &$qb, string $field, int $value, string $alias = '' + ) { + $expr = $this->exprLimitToDBFieldInt($qb, $field, $value, $alias); + $qb->andWhere($expr); + } + + + /** + * @param IQueryBuilder $qb + * @param string $field + * @param int $value + * @param string $alias + * + * @return string */ - protected function limitToDBFieldInt(IQueryBuilder &$qb, string $field, int $value) { + protected function exprLimitToDBFieldInt( + IQueryBuilder &$qb, string $field, int $value, string $alias = '' + ): string { $expr = $qb->expr(); - $pf = ($qb->getType() === QueryBuilder::SELECT) ? $this->defaultSelectAlias . '.' : ''; + + $pf = ''; + if ($qb->getType() === QueryBuilder::SELECT) { + $pf = (($alias === '') ? $this->defaultSelectAlias : $alias) . '.'; + } $field = $pf . $field; - $qb->andWhere($expr->eq($field, $qb->createNamedParameter($value))); + + return $expr->eq($field, $qb->createNamedParameter($value)); } @@ -688,6 +712,7 @@ class CoreRequestBuilder { } $andX = $expr->andX(); + $andX->add($this->exprLimitToDBFieldInt($qb, 'accepted', 1, $prefix . '_f')); if ($asFollower === true) { $andX->add( $expr->eq( diff --git a/lib/Db/FollowsRequest.php b/lib/Db/FollowsRequest.php index 4861b878..708f2513 100644 --- a/lib/Db/FollowsRequest.php +++ b/lib/Db/FollowsRequest.php @@ -152,6 +152,7 @@ class FollowsRequest extends FollowsRequestBuilder { public function getByFollowId(string $followId): array { $qb = $this->getFollowsSelectSql(); $this->limitToFollowId($qb, $followId); + $this->limitToAccepted($qb, true); $this->leftJoinCacheActors($qb, 'actor_id'); $follows = []; @@ -173,6 +174,7 @@ class FollowsRequest extends FollowsRequestBuilder { public function getFollowersByActorId(string $actorId): array { $qb = $this->getFollowsSelectSql(); $this->limitToOBjectId($qb, $actorId); + $this->limitToAccepted($qb, true); $this->leftJoinCacheActors($qb, 'actor_id'); $this->leftJoinDetails($qb, 'id', 'ca'); $qb->orderBy('creation', 'desc'); @@ -196,6 +198,7 @@ class FollowsRequest extends FollowsRequestBuilder { public function getFollowingByActorId(string $actorId): array { $qb = $this->getFollowsSelectSql(); $this->limitToActorId($qb, $actorId); + $this->limitToAccepted($qb, true); $this->leftJoinCacheActors($qb, 'object_id'); $this->leftJoinDetails($qb, 'id', 'ca'); $qb->orderBy('creation', 'desc'); diff --git a/lib/Db/FollowsRequestBuilder.php b/lib/Db/FollowsRequestBuilder.php index 25c0686a..01e08442 100644 --- a/lib/Db/FollowsRequestBuilder.php +++ b/lib/Db/FollowsRequestBuilder.php @@ -83,7 +83,9 @@ class FollowsRequestBuilder extends CoreRequestBuilder { $qb = $this->dbConnection->getQueryBuilder(); /** @noinspection PhpMethodParametersCountMismatchInspection */ - $qb->select('f.id', 'f.type', 'f.actor_id', 'f.object_id', 'f.follow_id', 'f.creation') + $qb->select( + 'f.id', 'f.type', 'f.actor_id', 'f.object_id', 'f.follow_id', 'f.accepted', 'f.creation' + ) ->from(self::TABLE_SERVER_FOLLOWS, 'f'); $this->defaultSelectAlias = 'f'; diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php index 36e3e930..b4de9316 100644 --- a/lib/Db/NotesRequest.php +++ b/lib/Db/NotesRequest.php @@ -156,17 +156,22 @@ class NotesRequest extends NotesRequestBuilder { /** + * Should returns: + * * Own posts, + * * Followed accounts + * * @param string $actorId * @param int $since * @param int $limit * * @return array */ - public function getHomeNotesForActorId(string $actorId, int $since = 0, int $limit = 5): array { + public function getStreamHome(string $actorId, int $since = 0, int $limit = 5): array { $qb = $this->getNotesSelectSql(); $this->rightJoinFollowing($qb); $this->limitToActorId($qb, $actorId, 'f'); + $this->limitToAccepted($qb, true, 'f'); $qb->orWhere($this->exprLimitToDBField($qb, 'attributed_to', $actorId)); $this->limitPaginate($qb, $since, $limit); @@ -184,19 +189,21 @@ class NotesRequest extends NotesRequestBuilder { /** + * Should returns: + * * public message from actorId. + * - to followers-only if follower is logged. + * + * @param string $actorId * @param int $since * @param int $limit - * @param bool $localOnly * * @return array */ - public function getPublicNotes(int $since = 0, int $limit = 5, bool $localOnly = true): array { + public function getStreamAccount(string $actorId, int $since = 0, int $limit = 5): array { $qb = $this->getNotesSelectSql(); $this->limitToRecipient($qb, ActivityService::TO_PUBLIC); $this->limitPaginate($qb, $since, $limit); - if ($localOnly) { - $this->limitToLocal($qb, true); - } + $this->limitToAttributedTo($qb, $actorId); $this->leftJoinCacheActors($qb, 'attributed_to'); $notes = []; @@ -211,14 +218,17 @@ class NotesRequest extends NotesRequestBuilder { /** + * Should returns: + * * Private message. + * - group messages. + * * @param string $actorId * @param int $since * @param int $limit * * @return array */ - public function getDirectNotesForActorId(string $actorId, int $since = 0, int $limit = 5 - ): array { + public function getStreamDirect(string $actorId, int $since = 0, int $limit = 5): array { $qb = $this->getNotesSelectSql(); $this->limitToRecipient($qb, $actorId, true); $this->limitPaginate($qb, $since, $limit); @@ -236,6 +246,37 @@ class NotesRequest extends NotesRequestBuilder { /** + * Should returns: + * - All local public/federated posts + * + * @param int $since + * @param int $limit + * @param bool $localOnly + * + * @return array + */ + public function getStreamTimeline(int $since = 0, int $limit = 5, bool $localOnly = true + ): array { + $qb = $this->getNotesSelectSql(); + $this->limitToRecipient($qb, ActivityService::TO_PUBLIC); + $this->limitPaginate($qb, $since, $limit); + if ($localOnly) { + $this->limitToLocal($qb, true); + } + $this->leftJoinCacheActors($qb, 'attributed_to'); + + $notes = []; + $cursor = $qb->execute(); + while ($data = $cursor->fetch()) { + $notes[] = $this->parseNotesSelectSql($data); + } + $cursor->closeCursor(); + + return $notes; + } + + + /** * @param string $id */ public function deleteNoteById(string $id) { diff --git a/lib/Db/NotesRequestBuilder.php b/lib/Db/NotesRequestBuilder.php index 79be40e6..9b68a4d9 100644 --- a/lib/Db/NotesRequestBuilder.php +++ b/lib/Db/NotesRequestBuilder.php @@ -80,7 +80,8 @@ class NotesRequestBuilder extends CoreRequestBuilder { /** @noinspection PhpMethodParametersCountMismatchInspection */ $qb->select( - 'sn.id', 'sn.type', 'sn.to', 'sn.to_array', 'sn.cc', 'sn.bcc', 'sn.content', 'sn.summary', + 'sn.id', 'sn.type', 'sn.to', 'sn.to_array', 'sn.cc', 'sn.bcc', 'sn.content', + 'sn.summary', 'sn.published', 'sn.published_time', 'sn.attributed_to', 'sn.in_reply_to', 'sn.source', 'sn.local', 'sn.instances', 'sn.creation' ) @@ -134,28 +135,28 @@ class NotesRequestBuilder extends CoreRequestBuilder { $pf = $this->defaultSelectAlias . '.'; $orX = $expr->orX(); - $orX->add($expr->eq($pf . 'to', 'f.follow_id')); + $orX->add($expr->eq($func->lower($pf . 'to'), $func->lower('f.follow_id'))); $orX->add( $expr->like( - $pf . 'to_array', $func->concat( + $func->lower($pf . 'to_array'), $func->concat( $qb->createNamedParameter('%"'), - $func->concat('f.follow_id', $qb->createNamedParameter('"%')) + $func->concat($func->lower('f.follow_id'), $qb->createNamedParameter('"%')) ) ) ); $orX->add( $expr->like( - $pf . 'cc', $func->concat( + $func->lower($pf . 'cc'), $func->concat( $qb->createNamedParameter('%"'), - $func->concat('f.follow_id', $qb->createNamedParameter('"%')) + $func->concat($func->lower('f.follow_id'), $qb->createNamedParameter('"%')) ) ) ); $orX->add( $expr->like( - $pf . 'bcc', $func->concat( + $func->lower($pf . 'bcc'), $func->concat( $qb->createNamedParameter('%"'), - $func->concat('f.follow_id', $qb->createNamedParameter('"%')) + $func->concat($func->lower('f.follow_id'), $qb->createNamedParameter('"%')) ) ) ); diff --git a/lib/Model/ActivityPub/Follow.php b/lib/Model/ActivityPub/Follow.php index 26546265..e6e22738 100644 --- a/lib/Model/ActivityPub/Follow.php +++ b/lib/Model/ActivityPub/Follow.php @@ -32,6 +32,7 @@ namespace OCA\Social\Model\ActivityPub; use JsonSerializable; +use OCA\Social\Exceptions\InvalidResourceEntryException; /** @@ -48,6 +49,9 @@ class Follow extends ACore implements JsonSerializable { /** @var string */ private $followId = ''; + /** @var bool */ + private $accepted = false; + /** * Follow constructor. @@ -81,7 +85,28 @@ class Follow extends ACore implements JsonSerializable { /** + * @return bool + */ + public function isAccepted(): bool { + return $this->accepted; + } + + /** + * @param bool $accepted + * + * @return Follow + */ + public function setAccepted(bool $accepted): Follow { + $this->accepted = $accepted; + + return $this; + } + + + /** * @param array $data + * + * @throws InvalidResourceEntryException */ public function import(array $data) { parent::import($data); @@ -94,6 +119,7 @@ class Follow extends ACore implements JsonSerializable { public function importFromDatabase(array $data) { parent::importFromDatabase($data); + $this->setAccepted(($this->getInt('accepted', $data, 0) === 1) ? true : false); $this->setFollowId($this->get('follow_id', $data, '')); } @@ -105,6 +131,8 @@ class Follow extends ACore implements JsonSerializable { return array_merge( parent::jsonSerialize(), [ + 'follow_id' => $this->getFollowId(), + 'accepted' => $this->isAccepted() ] ); } diff --git a/lib/Service/ActivityPub/FollowService.php b/lib/Service/ActivityPub/FollowService.php index 7e1c35f8..4e9942af 100644 --- a/lib/Service/ActivityPub/FollowService.php +++ b/lib/Service/ActivityPub/FollowService.php @@ -129,11 +129,14 @@ class FollowService implements ICoreService { $follow->generateUniqueId(); $follow->setActorId($actor->getId()); $follow->setObjectId($remoteActor->getId()); + $follow->setFollowId($remoteActor->getFollowers()); try { $this->followsRequest->getByPersons($actor->getId(), $remoteActor->getId()); } catch (FollowDoesNotExistException $e) { $this->followsRequest->save($follow); + // TODO - Remove this auto-accepted. + $this->followsRequest->accepted($follow); $follow->addInstancePath( new InstancePath( @@ -258,7 +261,14 @@ class FollowService implements ICoreService { $follow->checkOrigin($follow->getActorId()); try { - $this->followsRequest->getByPersons($follow->getActorId(), $follow->getObjectId()); + $knownFollow = $this->followsRequest->getByPersons( + $follow->getActorId(), $follow->getObjectId() + ); + // in case of local follower. + // TODO - remove when following a local account does not need curl request anymore + if ($knownFollow->getId() === $follow->getId() && !$knownFollow->isAccepted()) { + $this->confirmFollowRequest($follow); + } } catch (FollowDoesNotExistException $e) { $actor = $this->personService->getFromId($follow->getObjectId()); if ($actor->isLocal()) { diff --git a/lib/Service/ActivityPub/NoteService.php b/lib/Service/ActivityPub/NoteService.php index cd49e906..8bddea7b 100644 --- a/lib/Service/ActivityPub/NoteService.php +++ b/lib/Service/ActivityPub/NoteService.php @@ -82,6 +82,10 @@ class NoteService implements ICoreService { private $miscService; + /** @var string */ + private $viewerId = ''; + + /** * NoteService constructor. * @@ -109,6 +113,19 @@ class NoteService implements ICoreService { /** + * @param string $viewerId + */ + public function setViewerId(string $viewerId) { + $this->viewerId = $viewerId; + $this->notesRequest->setViewerId($viewerId); + } + + public function getViewerId(): string { + return $this->viewerId; + } + + + /** * @param string $userId * @param string $content * @@ -333,28 +350,50 @@ class NoteService implements ICoreService { /** - * @param Person $actor + * @param string $actorId * * @param int $since * @param int $limit * * @return Note[] */ - public function getHomeNotesForActor(Person $actor, int $since = 0, int $limit = 5): array { - return $this->notesRequest->getHomeNotesForActorId($actor->getId(), $since, $limit); + public function getStreamHome(string $actorId, int $since = 0, int $limit = 5): array { + return $this->notesRequest->getStreamHome($actorId, $since, $limit); } /** - * @param Person $actor + * @param string $actorId + * @param int $since + * @param int $limit + * + * @return Note[] + */ + public function getStreamAccount(string $actorId, int $since = 0, int $limit = 5): array { + return $this->notesRequest->getStreamAccount($actorId, $since, $limit); + } + + + /** + * @param string $actorId + * @param int $since + * @param int $limit * + * @return Note[] + */ + public function getStreamDirect(string $actorId, int $since = 0, int $limit = 5): array { + return $this->notesRequest->getStreamDirect($actorId, $since, $limit); + } + + + /** * @param int $since * @param int $limit * * @return Note[] */ - public function getDirectNotesForActor(Person $actor, int $since = 0, int $limit = 5): array { - return $this->notesRequest->getDirectNotesForActorId($actor->getId(), $since, $limit); + public function getStreamLocalTimeline(int $since = 0, int $limit = 5): array { + return $this->notesRequest->getStreamTimeline($since, $limit, true); } @@ -364,8 +403,8 @@ class NoteService implements ICoreS |