diff --git a/CHANGELOG.md b/CHANGELOG.md index d285079db..f5abf9b83 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -47,6 +47,8 @@ - Hydrate `favourited` and `reblogged` state on v1 context endpoint ([abb4f7e1](https://github.com/pixelfed/pixelfed/commit/abb4f7e1)) - Improve admin dashboard by moving expensive stats to its page and loading stats and recent data async on the dashboard home page ([9d52b9c2](https://github.com/pixelfed/pixelfed/commit/9d52b9c2)) - Update unfollow api endpoint to only decrement when appropriate, fixes #3539 ([44de1ad7](https://github.com/pixelfed/pixelfed/commit/44de1ad7)) +- Improve cache invalidation after processing VideoThumbnail to eliminate "No Preview Available" on grid feeds ([47571887](https://github.com/pixelfed/pixelfed/commit/47571887)) +- Use poster in VideoPresenter component ([a3cc90b0](https://github.com/pixelfed/pixelfed/commit/a3cc90b0)) - ([](https://github.com/pixelfed/pixelfed/commit/)) ## [v0.11.3 (2022-05-09)](https://github.com/pixelfed/pixelfed/compare/v0.11.2...v0.11.3) diff --git a/app/Http/Controllers/Api/ApiV1Dot1Controller.php b/app/Http/Controllers/Api/ApiV1Dot1Controller.php index 7bc3cf942..34d483551 100644 --- a/app/Http/Controllers/Api/ApiV1Dot1Controller.php +++ b/app/Http/Controllers/Api/ApiV1Dot1Controller.php @@ -2,6 +2,7 @@ namespace App\Http\Controllers\Api; +use Cache; use App\Http\Controllers\Controller; use Illuminate\Http\Request; use League\Fractal; @@ -10,6 +11,7 @@ use League\Fractal\Pagination\IlluminatePaginatorAdapter; use App\Status; use App\Report; use App\Profile; +use App\Services\AccountService; class ApiV1Dot1Controller extends Controller { @@ -128,4 +130,40 @@ class ApiV1Dot1Controller extends Controller ]; return $this->json($res); } + + /** + * DELETE /api/v1.1/accounts/avatar + * + * @return \App\Transformer\Api\AccountTransformer + */ + public function deleteAvatar(Request $request) + { + $user = $request->user(); + + abort_if(!$user, 403); + abort_if($user->status != null, 403); + + $avatar = $user->profile->avatar; + + if( $avatar->media_path == 'public/avatars/default.png' || + $avatar->media_path == 'public/avatars/default.jpg' + ) { + return AccountService::get($user->profile_id); + } + + if(is_file(storage_path('app/' . $avatar->media_path))) { + @unlink(storage_path('app/' . $avatar->media_path)); + } + + $avatar->media_path = 'public/avatars/default.jpg'; + $avatar->change_count = $avatar->change_count + 1; + $avatar->save(); + + Cache::forget('avatar:' . $user->profile_id); + Cache::forget("avatar:{$user->profile_id}"); + Cache::forget('user:account:id:'.$user->id); + AccountService::del($user->profile_id); + + return AccountService::get($user->profile_id); + } } diff --git a/app/Jobs/InboxPipeline/DeleteWorker.php b/app/Jobs/InboxPipeline/DeleteWorker.php index f40edc3ff..a55623e63 100644 --- a/app/Jobs/InboxPipeline/DeleteWorker.php +++ b/app/Jobs/InboxPipeline/DeleteWorker.php @@ -24,8 +24,9 @@ class DeleteWorker implements ShouldQueue protected $headers; protected $payload; - public $timeout = 60; - public $tries = 1; + public $timeout = 120; + public $tries = 3; + public $maxExceptions = 1; /** * Create a new job instance. @@ -72,7 +73,7 @@ class DeleteWorker implements ShouldQueue 'h:' . hash('sha256', $actor); $lockKey = 'ap:inbox:actor-delete-exists:lock:' . $hash; - Cache::lock($lockKey, 10)->block(5, function () use( + Cache::lock($lockKey, 30)->block(15, function () use( $headers, $payload, $actor, @@ -94,30 +95,30 @@ class DeleteWorker implements ShouldQueue if($profile) { DeleteRemoteProfilePipeline::dispatch($profile)->onQueue('delete'); } - return; + return 1; } else { // Signature verification failed, exit. - return; + return 1; } } else { // Remote user doesn't exist, exit early. - return; + return 1; } }); - return; + return 1; } $profile = null; if($this->verifySignature($headers, $payload) == true) { (new Inbox($headers, $profile, $payload))->handle(); - return; + return 1; } else if($this->blindKeyRotation($headers, $payload) == true) { (new Inbox($headers, $profile, $payload))->handle(); - return; + return 1; } else { - return; + return 1; } } diff --git a/app/Jobs/VideoPipeline/VideoThumbnail.php b/app/Jobs/VideoPipeline/VideoThumbnail.php index 8df8ec75c..fed61e4fc 100644 --- a/app/Jobs/VideoPipeline/VideoThumbnail.php +++ b/app/Jobs/VideoPipeline/VideoThumbnail.php @@ -14,6 +14,8 @@ use Storage; use App\Media; use App\Jobs\MediaPipeline\MediaStoragePipeline; use App\Util\Media\Blurhash; +use App\Services\MediaService; +use App\Services\StatusService; class VideoThumbnail implements ShouldQueue { @@ -72,6 +74,11 @@ class VideoThumbnail implements ShouldQueue if($media->status_id) { Cache::forget('status:transformer:media:attachments:' . $media->status_id); + MediaService::del($media->status_id); + Cache::forget('status:thumb:nsfw0' . $media->status_id); + Cache::forget('status:thumb:nsfw1' . $media->status_id); + Cache::forget('pf:services:sh:id:' . $media->status_id); + StatusService::del($media->status_id); } MediaStoragePipeline::dispatch($media); diff --git a/public/js/daci-ojtjadoml.js b/public/js/daci-ojtjadoml.js index cb4f89ea1..02f76d393 100644 Binary files a/public/js/daci-ojtjadoml.js and b/public/js/daci-ojtjadoml.js differ diff --git a/public/js/dffc-ojtjadoml.js b/public/js/dffc-ojtjadoml.js index 524c980c4..1d57d39e6 100644 Binary files a/public/js/dffc-ojtjadoml.js and b/public/js/dffc-ojtjadoml.js differ diff --git a/public/js/dmyh-ojtjadoml.js b/public/js/dmyh-ojtjadoml.js index 4c414733a..f96f62a32 100644 Binary files a/public/js/dmyh-ojtjadoml.js and b/public/js/dmyh-ojtjadoml.js differ diff --git a/public/js/dmym-ojtjadoml.js b/public/js/dmym-ojtjadoml.js index 212aed7e5..6790dacae 100644 Binary files a/public/js/dmym-ojtjadoml.js and b/public/js/dmym-ojtjadoml.js differ diff --git a/public/js/dsfc-ojtjadoml.js b/public/js/dsfc-ojtjadoml.js index 027575562..d40290b4b 100644 Binary files a/public/js/dsfc-ojtjadoml.js and b/public/js/dsfc-ojtjadoml.js differ diff --git a/public/js/dssc-ojtjadoml.js b/public/js/dssc-ojtjadoml.js index 311a36404..7a8f11798 100644 Binary files a/public/js/dssc-ojtjadoml.js and b/public/js/dssc-ojtjadoml.js differ diff --git a/public/js/home-ojtjadoml.js b/public/js/home-ojtjadoml.js index 255d05444..1575fbf05 100644 Binary files a/public/js/home-ojtjadoml.js and b/public/js/home-ojtjadoml.js differ diff --git a/public/js/post-ojtjadoml.js b/public/js/post-ojtjadoml.js index fcd24ca2f..8999f78fe 100644 Binary files a/public/js/post-ojtjadoml.js and b/public/js/post-ojtjadoml.js differ diff --git a/public/js/profile-ojtjadoml.js b/public/js/profile-ojtjadoml.js index 0d868f1f0..7d3ad3cdf 100644 Binary files a/public/js/profile-ojtjadoml.js and b/public/js/profile-ojtjadoml.js differ diff --git a/public/js/profile.js b/public/js/profile.js index cdc90e59d..23afaaa5c 100644 Binary files a/public/js/profile.js and b/public/js/profile.js differ diff --git a/public/js/rempos.js b/public/js/rempos.js index 14ea8fdc1..d7dbc5885 100644 Binary files a/public/js/rempos.js and b/public/js/rempos.js differ diff --git a/public/js/rempro.js b/public/js/rempro.js index b71e40442..a9ad342fa 100644 Binary files a/public/js/rempro.js and b/public/js/rempro.js differ diff --git a/public/js/spa.js b/public/js/spa.js index 7dd24f800..f059dc7ba 100644 Binary files a/public/js/spa.js and b/public/js/spa.js differ diff --git a/public/js/status.js b/public/js/status.js index dc568665e..41c470a5b 100644 Binary files a/public/js/status.js and b/public/js/status.js differ diff --git a/public/js/timeline.js b/public/js/timeline.js index 5748cc9df..5a100a919 100644 Binary files a/public/js/timeline.js and b/public/js/timeline.js differ diff --git a/public/mix-manifest.json b/public/mix-manifest.json index 5cd12e8b1..f2fdbd1ad 100644 Binary files a/public/mix-manifest.json and b/public/mix-manifest.json differ diff --git a/resources/assets/js/components/presenter/VideoPresenter.vue b/resources/assets/js/components/presenter/VideoPresenter.vue index 4395c34ca..333a482f2 100644 --- a/resources/assets/js/components/presenter/VideoPresenter.vue +++ b/resources/assets/js/components/presenter/VideoPresenter.vue @@ -22,7 +22,7 @@ :alt="altText(status)"/>
-
@@ -76,7 +76,15 @@ toggleContentWarning(status) { this.$emit('togglecw'); - } + }, + + poster() { + let url = this.status.media_attachments[0].preview_url; + if(url.endsWith('no-preview.jpg') || url.endsWith('no-preview.png')) { + return; + } + return url; + } } } diff --git a/routes/api.php b/routes/api.php index 55675483e..d4732a9f3 100644 --- a/routes/api.php +++ b/routes/api.php @@ -99,6 +99,7 @@ Route::group(['prefix' => 'api'], function() use($middleware) { Route::group(['prefix' => 'v1.1'], function() use($middleware) { Route::post('report', 'Api\ApiV1Dot1Controller@report')->middleware($middleware); + Route::delete('accounts/avatar', 'Api\ApiV1Dot1Controller@deleteAvatar')->middleware($middleware); }); Route::group(['prefix' => 'live'], function() use($middleware) {