1
0
Fork 0

Merge pull request #369 from pixelfed/frontend-ui-refactor

Frontend ui refactor
This commit is contained in:
daniel 2018-08-13 18:19:13 -06:00 committed by GitHub
commit 44a0e1d1a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 31 additions and 9 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

@ -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(),

View File

@ -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(),

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');