mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-09 16:24:51 +00:00
Update ApiV1Controller, fix network timeline
This commit is contained in:
parent
e5bbe9340a
commit
0faf59e3b7
2 changed files with 30 additions and 12 deletions
|
@ -2536,20 +2536,38 @@ class ApiV1Controller extends Controller
|
||||||
AccountService::setLastActive($user->id);
|
AccountService::setLastActive($user->id);
|
||||||
$domainBlocks = UserFilterService::domainBlocks($user->profile_id);
|
$domainBlocks = UserFilterService::domainBlocks($user->profile_id);
|
||||||
|
|
||||||
if($remote && config('instance.timeline.network.cached')) {
|
if($remote) {
|
||||||
Cache::remember('api:v1:timelines:network:cache_check', 10368000, function() {
|
if(config('instance.timeline.network.cached')) {
|
||||||
if(NetworkTimelineService::count() == 0) {
|
Cache::remember('api:v1:timelines:network:cache_check', 10368000, function() {
|
||||||
NetworkTimelineService::warmCache(true, config('instance.timeline.network.cache_dropoff'));
|
if(NetworkTimelineService::count() == 0) {
|
||||||
}
|
NetworkTimelineService::warmCache(true, config('instance.timeline.network.cache_dropoff'));
|
||||||
});
|
}
|
||||||
|
});
|
||||||
|
|
||||||
if ($max) {
|
if ($max) {
|
||||||
$feed = NetworkTimelineService::getRankedMaxId($max, $limit + 5);
|
$feed = NetworkTimelineService::getRankedMaxId($max, $limit + 5);
|
||||||
} else if ($min) {
|
} else if ($min) {
|
||||||
$feed = NetworkTimelineService::getRankedMinId($min, $limit + 5);
|
$feed = NetworkTimelineService::getRankedMinId($min, $limit + 5);
|
||||||
|
} else {
|
||||||
|
$feed = NetworkTimelineService::get(0, $limit + 5);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
$feed = NetworkTimelineService::get(0, $limit + 5);
|
$feed = Status::select(
|
||||||
|
'id',
|
||||||
|
'profile_id',
|
||||||
|
'type',
|
||||||
|
'visibility',
|
||||||
|
'in_reply_to_id',
|
||||||
|
'reblog_of_id'
|
||||||
|
)
|
||||||
|
->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album'])
|
||||||
|
->where('visibility', 'public')
|
||||||
|
->whereLocal(false)
|
||||||
|
->orderByDesc('id')
|
||||||
|
->take(($limit * 2))
|
||||||
|
->pluck('id');
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if($local || !$remote && !$local) {
|
if($local || !$remote && !$local) {
|
||||||
|
|
|
@ -33,7 +33,7 @@ return [
|
||||||
],
|
],
|
||||||
|
|
||||||
'network' => [
|
'network' => [
|
||||||
'cached' => env('PF_NETWORK_TIMELINE') ? env('INSTANCE_NETWORK_TIMELINE_CACHED', true) : false,
|
'cached' => env('PF_NETWORK_TIMELINE') ? env('INSTANCE_NETWORK_TIMELINE_CACHED', false) : false,
|
||||||
'cache_dropoff' => env('INSTANCE_NETWORK_TIMELINE_CACHE_DROPOFF', 100),
|
'cache_dropoff' => env('INSTANCE_NETWORK_TIMELINE_CACHE_DROPOFF', 100),
|
||||||
'max_hours_old' => env('INSTANCE_NETWORK_TIMELINE_CACHE_MAX_HOUR_INGEST', 6)
|
'max_hours_old' => env('INSTANCE_NETWORK_TIMELINE_CACHE_MAX_HOUR_INGEST', 6)
|
||||||
]
|
]
|
||||||
|
|
Loading…
Reference in a new issue