Update Profile & Federation controllers, output proper AP content type

This commit is contained in:
Daniel Supernault 2018-08-12 21:25:55 -06:00
parent a2d4b7c1fc
commit 4cf58e1539
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 3 additions and 3 deletions

View file

@ -118,7 +118,7 @@ class FederationController extends Controller
{
$this->validate($request, ['resource'=>'required|string|min:3|max:255']);
$hash = hash('sha512', $request->input('resource'));
$hash = hash('sha256', $request->input('resource'));
$webfinger = Cache::remember('api:webfinger:'.$hash, 1440, function() use($request) {
$resource = $request->input('resource');
@ -141,7 +141,7 @@ class FederationController extends Controller
$fractal = new Fractal\Manager();
$resource = new Fractal\Resource\Item($user, new ProfileOutbox);
$res = $fractal->createData($resource)->toArray();
return response()->json($res['data']);
return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
}
public function userInbox(Request $request, $username)

View file

@ -68,7 +68,7 @@ class ProfileController extends Controller
$fractal = new Fractal\Manager();
$resource = new Fractal\Resource\Item($user, new ProfileTransformer);
$res = $fractal->createData($resource)->toArray();
return response()->json($res['data']);
return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
}
public function showAtomFeed(Request $request, $user)