forked from mirror/pixelfed
Merge pull request #369 from pixelfed/frontend-ui-refactor
Frontend ui refactor
This commit is contained in:
commit
44a0e1d1a0
|
@ -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) {
|
||||
|
|
|
@ -13,7 +13,7 @@ class ProfileOutbox extends Fractal\TransformerAbstract
|
|||
$count = $profile->statuses()->count();
|
||||
$statuses = $profile->statuses()->has('media')->orderBy('id','desc')->take(20)->get()->map(function($i, $k) {
|
||||
$item = [
|
||||
'id' => $i->url(),
|
||||
'id' => $i->permalink(),
|
||||
// TODO: handle other types
|
||||
'type' => 'Create',
|
||||
'actor' => $i->profile->url(),
|
||||
|
@ -47,7 +47,7 @@ class ProfileOutbox extends Fractal\TransformerAbstract
|
|||
// TODO: add cc's
|
||||
//"{$notice->getProfile()->getUrl()}/subscribers",
|
||||
],
|
||||
'sensitive' => null,
|
||||
'sensitive' => (bool) $i->is_nsfw,
|
||||
'atomUri' => $i->url(),
|
||||
'inReplyToAtomUri' => null,
|
||||
'conversation' => $i->url(),
|
||||
|
|
|
@ -11,7 +11,14 @@ class ProfileTransformer extends Fractal\TransformerAbstract
|
|||
public function transform(Profile $profile)
|
||||
{
|
||||
return [
|
||||
'@context' => 'https://www.w3.org/ns/activitystreams',
|
||||
'@context' => [
|
||||
'https://www.w3.org/ns/activitystreams',
|
||||
'https://w3id.org/security/v1',
|
||||
[
|
||||
"manuallyApprovesFollowers" => "as:manuallyApprovesFollowers",
|
||||
"featured" => 'https://pixelfed.org/ns/featured',
|
||||
]
|
||||
],
|
||||
'id' => $profile->permalink(),
|
||||
'type' => 'Person',
|
||||
'following' => $profile->permalink('/following'),
|
||||
|
@ -23,9 +30,9 @@ class ProfileTransformer extends Fractal\TransformerAbstract
|
|||
'name' => $profile->name,
|
||||
'summary' => $profile->bio,
|
||||
'url' => $profile->url(),
|
||||
'manuallyApprovesFollowers' => $profile->is_private,
|
||||
'follower_count' => $profile->followers()->count(),
|
||||
'following_count' => $profile->following()->count(),
|
||||
'manuallyApprovesFollowers' => (bool) $profile->is_private,
|
||||
// 'follower_count' => $profile->followers()->count(),
|
||||
// 'following_count' => $profile->following()->count(),
|
||||
'publicKey' => [
|
||||
'id' => $profile->permalink() . '#main-key',
|
||||
'owner' => $profile->permalink(),
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue