Update media_types, use config_cache

This commit is contained in:
Daniel Supernault 2024-03-12 01:28:08 -06:00
parent fecbe1897b
commit d670de175e
No known key found for this signature in database
GPG key ID: 23740873EE6F76A1
3 changed files with 147 additions and 148 deletions

View file

@ -2,11 +2,11 @@
namespace App\Console\Commands;
use Illuminate\Console\Command;
use App\Media;
use Illuminate\Support\Facades\Http;
use App\Services\MediaService;
use App\Services\StatusService;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\Http;
class FetchMissingMediaMimeType extends Command
{
@ -36,7 +36,7 @@ class FetchMissingMediaMimeType extends Command
continue;
}
if(!in_array($res->header('content-type'), explode(',',config('pixelfed.media_types')))) {
if (! in_array($res->header('content-type'), explode(',', config_cache('pixelfed.media_types')))) {
continue;
}

View file

@ -1651,7 +1651,7 @@ class ApiV1Controller extends Controller
'media_attachments' => [
'image_matrix_limit' => 16777216,
'image_size_limit' => config_cache('pixelfed.max_photo_size') * 1024,
'supported_mime_types' => explode(',', config('pixelfed.media_types')),
'supported_mime_types' => explode(',', config_cache('pixelfed.media_types')),
'video_frame_rate_limit' => 120,
'video_matrix_limit' => 2304000,
'video_size_limit' => config_cache('pixelfed.max_photo_size') * 1024,

View file

@ -2,20 +2,19 @@
namespace App\Jobs\StatusPipeline;
use App\Media;
use App\Models\StatusEdit;
use App\ModLog;
use App\Profile;
use App\Services\StatusService;
use App\Status;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldBeUnique;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;
use App\Media;
use App\ModLog;
use App\Profile;
use App\Status;
use App\Models\StatusEdit;
use App\Services\StatusService;
use Purify;
use Illuminate\Support\Facades\Http;
use Purify;
class StatusRemoteUpdatePipeline implements ShouldQueue
{
@ -57,7 +56,7 @@ class StatusRemoteUpdatePipeline implements ShouldQueue
'spoiler_text' => $status->cw_summary,
'is_nsfw' => $status->is_nsfw,
'ordered_media_attachment_ids' => $status->media()->orderBy('order')->pluck('id')->toArray(),
'created_at' => $status->created_at
'created_at' => $status->created_at,
]);
}
}
@ -75,7 +74,7 @@ class StatusRemoteUpdatePipeline implements ShouldQueue
$nm['url']
) &&
in_array($nm['type'], ['Document', 'Image', 'Video']) &&
in_array($nm['mediaType'], explode(',', config('pixelfed.media_types')));
in_array($nm['mediaType'], explode(',', config_cache('pixelfed.media_types')));
});
// Skip when no media
@ -86,7 +85,7 @@ class StatusRemoteUpdatePipeline implements ShouldQueue
Media::whereProfileId($status->profile_id)
->whereStatusId($status->id)
->update([
'status_id' => null
'status_id' => null,
]);
$nm->each(function ($n, $key) use ($status) {
@ -96,7 +95,7 @@ class StatusRemoteUpdatePipeline implements ShouldQueue
return;
}
if(!in_array($res->header('content-type'), explode(',',config('pixelfed.media_types')))) {
if (! in_array($res->header('content-type'), explode(',', config_cache('pixelfed.media_types')))) {
return;
}
@ -167,7 +166,7 @@ class StatusRemoteUpdatePipeline implements ShouldQueue
'caption' => $cleaned,
'spoiler_text' => $spoiler_text,
'is_nsfw' => $sensitive,
'ordered_media_attachment_ids' => $mids
'ordered_media_attachment_ids' => $mids,
]);
}
}