Update web routes for AP actor object

This commit is contained in:
Daniel Supernault 2018-08-13 18:10:47 -06:00
parent d6970d930f
commit 0462b0a364
No known key found for this signature in database
GPG key ID: 0DEF1C662C9033F7
2 changed files with 18 additions and 3 deletions

View file

@ -48,6 +48,23 @@ class ProfileController extends Controller
return view('profile.show', compact('user', 'settings', 'owner', 'is_following', 'is_admin', 'timeline'));
}
public function permalinkRedirect(Request $request, $username)
{
$user = Profile::whereUsername($username)->firstOrFail();
$settings = User::whereUsername($username)->firstOrFail()->settings;
$mimes = [
'application/activity+json',
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
];
if(in_array($request->header('accept'), $mimes) && config('pixelfed.activitypub_enabled')) {
return $this->showActivityPub($request, $user);
}
return redirect($user->url());
}
protected function privateProfileCheck(Profile $profile)
{
if(Auth::check() === false) {

View file

@ -123,9 +123,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware('validemail')->group(fu
Route::redirect('/', '/');
Route::get('{user}.atom', 'ProfileController@showAtomFeed');
Route::get('{username}/outbox', 'FederationController@userOutbox');
Route::get('{user}', function($user) {
return redirect('/'.$user);
});
Route::get('{username}', 'ProfileController@permalinkRedirect');
});
Route::get('p/{username}/{id}/c/{cid}', 'CommentController@show');