mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update timeline controllers and routes
This commit is contained in:
parent
90e41d9855
commit
582c4913d5
3 changed files with 10 additions and 54 deletions
|
@ -31,28 +31,7 @@ class SiteController extends Controller
|
|||
|
||||
public function homeTimeline()
|
||||
{
|
||||
$pid = Auth::user()->profile->id;
|
||||
// TODO: Use redis for timelines
|
||||
|
||||
$following = Follower::whereProfileId($pid)->pluck('following_id');
|
||||
$following->push($pid)->toArray();
|
||||
|
||||
$filtered = UserFilter::whereUserId($pid)
|
||||
->whereFilterableType('App\Profile')
|
||||
->whereIn('filter_type', ['mute', 'block'])
|
||||
->pluck('filterable_id')->toArray();
|
||||
|
||||
$timeline = Status::whereIn('profile_id', $following)
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->whereHas('media')
|
||||
->whereVisibility('public')
|
||||
->orderBy('created_at', 'desc')
|
||||
->withCount(['comments', 'likes', 'shares'])
|
||||
->simplePaginate(20);
|
||||
|
||||
$type = 'personal';
|
||||
|
||||
return view('timeline.template', compact('timeline', 'type'));
|
||||
return view('timeline.home');
|
||||
}
|
||||
|
||||
public function changeLocale(Request $request, $locale)
|
||||
|
|
|
@ -20,30 +20,6 @@ class TimelineController extends Controller
|
|||
|
||||
public function local(Request $request)
|
||||
{
|
||||
$this->validate($request,[
|
||||
'page' => 'nullable|integer|max:20'
|
||||
]);
|
||||
// TODO: Use redis for timelines
|
||||
// $timeline = Timeline::build()->local();
|
||||
$pid = Auth::user()->profile->id;
|
||||
|
||||
$private = Profile::whereIsPrivate(true)->where('id', '!=', $pid)->pluck('id');
|
||||
$filters = UserFilter::whereUserId($pid)
|
||||
->whereFilterableType('App\Profile')
|
||||
->whereIn('filter_type', ['mute', 'block'])
|
||||
->pluck('filterable_id')->toArray();
|
||||
$filtered = array_merge($private->toArray(), $filters);
|
||||
|
||||
$timeline = Status::whereHas('media')
|
||||
->whereNotIn('profile_id', $filtered)
|
||||
->whereNull('in_reply_to_id')
|
||||
->whereNull('reblog_of_id')
|
||||
->whereVisibility('public')
|
||||
->withCount(['comments', 'likes'])
|
||||
->orderBy('created_at', 'desc')
|
||||
->simplePaginate(10);
|
||||
$type = 'local';
|
||||
|
||||
return view('timeline.template', compact('timeline', 'type'));
|
||||
return view('timeline.local');
|
||||
}
|
||||
}
|
||||
|
|
|
@ -38,15 +38,16 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::get('nodeinfo/2.0.json', 'FederationController@nodeinfo');
|
||||
|
||||
Route::group(['prefix' => 'v1'], function () {
|
||||
Route::get('accounts/verify_credentials', 'ApiController@verifyCredentials');
|
||||
Route::post('avatar/update', 'ApiController@avatarUpdate');
|
||||
Route::get('likes', 'ApiController@hydrateLikes');
|
||||
Route::post('media', 'ApiController@uploadMedia')->middleware('throttle:250,1440');
|
||||
Route::post('media', 'ApiController@uploadMedia')->middleware('throttle:500,1440');
|
||||
Route::get('notifications', 'ApiController@notifications');
|
||||
Route::get('timelines/public', 'PublicApiController@publicTimelineApi');
|
||||
Route::get('timelines/home', 'PublicApiController@homeTimelineApi');
|
||||
});
|
||||
Route::group(['prefix' => 'v2'], function() {
|
||||
Route::get('notifications', 'InternalApiController@notifications');
|
||||
Route::post('notifications', 'InternalApiController@notificationMarkAllRead');
|
||||
Route::get('discover', 'InternalApiController@discover');
|
||||
// Route::get('discover/people', 'InternalApiController@discoverPeople');
|
||||
Route::get('discover/posts', 'InternalApiController@discoverPosts');
|
||||
Route::get('profile/{username}/status/{postid}', 'PublicApiController@status');
|
||||
Route::get('comments/{username}/status/{postId}', 'PublicApiController@statusComments');
|
||||
|
@ -56,7 +57,7 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::group(['prefix' => 'local'], function () {
|
||||
Route::get('i/follow-suggestions', 'ApiController@followSuggestions');
|
||||
Route::post('i/more-comments', 'ApiController@loadMoreComments');
|
||||
Route::post('status/compose', 'InternalApiController@compose')->middleware('throttle:250,1440');
|
||||
Route::post('status/compose', 'InternalApiController@compose')->middleware('throttle:500,1440');
|
||||
});
|
||||
});
|
||||
|
||||
|
@ -67,8 +68,8 @@ Route::domain(config('pixelfed.domain.app'))->middleware(['validemail', 'twofact
|
|||
Route::get('compose', 'StatusController@compose')->name('compose');
|
||||
Route::post('comment', 'CommentController@store')->middleware('throttle:1000,1440');
|
||||
Route::post('delete', 'StatusController@delete')->middleware('throttle:1000,1440');
|
||||
Route::post('mute', 'AccountController@mute')->middleware('throttle:100,1440');
|
||||
Route::post('block', 'AccountController@block')->middleware('throttle:100,1440');
|
||||
Route::post('mute', 'AccountController@mute');
|
||||
Route::post('block', 'AccountController@block');
|
||||
Route::post('like', 'LikeController@store')->middleware('throttle:1000,1440');
|
||||
Route::post('share', 'StatusController@storeShare')->middleware('throttle:1000,1440');
|
||||
Route::post('follow', 'FollowerController@store')->middleware('throttle:250,1440');
|
||||
|
|
Loading…
Reference in a new issue