mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update SpaController, add username redirect method
This commit is contained in:
parent
8c2c69c3aa
commit
5c65e2b761
2 changed files with 10 additions and 0 deletions
|
@ -116,4 +116,13 @@ class SpaController extends Controller
|
||||||
return (string) $converter->convertToHtml($file);
|
return (string) $converter->convertToHtml($file);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function usernameRedirect(Request $request, $username)
|
||||||
|
{
|
||||||
|
$id = AccountService::usernameToId($username);
|
||||||
|
if(!$id) {
|
||||||
|
return redirect('/i/web/404');
|
||||||
|
}
|
||||||
|
return redirect('/i/web/profile/' . $id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -337,6 +337,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
||||||
Route::post('warning', 'AccountInterstitialController@read');
|
Route::post('warning', 'AccountInterstitialController@read');
|
||||||
Route::get('my2020', 'SeasonalController@yearInReview');
|
Route::get('my2020', 'SeasonalController@yearInReview');
|
||||||
|
|
||||||
|
Route::get('web/username/{id}', 'SpaController@usernameRedirect');
|
||||||
Route::get('web/post/{id}', 'SpaController@webPost');
|
Route::get('web/post/{id}', 'SpaController@webPost');
|
||||||
Route::get('web/profile/{id}', 'SpaController@webProfile');
|
Route::get('web/profile/{id}', 'SpaController@webProfile');
|
||||||
Route::get('web/{q}', 'SpaController@index')->where('q', '.*');
|
Route::get('web/{q}', 'SpaController@index')->where('q', '.*');
|
||||||
|
|
Loading…
Reference in a new issue