diff --git a/lib/AP.php b/lib/AP.php index 31713914..7d8ae585 100644 --- a/lib/AP.php +++ b/lib/AP.php @@ -365,7 +365,7 @@ class AP { break; case Announce::TYPE: - $service = $this->announceInterface; + $interface = $this->announceInterface; break; case Block::TYPE: diff --git a/lib/Command/NoteBoost.php b/lib/Command/NoteBoost.php index 477d806b..dd1888ff 100644 --- a/lib/Command/NoteBoost.php +++ b/lib/Command/NoteBoost.php @@ -32,10 +32,6 @@ namespace OCA\Social\Command; use Exception; use OC\Core\Command\Base; -use OCA\Social\Model\ActivityPub\ACore; -use OCA\Social\Model\ActivityPub\Object\Announce; -use OCA\Social\Model\ActivityPub\Stream; -use OCA\Social\Model\Post; use OCA\Social\Service\AccountService; use OCA\Social\Service\ActivityService; use OCA\Social\Service\ConfigService; @@ -45,7 +41,6 @@ use OCA\Social\Service\NoteService; use OCA\Social\Service\PostService; use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; -use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Output\OutputInterface; diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php index b8e31844..bd1978a6 100644 --- a/lib/Controller/LocalController.php +++ b/lib/Controller/LocalController.php @@ -290,6 +290,7 @@ class LocalController extends Controller { /** * @NoAdminRequired + * @NoCSRFRequired * * @param int $since * @param int $limit diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php index f9aba1b2..fd2ae48c 100644 --- a/lib/Controller/NavigationController.php +++ b/lib/Controller/NavigationController.php @@ -36,6 +36,7 @@ use Exception; use OC\User\NoUserException; use OCA\Social\AppInfo\Application; use OCA\Social\Exceptions\AccountAlreadyExistsException; +use OCA\Social\Exceptions\ItemUnknownException; use OCA\Social\Exceptions\SocialAppConfigException; use OCA\Social\Exceptions\UrlCloudException; use OCA\Social\Service\AccountService; @@ -130,6 +131,7 @@ class NavigationController extends Controller { * * @return TemplateResponse * @throws UrlCloudException + * @throws ItemUnknownException */ public function navigate(string $path = ''): TemplateResponse { $data = [ diff --git a/lib/Controller/OStatusController.php b/lib/Controller/OStatusController.php index 182c4a3d..3ad8718d 100644 --- a/lib/Controller/OStatusController.php +++ b/lib/Controller/OStatusController.php @@ -109,7 +109,7 @@ class OStatusController extends Controller { $user = $this->userSession->getUser(); if ($user === null) { - return $this->fail('Failed to retrieve current user'); + throw new Exception('Failed to retrieve current user'); } return new TemplateResponse('social', 'ostatus', [ diff --git a/lib/Db/HashtagsRequest.php b/lib/Db/HashtagsRequest.php index 7cf9c167..70f15282 100644 --- a/lib/Db/HashtagsRequest.php +++ b/lib/Db/HashtagsRequest.php @@ -32,11 +32,7 @@ namespace OCA\Social\Db; use daita\MySmallPhpTools\Traits\TArrayTools; -use DateTime; -use OCA\Social\Exceptions\FollowDoesNotExistException; use OCA\Social\Exceptions\HashtagDoesNotExistException; -use OCA\Social\Model\ActivityPub\Activity\Follow; -use OCP\DB\QueryBuilder\IQueryBuilder; /** diff --git a/lib/Db/HashtagsRequestBuilder.php b/lib/Db/HashtagsRequestBuilder.php index b3f1b946..2297d280 100644 --- a/lib/Db/HashtagsRequestBuilder.php +++ b/lib/Db/HashtagsRequestBuilder.php @@ -32,8 +32,6 @@ namespace OCA\Social\Db; use daita\MySmallPhpTools\Traits\TArrayTools; -use OCA\Social\Exceptions\InvalidResourceException; -use OCA\Social\Model\ActivityPub\Activity\Follow; use OCP\DB\QueryBuilder\IQueryBuilder; diff --git a/lib/Db/NotesRequest.php b/lib/Db/NotesRequest.php index 35d99c3f..88396995 100644 --- a/lib/Db/NotesRequest.php +++ b/lib/Db/NotesRequest.php @@ -73,7 +73,7 @@ class NotesRequest extends NotesRequestBuilder { ) ->setValue( 'attachments', $qb->createNamedParameter( - json_encode($note->getAttachments(), JSON_UNESCAPED_SLASHES) + json_encode($stream->getAttachments(), JSON_UNESCAPED_SLASHES) ) ); } diff --git a/lib/Db/StreamQueueRequestBuilder.php b/lib/Db/StreamQueueRequestBuilder.php index f4ac89a5..b66cec1c 100644 --- a/lib/Db/StreamQueueRequestBuilder.php +++ b/lib/Db/StreamQueueRequestBuilder.php @@ -31,7 +31,6 @@ namespace OCA\Social\Db; use daita\MySmallPhpTools\Traits\TArrayTools; -use OCA\Social\Model\RequestQueue; use OCA\Social\Model\StreamQueue; use OCP\DB\QueryBuilder\IQueryBuilder; diff --git a/lib/Interfaces/Actor/PersonInterface.php b/lib/Interfaces/Actor/PersonInterface.php index 25c0bc60..e7b6e9a8 100644 --- a/lib/Interfaces/Actor/PersonInterface.php +++ b/lib/Interfaces/Actor/PersonInterface.php @@ -39,7 +39,6 @@ use OCA\Social\Exceptions\InvalidOriginException; use OCA\Social\Exceptions\ItemNotFoundException; use OCA\Social\Interfaces\IActivityPubInterface; use OCA\Social\Model\ActivityPub\ACore; -use OCA\Social\Model\ActivityPub\Activity\Delete; use OCA\Social\Model\ActivityPub\Activity\Update; use OCA\Social\Model\ActivityPub\Actor\Person; use OCA\Social\Service\ActorService; diff --git a/lib/Interfaces/Object/ImageInterface.php b/lib/Interfaces/Object/ImageInterface.php index 2196bf81..63b2e666 100644 --- a/lib/Interfaces/Object/ImageInterface.php +++ b/lib/Interfaces/Object/ImageInterface.php @@ -35,7 +35,6 @@ use OCA\Social\Db\CacheDocumentsRequest; use OCA\Social\Exceptions\ItemNotFoundException; use OCA\Social\Interfaces\IActivityPubInterface; use OCA\Social\Model\ActivityPub\ACore; -use OCA\Social\Model\ActivityPub\Object\Document; use OCA\Social\Service\MiscService; diff --git a/lib/Model/ActivityPub/Object/Image.php b/lib/Model/ActivityPub/Object/Image.php index 466b906a..17bdbf94 100644 --- a/lib/Model/ActivityPub/Object/Image.php +++ b/lib/Model/ActivityPub/Object/Image.php @@ -32,6 +32,7 @@ namespace OCA\Social\Model\ActivityPub\Object; use JsonSerializable; +use OCA\Social\Exceptions\InvalidOriginException; use OCA\Social\Exceptions\UrlCloudException; use OCA\Social\Model\ActivityPub\ACore; @@ -63,6 +64,7 @@ class Image extends Document implements JsonSerializable { * @param array $data * * @throws UrlCloudException + * @throws InvalidOriginException */ public function import(array $data) { parent::import($data); diff --git a/lib/Model/ActivityPub/Object/Note.php b/lib/Model/ActivityPub/Object/Note.php index 00abd89e..a2acb0e7 100644 --- a/lib/Model/ActivityPub/Object/Note.php +++ b/lib/Model/ActivityPub/Object/Note.php @@ -30,7 +30,6 @@ declare(strict_types=1); namespace OCA\Social\Model\ActivityPub\Object; -use DateTime; use Exception; use JsonSerializable; use OCA\Social\AP; @@ -48,7 +47,7 @@ class Note extends Stream implements JsonSerializable { /** @var array */ private $attachments = []; - + /** @var array */ private $hashtags = []; diff --git a/lib/Model/LinkedDataSignature.php b/lib/Model/LinkedDataSignature.php index 2ee8f8a3..d2e46d20 100644 --- a/lib/Model/LinkedDataSignature.php +++ b/lib/Model/LinkedDataSignature.php @@ -32,12 +32,10 @@ namespace OCA\Social\Model; use daita\MySmallPhpTools\Traits\TArrayTools; -use JsonLdException; use JsonSerializable; use OCA\Social\Exceptions\LinkedDataSignatureMissingException; use OCA\Social\Model\ActivityPub\ACore; use OCA\Social\Service\SignatureService; -use stdClass; /** diff --git a/lib/Service/CurlService.php b/lib/Service/CurlService.php index 8499bc3b..376283e8 100644 --- a/lib/Service/CurlService.php +++ b/lib/Service/CurlService.php @@ -135,6 +135,7 @@ class CurlService { * @throws RequestServerException * @throws SocialAppConfigException * @throws ItemUnknownException + * @throws RequestResultNotJsonException */ public function retrieveAccount(string $account): Person { $result = $this->webfingerAccount($account); diff --git a/lib/Service/DocumentService.php b/lib/Service/DocumentService.php index e2579b95..7b208a59 100644 --- a/lib/Service/DocumentService.php +++ b/lib/Service/DocumentService.php @@ -181,6 +181,7 @@ class DocumentService { * @throws CacheContentException * @throws CacheDocumentDoesNotExistException * @throws MalformedArrayException + * @throws RequestResultNotJsonException */ public function getFromCache(string $id, bool $public = false) { $document = $this->cacheRemoteDocument($id, $public);