forked from mirror/pixelfed
Update routes, add legacy webfinger profile redirect
This commit is contained in:
parent
07321b021c
commit
93c7af7464
2 changed files with 16 additions and 0 deletions
|
@ -139,4 +139,19 @@ class SiteController extends Controller
|
|||
|
||||
return redirect($url);
|
||||
}
|
||||
|
||||
public function legacyWebfingerRedirect(Request $request, $username, $domain)
|
||||
{
|
||||
$un = '@'.$username.'@'.$domain;
|
||||
$profile = Profile::whereUsername($un)
|
||||
->firstOrFail();
|
||||
|
||||
if($profile->domain == null) {
|
||||
$url = "/$profile->username";
|
||||
} else {
|
||||
$url = $request->user() ? "/i/web/profile/_/{$profile->id}" : $profile->url();
|
||||
}
|
||||
|
||||
return redirect($url);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -492,6 +492,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::get('p/{username}/{id}.json', 'StatusController@showObject');
|
||||
Route::get('p/{username}/{id}', 'StatusController@show');
|
||||
Route::get('{username}/embed', 'ProfileController@embed');
|
||||
Route::get('@{username}@{domain}', 'SiteController@legacyWebfingerRedirect');
|
||||
Route::get('@{username}', 'SiteController@legacyProfileRedirect');
|
||||
Route::get('{username}', 'ProfileController@show');
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue