Fix: Use correct Content-Type over ActivityPub

This was causing federation issues
This commit is contained in:
a 2022-12-05 14:05:15 -06:00
parent 54e00237a4
commit 6bf1bea325
8 changed files with 9 additions and 9 deletions

View file

@ -133,7 +133,7 @@ class FederationController extends Controller
// });
$res = [];
return response(json_encode($res, JSON_UNESCAPED_SLASHES))->header('Content-Type', 'application/activity+json');
return response(json_encode($res, JSON_UNESCAPED_SLASHES))->header('Content-Type', 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"');
}
public function userInbox(Request $request, $username)

View file

@ -14,7 +14,7 @@ class InstanceActorController extends Controller
$res = (new InstanceActor())->first()->getActor();
return json_encode($res, JSON_UNESCAPED_SLASHES);
});
return response($res)->header('Content-Type', 'application/activity+json');
return response($res)->header('Content-Type', 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"');
}
public function inbox()
@ -32,6 +32,6 @@ class InstanceActorController extends Controller
'first' => config('app.url') . '/i/actor/outbox?page=true',
'last' => config('app.url') . '/i/actor/outbox?min_id=0page=true'
], JSON_UNESCAPED_SLASHES);
return response($res)->header('Content-Type', 'application/activity+json');
return response($res)->header('Content-Type', 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"');
}
}

View file

@ -191,7 +191,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_encode($res['data']))->header('Content-Type', 'application/activity+json');
return response(json_encode($res['data']))->header('Content-Type', 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"');
});
}

View file

@ -293,7 +293,7 @@ class StatusController extends Controller
$resource = new Fractal\Resource\Item($status, $object);
$res = $fractal->createData($resource)->toArray();
return response()->json($res['data'], 200, ['Content-Type' => 'application/activity+json'], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
return response()->json($res['data'], 200, ['Content-Type' => 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"'], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
}
public function edit(Request $request, $username, $id)

View file

@ -97,7 +97,7 @@ class RemoteFollowPipeline implements ShouldQueue
$res = $this->response;
$url = $res['inbox'];
$activity = Zttp::withHeaders(['Content-Type' => 'application/activity+json'])->post($url, [
$activity = Zttp::withHeaders(['Content-Type' => 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"'])->post($url, [
'type' => 'Follow',
'object' => $this->follower->url(),
]);

View file

@ -69,7 +69,7 @@ class StoryFetch implements ShouldQueue
$version = config('pixelfed.version');
$appUrl = config('app.url');
$headers = [
'Accept' => 'application/json',
'Accept' => 'application/ld+json; profile="http://www.w3.org/ns/activitystreams"',
'Authorization' => 'Bearer ' . $token,
'User-Agent' => "(Pixelfed/{$version}; +{$appUrl})",
];

View file

@ -17,7 +17,7 @@ class ActivityPubFetchService
}
$headers = HttpSignature::instanceActorSign($url, false);
$headers['Accept'] = 'application/activity+json, application/json';
$headers['Accept'] = 'application/activity+json, application/ld+json; profile="http://www.w3.org/ns/activitystreams"';
$headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')';
try {

View file

@ -132,7 +132,7 @@ class HttpSignature {
'(request-target)' => 'post '.parse_url($url, PHP_URL_PATH),
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
'Host' => parse_url($url, PHP_URL_HOST),
'Accept' => 'application/activity+json, application/json',
'Accept' => 'application/activity+json, application/ld+json; profile="http://www.w3.org/ns/activitystreams"',
];
if($digest) {