diff --git a/CHANGELOG.md b/CHANGELOG.md index de5f73b61..d3331d10d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,12 @@ ## [Unreleased](https://github.com/pixelfed/pixelfed/compare/v0.11.11...dev) +### Updated + +- Update ApiV1Controller, fix network timeline ([0faf59e3](https://github.com/pixelfed/pixelfed/commit/0faf59e3)) +- Update public/network timelines, fix non-redis response and fix reblogs in home feed ([8b4ac5cc](https://github.com/pixelfed/pixelfed/commit/8b4ac5cc)) +- ([](https://github.com/pixelfed/pixelfed/commit/)) + ## [v0.11.11 (2024-02-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.10...v0.11.11) ### Fixes @@ -27,7 +33,6 @@ ### Federation - Update Privacy Settings, add support for Mastodon `indexable` search flag ([fc24630e](https://github.com/pixelfed/pixelfed/commit/fc24630e)) - Update AP Helpers, consume actor `indexable` attribute ([fbdcdd9d](https://github.com/pixelfed/pixelfed/commit/fbdcdd9d)) -- ([](https://github.com/pixelfed/pixelfed/commit/)) ### Updates - Update FollowerService, add forget method to RelationshipService call to reduce load when mass purging ([347e4f59](https://github.com/pixelfed/pixelfed/commit/347e4f59)) @@ -112,7 +117,6 @@ - Update PublicApiController, consume InstanceService blocked domains for account and statuses endpoints ([01b33fb3](https://github.com/pixelfed/pixelfed/commit/01b33fb3)) - Update ApiV1Controller, enforce blocked instance domain logic ([5b284cac](https://github.com/pixelfed/pixelfed/commit/5b284cac)) - Update ApiV2Controller, add vapid key to instance object. Thanks thisismissem! ([4d02d6f1](https://github.com/pixelfed/pixelfed/commit/4d02d6f1)) -- ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.9 (2023-08-21)](https://github.com/pixelfed/pixelfed/compare/v0.11.8...v0.11.9) diff --git a/app/Http/Controllers/Api/ApiV1Controller.php b/app/Http/Controllers/Api/ApiV1Controller.php index d1bd9cac2..6114c6566 100644 --- a/app/Http/Controllers/Api/ApiV1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Controller.php @@ -2523,6 +2523,7 @@ class ApiV1Controller extends Controller $napi = $request->has(self::PF_API_ENTITY_KEY); $min = $request->input('min_id'); $max = $request->input('max_id'); + $minOrMax = $request->anyFilled(['max_id', 'min_id']); $limit = $request->input('limit') ?? 20; $user = $request->user(); @@ -2535,36 +2536,100 @@ class ApiV1Controller extends Controller $filtered = $user ? UserFilterService::filters($user->profile_id) : []; AccountService::setLastActive($user->id); $domainBlocks = UserFilterService::domainBlocks($user->profile_id); + $hideNsfw = config('instance.hide_nsfw_on_public_feeds'); + $amin = SnowflakeService::byDate(now()->subDays(config('federation.network_timeline_days_falloff'))); - if($remote && config('instance.timeline.network.cached')) { - Cache::remember('api:v1:timelines:network:cache_check', 10368000, function() { - if(NetworkTimelineService::count() == 0) { - NetworkTimelineService::warmCache(true, config('instance.timeline.network.cache_dropoff')); + if($remote) { + if(config('instance.timeline.network.cached')) { + Cache::remember('api:v1:timelines:network:cache_check', 10368000, function() { + if(NetworkTimelineService::count() == 0) { + NetworkTimelineService::warmCache(true, config('instance.timeline.network.cache_dropoff')); + } + }); + + if ($max) { + $feed = NetworkTimelineService::getRankedMaxId($max, $limit + 5); + } else if ($min) { + $feed = NetworkTimelineService::getRankedMinId($min, $limit + 5); + } else { + $feed = NetworkTimelineService::get(0, $limit + 5); } - }); - - if ($max) { - $feed = NetworkTimelineService::getRankedMaxId($max, $limit + 5); - } else if ($min) { - $feed = NetworkTimelineService::getRankedMinId($min, $limit + 5); } else { - $feed = NetworkTimelineService::get(0, $limit + 5); + $feed = Status::select( + 'id', + 'uri', + 'type', + 'scope', + 'local', + 'created_at', + 'profile_id', + 'in_reply_to_id', + 'reblog_of_id' + ) + ->when($minOrMax, function($q, $minOrMax) use($min, $max) { + $dir = $min ? '>' : '<'; + $id = $min ?? $max; + return $q->where('id', $dir, $id); + }) + ->whereNull(['in_reply_to_id', 'reblog_of_id']) + ->when($hideNsfw, function($q, $hideNsfw) { + return $q->where('is_nsfw', false); + }) + ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) + ->whereLocal(false) + ->whereScope('public') + ->where('id', '>', $amin) + ->orderByDesc('id') + ->limit(($limit * 2)) + ->pluck('id') + ->values() + ->toArray(); } - } + } else { + if(config('instance.timeline.local.cached')) { + Cache::remember('api:v1:timelines:public:cache_check', 10368000, function() { + if(PublicTimelineService::count() == 0) { + PublicTimelineService::warmCache(true, 400); + } + }); - if($local || !$remote && !$local) { - Cache::remember('api:v1:timelines:public:cache_check', 10368000, function() { - if(PublicTimelineService::count() == 0) { - PublicTimelineService::warmCache(true, 400); + if ($max) { + $feed = PublicTimelineService::getRankedMaxId($max, $limit + 5); + } else if ($min) { + $feed = PublicTimelineService::getRankedMinId($min, $limit + 5); + } else { + $feed = PublicTimelineService::get(0, $limit + 5); } - }); - - if ($max) { - $feed = PublicTimelineService::getRankedMaxId($max, $limit + 5); - } else if ($min) { - $feed = PublicTimelineService::getRankedMinId($min, $limit + 5); } else { - $feed = PublicTimelineService::get(0, $limit + 5); + $feed = Status::select( + 'id', + 'uri', + 'type', + 'scope', + 'local', + 'created_at', + 'profile_id', + 'in_reply_to_id', + 'reblog_of_id' + ) + ->when($minOrMax, function($q, $minOrMax) use($min, $max) { + $dir = $min ? '>' : '<'; + $id = $min ?? $max; + return $q->where('id', $dir, $id); + }) + ->whereNull(['in_reply_to_id', 'reblog_of_id']) + ->when($hideNsfw, function($q, $hideNsfw) { + return $q->where('is_nsfw', false); + }) + ->whereIn('type', ['photo', 'photo:album', 'video', 'video:album', 'photo:video:album']) + ->whereLocal(true) + ->whereScope('public') + ->where('id', '>', $amin) + ->orderByDesc('id') + ->limit(($limit * 2)) + ->pluck('id') + ->values() + ->toArray(); } } diff --git a/config/instance.php b/config/instance.php index 03f666a79..7d5463055 100644 --- a/config/instance.php +++ b/config/instance.php @@ -29,11 +29,12 @@ return [ ], 'local' => [ + 'cached' => env('INSTANCE_PUBLIC_TIMELINE_CACHED', false), 'is_public' => env('INSTANCE_PUBLIC_LOCAL_TIMELINE', false) ], '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), 'max_hours_old' => env('INSTANCE_NETWORK_TIMELINE_CACHE_MAX_HOUR_INGEST', 6) ] diff --git a/public/js/account-import.js b/public/js/account-import.js index b68bfb495..f1510f57e 100644 Binary files a/public/js/account-import.js and b/public/js/account-import.js differ diff --git a/public/js/home.chunk.ada2cbf0ec3271bd.js b/public/js/home.chunk.ada2cbf0ec3271bd.js new file mode 100644 index 000000000..6b898fbc3 Binary files /dev/null and b/public/js/home.chunk.ada2cbf0ec3271bd.js differ diff --git a/public/js/home.chunk.f3f4f632025b560f.js.LICENSE.txt b/public/js/home.chunk.ada2cbf0ec3271bd.js.LICENSE.txt similarity index 100% rename from public/js/home.chunk.f3f4f632025b560f.js.LICENSE.txt rename to public/js/home.chunk.ada2cbf0ec3271bd.js.LICENSE.txt diff --git a/public/js/home.chunk.f3f4f632025b560f.js b/public/js/home.chunk.f3f4f632025b560f.js deleted file mode 100644 index 76c5f028a..000000000 Binary files a/public/js/home.chunk.f3f4f632025b560f.js and /dev/null differ diff --git a/public/js/manifest.js b/public/js/manifest.js index 5f337f9b3..de48f35bf 100644 Binary files a/public/js/manifest.js and b/public/js/manifest.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 68c9c44bd..5162e3d96 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/components/AccountImport.vue b/resources/assets/components/AccountImport.vue index f7b7279f5..406c5c1ce 100644 --- a/resources/assets/components/AccountImport.vue +++ b/resources/assets/components/AccountImport.vue @@ -197,8 +197,17 @@

Media #{{idx + 1}}

- +
+

Caption

{{ media.title ? media.title : modalData.title }}

diff --git a/resources/assets/components/sections/Timeline.vue b/resources/assets/components/sections/Timeline.vue index 6b064acea..ea215d895 100644 --- a/resources/assets/components/sections/Timeline.vue +++ b/resources/assets/components/sections/Timeline.vue @@ -187,7 +187,7 @@ forceUpdateIdx: 0, showReblogBanner: false, enablingReblogs: false, - baseApi: '/api/v1/pixelfed/timelines/', + baseApi: '/api/v1/timelines/', } }, @@ -204,7 +204,7 @@ } if(window.App.config.ab.hasOwnProperty('cached_home_timeline')) { const cht = window.App.config.ab.cached_home_timeline == true; - this.baseApi = cht ? '/api/v1/timelines/' : '/api/pixelfed/v1/timelines/'; + this.baseApi = cht ? '/api/v1/timelines/' : '/api/v1/timelines/'; } this.fetchSettings(); }, @@ -261,10 +261,19 @@ } } else { url = this.baseApi + this.getScope(); - params = { - max_id: this.max_id, - limit: 6, - '_pe': 1, + + if(this.max_id === 0) { + params = { + min_id: 1, + limit: 6, + '_pe': 1, + } + } else { + params = { + max_id: this.max_id, + limit: 6, + '_pe': 1, + } } } if(this.getScope() === 'network') {