summaryrefslogtreecommitdiffstats
path: root/lib/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'lib/Controller')
-rw-r--r--lib/Controller/ActivityPubController.php13
-rw-r--r--lib/Controller/LocalController.php1
-rw-r--r--lib/Controller/NavigationController.php6
3 files changed, 14 insertions, 6 deletions
diff --git a/lib/Controller/ActivityPubController.php b/lib/Controller/ActivityPubController.php
index 90a1369a..acd79fa3 100644
--- a/lib/Controller/ActivityPubController.php
+++ b/lib/Controller/ActivityPubController.php
@@ -32,9 +32,10 @@ namespace OCA\Social\Controller;
use daita\MySmallPhpTools\Traits\Nextcloud\TNCDataResponse;
use Exception;
+use OC\AppFramework\Http;
use OCA\Social\AppInfo\Application;
use OCA\Social\Db\NotesRequest;
-use OCA\Social\Exceptions\SignatureException;
+use OCA\Social\Exceptions\SignatureIsGoneException;
use OCA\Social\Exceptions\UnknownItemException;
use OCA\Social\Service\ActivityPub\FollowService;
use OCA\Social\Service\ActivityService;
@@ -124,7 +125,6 @@ class ActivityPubController extends Controller {
* @param string $username
*
* @return Response
- * @throws \OC\User\NoUserException
*/
public function actor(string $username): Response {
if (!$this->checkSourceActivityStreams()) {
@@ -184,6 +184,8 @@ class ActivityPubController extends Controller {
}
return $this->success([]);
+ } catch (SignatureIsGoneException $e) {
+ return $this->fail($e, [], Http::STATUS_GONE);
} catch (Exception $e) {
return $this->fail($e);
}
@@ -207,10 +209,13 @@ class ActivityPubController extends Controller {
public function inbox(string $username): Response {
try {
- $actor = $this->actorService->getActor($username);
+
$this->activityService->checkRequest($this->request);
$body = file_get_contents('php://input');
+ // TODO - check the recipient <-> username
+// $actor = $this->actorService->getActor($username);
+
$this->miscService->log('Inbox: ' . $body);
$activity = $this->importService->import($body);
@@ -220,6 +225,8 @@ class ActivityPubController extends Controller {
}
return $this->success([]);
+ } catch (SignatureIsGoneException $e) {
+ return $this->fail($e, [], Http::STATUS_GONE);
} catch (Exception $e) {
return $this->fail($e);
}
diff --git a/lib/Controller/LocalController.php b/lib/Controller/LocalController.php
index b5216943..f462319c 100644
--- a/lib/Controller/LocalController.php
+++ b/lib/Controller/LocalController.php
@@ -420,7 +420,6 @@ class LocalController extends Controller {
$cached = [];
foreach ($documents as $id) {
try {
-
$document = $this->documentService->cacheRemoteDocument($id);
$cached[] = $document;
} catch (Exception $e) {
diff --git a/lib/Controller/NavigationController.php b/lib/Controller/NavigationController.php
index 864b9eb8..37f7050f 100644
--- a/lib/Controller/NavigationController.php
+++ b/lib/Controller/NavigationController.php
@@ -125,7 +125,6 @@ class NavigationController extends Controller {
* @NoSubAdminRequired
*
* @return TemplateResponse
- * @throws NoUserException
*/
public function navigate($path = ''): TemplateResponse {
$data = [
@@ -162,6 +161,10 @@ class NavigationController extends Controller {
$data['serverData']['firstrun'] = true;
} catch (AccountAlreadyExistsException $e) {
// we do nothing
+ } catch (NoUserException $e) {
+ // well, should not happens
+ } catch (SocialAppConfigException $e) {
+ // neither.
}
return new TemplateResponse(Application::APP_NAME, 'main', $data);
@@ -231,7 +234,6 @@ class NavigationController extends Controller {
* @param $username
*
* @return RedirectResponse|PublicTemplateResponse
- * @throws NoUserException
*/
public function public($username) {
if (\OC::$server->getUserSession()