mirror of
https://github.com/pixelfed/pixelfed.git
synced 2025-02-04 10:50:46 +00:00
Merge pull request #3992 from pixelfed/fix-response-type
Fix: Use correct response type and remove Accept from http signature
This commit is contained in:
commit
ba965a79e5
7 changed files with 9 additions and 8 deletions
|
@ -131,7 +131,7 @@ class FederationController extends Controller
|
||||||
'orderedItems' => []
|
'orderedItems' => []
|
||||||
];
|
];
|
||||||
|
|
||||||
return response(json_encode($res, JSON_UNESCAPED_SLASHES))->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response(json_encode($res, JSON_UNESCAPED_SLASHES))->header('Content-Type', 'application/activity+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function userInbox(Request $request, $username)
|
public function userInbox(Request $request, $username)
|
||||||
|
|
|
@ -14,7 +14,7 @@ class InstanceActorController extends Controller
|
||||||
$res = (new InstanceActor())->first()->getActor();
|
$res = (new InstanceActor())->first()->getActor();
|
||||||
return json_encode($res, JSON_UNESCAPED_SLASHES);
|
return json_encode($res, JSON_UNESCAPED_SLASHES);
|
||||||
});
|
});
|
||||||
return response($res)->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response($res)->header('Content-Type', 'application/activity+json');
|
||||||
}
|
}
|
||||||
|
|
||||||
public function inbox()
|
public function inbox()
|
||||||
|
@ -32,6 +32,6 @@ class InstanceActorController extends Controller
|
||||||
'first' => config('app.url') . '/i/actor/outbox?page=true',
|
'first' => config('app.url') . '/i/actor/outbox?page=true',
|
||||||
'last' => config('app.url') . '/i/actor/outbox?min_id=0page=true'
|
'last' => config('app.url') . '/i/actor/outbox?min_id=0page=true'
|
||||||
], JSON_UNESCAPED_SLASHES);
|
], JSON_UNESCAPED_SLASHES);
|
||||||
return response($res)->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response($res)->header('Content-Type', 'application/activity+json');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -191,7 +191,7 @@ class ProfileController extends Controller
|
||||||
$fractal = new Fractal\Manager();
|
$fractal = new Fractal\Manager();
|
||||||
$resource = new Fractal\Resource\Item($user, new ProfileTransformer);
|
$resource = new Fractal\Resource\Item($user, new ProfileTransformer);
|
||||||
$res = $fractal->createData($resource)->toArray();
|
$res = $fractal->createData($resource)->toArray();
|
||||||
return response(json_encode($res['data']))->header('Content-Type', 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"');
|
return response(json_encode($res['data']))->header('Content-Type', 'application/activity+json');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -293,7 +293,7 @@ class StatusController extends Controller
|
||||||
$resource = new Fractal\Resource\Item($status, $object);
|
$resource = new Fractal\Resource\Item($status, $object);
|
||||||
$res = $fractal->createData($resource)->toArray();
|
$res = $fractal->createData($resource)->toArray();
|
||||||
|
|
||||||
return response()->json($res['data'], 200, ['Content-Type' => 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
return response()->json($res['data'], 200, ['Content-Type' => 'application/activity+json'], JSON_PRETTY_PRINT|JSON_UNESCAPED_SLASHES);
|
||||||
}
|
}
|
||||||
|
|
||||||
public function edit(Request $request, $username, $id)
|
public function edit(Request $request, $username, $id)
|
||||||
|
|
|
@ -17,7 +17,7 @@ class ActivityPubFetchService
|
||||||
}
|
}
|
||||||
|
|
||||||
$headers = HttpSignature::instanceActorSign($url, false);
|
$headers = HttpSignature::instanceActorSign($url, false);
|
||||||
$headers['Accept'] = 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
$headers['Accept'] = 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
||||||
$headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')';
|
$headers['User-Agent'] = '(Pixelfed/'.config('pixelfed.version').'; +'.config('app.url').')';
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -48,9 +48,11 @@ class WebfingerService
|
||||||
$link = collect($webfinger['links'])
|
$link = collect($webfinger['links'])
|
||||||
->filter(function($link) {
|
->filter(function($link) {
|
||||||
return $link &&
|
return $link &&
|
||||||
|
isset($link['rel']) &&
|
||||||
isset($link['type']) &&
|
isset($link['type']) &&
|
||||||
isset($link['href']) &&
|
isset($link['href']) &&
|
||||||
$link['type'] == 'application/activity+json';
|
$link['rel'] == 'self' &&
|
||||||
|
$link['type'] == 'application/activity+json' || $link['type'] == 'application/ld+json; profile="https://www.w3.org/ns/activitystreams"';
|
||||||
})
|
})
|
||||||
->pluck('href')
|
->pluck('href')
|
||||||
->first();
|
->first();
|
||||||
|
|
|
@ -132,7 +132,6 @@ class HttpSignature {
|
||||||
'(request-target)' => 'post '.parse_url($url, PHP_URL_PATH),
|
'(request-target)' => 'post '.parse_url($url, PHP_URL_PATH),
|
||||||
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
|
'Date' => $date->format('D, d M Y H:i:s \G\M\T'),
|
||||||
'Host' => parse_url($url, PHP_URL_HOST),
|
'Host' => parse_url($url, PHP_URL_HOST),
|
||||||
'Accept' => 'application/activity+json, application/ld+json; profile="https://www.w3.org/ns/activitystreams"',
|
|
||||||
];
|
];
|
||||||
|
|
||||||
if($digest) {
|
if($digest) {
|
||||||
|
|
Loading…
Reference in a new issue