Merge pull request #4243 from pixelfed/staging

Staging
This commit is contained in:
daniel 2023-03-23 01:36:47 -06:00 committed by GitHub
commit 6434794289
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 41 additions and 18 deletions

View file

@ -11,6 +11,8 @@
- Optional home feed caching ([3328b367](https://github.com/pixelfed/pixelfed/commit/3328b367)) - Optional home feed caching ([3328b367](https://github.com/pixelfed/pixelfed/commit/3328b367))
- Admin Invites ([b73ca9a1](https://github.com/pixelfed/pixelfed/commit/b73ca9a1)) - Admin Invites ([b73ca9a1](https://github.com/pixelfed/pixelfed/commit/b73ca9a1))
- Hashtag administration ([84872311](https://github.com/pixelfed/pixelfed/commit/84872311)) - Hashtag administration ([84872311](https://github.com/pixelfed/pixelfed/commit/84872311))
- Admin report email notifications ([4e1d0ed5](https://github.com/pixelfed/pixelfed/commit/4e1d0ed5))
- Add Licenses help page, fixes #4238 ([3c712a70](https://github.com/pixelfed/pixelfed/commit/3c712a70))
### Updates ### Updates
- Update ApiV1Controller, include self likes in favourited_by endpoint ([58b331d2](https://github.com/pixelfed/pixelfed/commit/58b331d2)) - Update ApiV1Controller, include self likes in favourited_by endpoint ([58b331d2](https://github.com/pixelfed/pixelfed/commit/58b331d2))
@ -129,6 +131,13 @@
- Update ApiV1Controller, increase home timeline max limit to 100 to fix compatibility with mastoapi ([5cf9ba78](https://github.com/pixelfed/pixelfed/commit/5cf9ba78)) - Update ApiV1Controller, increase home timeline max limit to 100 to fix compatibility with mastoapi ([5cf9ba78](https://github.com/pixelfed/pixelfed/commit/5cf9ba78))
- Update ApiV1Controller, preserve album order. Fixes #3708 ([deb26971](https://github.com/pixelfed/pixelfed/commit/deb26971)) - Update ApiV1Controller, preserve album order. Fixes #3708 ([deb26971](https://github.com/pixelfed/pixelfed/commit/deb26971))
- Update site config endpoint ([f9be48d6](https://github.com/pixelfed/pixelfed/commit/f9be48d6)) - Update site config endpoint ([f9be48d6](https://github.com/pixelfed/pixelfed/commit/f9be48d6))
- Update Portfolios, add ActivityPub + RSS support, light mode, style customization and more ([5ad0d883](https://github.com/pixelfed/pixelfed/commit/5ad0d883))
- Update atom feed, improve cache expiry and fix double encoding bug. Fixes #4121 ([467c9d75](https://github.com/pixelfed/pixelfed/commit/467c9d75))
- Update email settings, add dangerzone middleware to prompt for password before you can change your email address. Fixes #4101 ([186ba7f0](https://github.com/pixelfed/pixelfed/commit/186ba7f0))
- Update InboxPipelines, improve handling of missing signature validation headers ([419c0fb0](https://github.com/pixelfed/pixelfed/commit/419c0fb0))
- Update admin instances dashboard ([ecfc0766](https://github.com/pixelfed/pixelfed/commit/ecfc0766))
- Update ap helpers, fix album order bug by setting media order ([871f798c](https://github.com/pixelfed/pixelfed/commit/871f798c))
- Update image pipeline, dispatch jobs to mmo queue and add "replace_id" param to v2/media endpoint to dispatch delayed MediaDeletePipeline job for original media id to improve media gc on supported clients ([5a67e9f9](https://github.com/pixelfed/pixelfed/commit/5a67e9f9))
- ([](https://github.com/pixelfed/pixelfed/commit/)) - ([](https://github.com/pixelfed/pixelfed/commit/))
## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4) ## [v0.11.4 (2022-10-04)](https://github.com/pixelfed/pixelfed/compare/v0.11.3...v0.11.4)

View file

@ -49,6 +49,7 @@ use App\Http\Controllers\StatusController;
use App\Jobs\AvatarPipeline\AvatarOptimize; use App\Jobs\AvatarPipeline\AvatarOptimize;
use App\Jobs\CommentPipeline\CommentPipeline; use App\Jobs\CommentPipeline\CommentPipeline;
use App\Jobs\LikePipeline\LikePipeline; use App\Jobs\LikePipeline\LikePipeline;
use App\Jobs\MediaPipeline\MediaDeletePipeline;
use App\Jobs\SharePipeline\SharePipeline; use App\Jobs\SharePipeline\SharePipeline;
use App\Jobs\SharePipeline\UndoSharePipeline; use App\Jobs\SharePipeline\UndoSharePipeline;
use App\Jobs\StatusPipeline\NewStatusPipeline; use App\Jobs\StatusPipeline\NewStatusPipeline;
@ -96,6 +97,7 @@ use App\Jobs\FollowPipeline\FollowAcceptPipeline;
use App\Jobs\FollowPipeline\FollowRejectPipeline; use App\Jobs\FollowPipeline\FollowRejectPipeline;
use Illuminate\Support\Facades\RateLimiter; use Illuminate\Support\Facades\RateLimiter;
use Purify; use Purify;
use Carbon\Carbon;
class ApiV1Controller extends Controller class ApiV1Controller extends Controller
{ {
@ -1654,11 +1656,11 @@ class ApiV1Controller extends Controller
switch ($media->mime) { switch ($media->mime) {
case 'image/jpeg': case 'image/jpeg':
case 'image/png': case 'image/png':
ImageOptimize::dispatch($media); ImageOptimize::dispatch($media)->onQueue('mmo');
break; break;
case 'video/mp4': case 'video/mp4':
VideoThumbnail::dispatch($media); VideoThumbnail::dispatch($media)->onQueue('mmo');
$preview_url = '/storage/no-preview.png'; $preview_url = '/storage/no-preview.png';
$url = '/storage/no-preview.png'; $url = '/storage/no-preview.png';
break; break;
@ -1767,7 +1769,8 @@ class ApiV1Controller extends Controller
], ],
'filter_name' => 'nullable|string|max:24', 'filter_name' => 'nullable|string|max:24',
'filter_class' => 'nullable|alpha_dash|max:24', 'filter_class' => 'nullable|alpha_dash|max:24',
'description' => 'nullable|string|max:' . config_cache('pixelfed.max_altext_length') 'description' => 'nullable|string|max:' . config_cache('pixelfed.max_altext_length'),
'replace_id' => 'sometimes'
]); ]);
$user = $request->user(); $user = $request->user();
@ -1829,6 +1832,21 @@ class ApiV1Controller extends Controller
abort_if(MediaBlocklistService::exists($hash) == true, 451); abort_if(MediaBlocklistService::exists($hash) == true, 451);
if($request->has('replace_id')) {
$rpid = $request->input('replace_id');
$removeMedia = Media::whereNull('status_id')
->whereUserId($user->id)
->whereProfileId($profile->id)
->where('created_at', '>', now()->subHours(2))
->find($rpid);
if($removeMedia) {
$dateTime = Carbon::now();
MediaDeletePipeline::dispatch($removeMedia)
->onQueue('mmo')
->delay($dateTime->addMinutes(15));
}
}
$media = new Media(); $media = new Media();
$media->status_id = null; $media->status_id = null;
$media->profile_id = $profile->id; $media->profile_id = $profile->id;
@ -1848,11 +1866,11 @@ class ApiV1Controller extends Controller
switch ($media->mime) { switch ($media->mime) {
case 'image/jpeg': case 'image/jpeg':
case 'image/png': case 'image/png':
ImageOptimize::dispatch($media); ImageOptimize::dispatch($media)->onQueue('mmo');
break; break;
case 'video/mp4': case 'video/mp4':
VideoThumbnail::dispatch($media); VideoThumbnail::dispatch($media)->onQueue('mmo');
$preview_url = '/storage/no-preview.png'; $preview_url = '/storage/no-preview.png';
$url = '/storage/no-preview.png'; $url = '/storage/no-preview.png';
break; break;

View file

@ -149,11 +149,11 @@ class ComposeController extends Controller
case 'image/jpeg': case 'image/jpeg':
case 'image/png': case 'image/png':
case 'image/webp': case 'image/webp':
ImageOptimize::dispatch($media); ImageOptimize::dispatch($media)->onQueue('mmo');
break; break;
case 'video/mp4': case 'video/mp4':
VideoThumbnail::dispatch($media); VideoThumbnail::dispatch($media)->onQueue('mmo');
$preview_url = '/storage/no-preview.png'; $preview_url = '/storage/no-preview.png';
$url = '/storage/no-preview.png'; $url = '/storage/no-preview.png';
break; break;
@ -213,7 +213,7 @@ class ComposeController extends Controller
$res = [ $res = [
'url' => $media->url() . '?v=' . time() 'url' => $media->url() . '?v=' . time()
]; ];
ImageOptimize::dispatch($media); ImageOptimize::dispatch($media)->onQueue('mmo');
Cache::forget($limitKey); Cache::forget($limitKey);
return $res; return $res;
} }
@ -512,12 +512,7 @@ class ComposeController extends Controller
$m->license = $license; $m->license = $license;
$m->caption = isset($media['alt']) ? strip_tags($media['alt']) : null; $m->caption = isset($media['alt']) ? strip_tags($media['alt']) : null;
$m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k; $m->order = isset($media['cursor']) && is_int($media['cursor']) ? (int) $media['cursor'] : $k;
// if($optimize_media == false) {
// $m->skip_optimize = true;
// ImageThumbnail::dispatch($m);
// } else {
// ImageOptimize::dispatch($m);
// }
if($cw == true || $profile->cw == true) { if($cw == true || $profile->cw == true) {
$m->is_nsfw = $cw; $m->is_nsfw = $cw;
$status->is_nsfw = $cw; $status->is_nsfw = $cw;

View file

@ -49,6 +49,6 @@ class ImageOptimize implements ShouldQueue
return; return;
} }
ImageResize::dispatch($media); ImageResize::dispatch($media)->onQueue('mmo');
} }
} }

View file

@ -55,6 +55,6 @@ class ImageResize implements ShouldQueue
} catch (Exception $e) { } catch (Exception $e) {
} }
ImageThumbnail::dispatch($media); ImageThumbnail::dispatch($media)->onQueue('mmo');
} }
} }

View file

@ -59,6 +59,6 @@ class ImageThumbnail implements ShouldQueue
$media->processed_at = Carbon::now(); $media->processed_at = Carbon::now();
$media->save(); $media->save();
ImageUpdate::dispatch($media); ImageUpdate::dispatch($media)->onQueue('mmo');
} }
} }

View file

@ -665,7 +665,7 @@ class Helpers {
$storagePath = MediaPathService::get($user, 2); $storagePath = MediaPathService::get($user, 2);
$allowed = explode(',', config_cache('pixelfed.media_types')); $allowed = explode(',', config_cache('pixelfed.media_types'));
foreach($attachments as $media) { foreach($attachments as $key => $media) {
$type = $media['mediaType']; $type = $media['mediaType'];
$url = $media['url']; $url = $media['url'];
$valid = self::validateUrl($url); $valid = self::validateUrl($url);
@ -685,6 +685,7 @@ class Helpers {
$media->media_path = $url; $media->media_path = $url;
$media->remote_url = $url; $media->remote_url = $url;
$media->caption = $caption; $media->caption = $caption;
$media->order = $key + 1;
if($license) { if($license) {
$media->license = $license; $media->license = $license;
} }