From 51aa17052fd80e5677ea7b1904758c9c412f86f1 Mon Sep 17 00:00:00 2001 From: Daniel Supernault Date: Thu, 31 May 2018 21:34:04 -0600 Subject: [PATCH] Update FederationController Prevent outbox from returning an actor object so other federation software does not attempt to send inbox requests until the inbox is fully supported. --- app/Http/Controllers/FederationController.php | 5 ++++- app/Http/Controllers/ProfileController.php | 2 +- config/pixelfed.php | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/app/Http/Controllers/FederationController.php b/app/Http/Controllers/FederationController.php index 1bef479d2..a5e7007ec 100644 --- a/app/Http/Controllers/FederationController.php +++ b/app/Http/Controllers/FederationController.php @@ -123,8 +123,11 @@ class FederationController extends Controller public function userOutbox(Request $request, $username) { + if(config('pixelfed.activitypub_enabled') == false) { + abort(403); + } + $user = Profile::whereNull('remote_url')->whereUsername($username)->firstOrFail(); - $timeline = $user->statuses()->orderBy('created_at','desc')->paginate(10); $fractal = new Fractal\Manager(); $resource = new Fractal\Resource\Item($user, new ProfileOutbox); diff --git a/app/Http/Controllers/ProfileController.php b/app/Http/Controllers/ProfileController.php index 7aba7e572..a9d9846c5 100644 --- a/app/Http/Controllers/ProfileController.php +++ b/app/Http/Controllers/ProfileController.php @@ -25,7 +25,7 @@ class ProfileController extends Controller 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"' ]; - if(in_array($request->header('accept'), $mimes)) { + if(in_array($request->header('accept'), $mimes) && config('pixelfed.activitypub_enabled')) { return $this->showActivityPub($request, $user); } diff --git a/config/pixelfed.php b/config/pixelfed.php index 479df7fa9..69a8f3dfb 100644 --- a/config/pixelfed.php +++ b/config/pixelfed.php @@ -71,5 +71,9 @@ return [ | */ 'open_registration' => env('OPEN_REGISTRATION', true), + + 'remote_follow_enabled' => env('REMOTE_FOLLOW', false), + + 'activitypub_enabled' => env('ACTIVITY_PUB', false), ]; \ No newline at end of file