mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update DiscoverController
This commit is contained in:
parent
1351dc5ee8
commit
39f4b470b3
3 changed files with 11 additions and 22 deletions
|
@ -65,27 +65,6 @@ class DiscoverController extends Controller
|
|||
return view('discover.tags.category', compact('tag', 'posts'));
|
||||
}
|
||||
|
||||
public function showPersonal(Request $request)
|
||||
{
|
||||
abort_if(!Auth::check(), 403);
|
||||
|
||||
$profile = Auth::user()->profile;
|
||||
|
||||
$tags = Cache::remember('profile-'.$profile->id.':hashtags', now()->addMinutes(15), function() use ($profile){
|
||||
return $profile->hashtags()->groupBy('hashtag_id')->inRandomOrder()->take(8)->get();
|
||||
});
|
||||
$following = Cache::remember('profile:following:'.$profile->id, now()->addMinutes(60), function() use ($profile) {
|
||||
$res = Follower::whereProfileId($profile->id)->pluck('following_id');
|
||||
return $res->push($profile->id)->toArray();
|
||||
});
|
||||
$posts = Cache::remember('profile-'.$profile->id.':hashtag-posts', now()->addMinutes(5), function() use ($profile, $following) {
|
||||
$posts = Status::whereScope('public')->withCount(['likes','comments'])->whereNotIn('profile_id', $following)->whereHas('media')->whereType('photo')->orderByDesc('created_at')->take(39)->get();
|
||||
$posts->post_count = Status::whereScope('public')->whereNotIn('profile_id', $following)->whereHas('media')->whereType('photo')->count();
|
||||
return $posts;
|
||||
});
|
||||
return view('discover.personal', compact('posts', 'tags'));
|
||||
}
|
||||
|
||||
public function showLoops(Request $request)
|
||||
{
|
||||
if(config('exp.loops') != true) {
|
||||
|
@ -148,4 +127,10 @@ class DiscoverController extends Controller
|
|||
}
|
||||
return $res;
|
||||
}
|
||||
|
||||
public function profilesDirectory(Request $request)
|
||||
{
|
||||
$profiles = Profile::whereNull('domain')->simplePaginate(48);
|
||||
return view('discover.profiles.home', compact('profiles'));
|
||||
}
|
||||
}
|
||||
|
|
|
@ -53,6 +53,10 @@ class ImageUpdate implements ShouldQueue
|
|||
}
|
||||
$path = storage_path('app/'.$media->media_path);
|
||||
$thumb = storage_path('app/'.$media->thumbnail_path);
|
||||
|
||||
if (!is_file($path)) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (in_array($media->mime, $this->protectedMimes) == true) {
|
||||
ImageOptimizer::optimize($thumb);
|
||||
|
|
|
@ -298,7 +298,7 @@ class Inbox
|
|||
$obj = $this->payload['object'];
|
||||
$type = $this->payload['object']['type'];
|
||||
$typeCheck = in_array($type, ['Person', 'Tombstone']);
|
||||
if(!Helpers::validateUrl($actor) || !Helpers::validateUrl($obj) || !$typeCheck) {
|
||||
if(!Helpers::validateUrl($actor) || !Helpers::validateUrl($obj['id']) || !$typeCheck) {
|
||||
return;
|
||||
}
|
||||
if(parse_url($obj['id'], PHP_URL_HOST) !== parse_url($actor, PHP_URL_HOST)) {
|
||||
|
|
Loading…
Reference in a new issue