mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-14 02:24:31 +00:00
Update FederationController
This commit is contained in:
parent
1b52febfab
commit
b05325ab5b
1 changed files with 11 additions and 16 deletions
|
@ -2,7 +2,10 @@
|
||||||
|
|
||||||
namespace App\Http\Controllers;
|
namespace App\Http\Controllers;
|
||||||
|
|
||||||
use App\Jobs\InboxPipeline\InboxWorker;
|
use App\Jobs\InboxPipeline\{
|
||||||
|
InboxWorker,
|
||||||
|
InboxValidator
|
||||||
|
};
|
||||||
use App\Jobs\RemoteFollowPipeline\RemoteFollowPipeline;
|
use App\Jobs\RemoteFollowPipeline\RemoteFollowPipeline;
|
||||||
use App\{
|
use App\{
|
||||||
AccountLog,
|
AccountLog,
|
||||||
|
@ -18,8 +21,10 @@ use Cache;
|
||||||
use Carbon\Carbon;
|
use Carbon\Carbon;
|
||||||
use Illuminate\Http\Request;
|
use Illuminate\Http\Request;
|
||||||
use League\Fractal;
|
use League\Fractal;
|
||||||
use App\Util\ActivityPub\Helpers;
|
use App\Util\ActivityPub\{
|
||||||
use App\Util\ActivityPub\HttpSignature;
|
Helpers,
|
||||||
|
HttpSignature
|
||||||
|
};
|
||||||
use \Zttp\Zttp;
|
use \Zttp\Zttp;
|
||||||
|
|
||||||
class FederationController extends Controller
|
class FederationController extends Controller
|
||||||
|
@ -204,19 +209,9 @@ class FederationController extends Controller
|
||||||
abort_if(!config('federation.activitypub.enabled'), 404);
|
abort_if(!config('federation.activitypub.enabled'), 404);
|
||||||
abort_if(!config('federation.activitypub.inbox'), 404);
|
abort_if(!config('federation.activitypub.inbox'), 404);
|
||||||
|
|
||||||
$profile = Profile::whereNull('domain')->whereUsername($username)->firstOrFail();
|
$headers = $request->headers->all();
|
||||||
if($profile->status != null) {
|
$payload = $request->getContent();
|
||||||
return ProfileController::accountCheck($profile);
|
InboxValidator::dispatch($username, $headers, $payload);
|
||||||
}
|
|
||||||
$body = $request->getContent();
|
|
||||||
$bodyDecoded = json_decode($body, true, 8);
|
|
||||||
if($this->verifySignature($request, $profile) == true) {
|
|
||||||
InboxWorker::dispatch($request->headers->all(), $profile, $bodyDecoded);
|
|
||||||
} else if($this->blindKeyRotation($request, $profile) == true) {
|
|
||||||
InboxWorker::dispatch($request->headers->all(), $profile, $bodyDecoded);
|
|
||||||
} else {
|
|
||||||
abort(400, 'Bad Signature');
|
|
||||||
}
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue