mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-25 15:55:22 +00:00
Update ComposeController, add mediaProcessingCheck method
This commit is contained in:
parent
6bee5072d0
commit
33b625f508
1 changed files with 35 additions and 0 deletions
|
@ -513,4 +513,39 @@ class ComposeController extends Controller
|
|||
|
||||
return $status->url();
|
||||
}
|
||||
|
||||
public function mediaProcessingCheck(Request $request)
|
||||
{
|
||||
$this->validate($request, [
|
||||
'id' => 'required|integer|min:1'
|
||||
]);
|
||||
|
||||
$media = Media::whereUserId($request->user()->id)
|
||||
->whereNull('status_id')
|
||||
->findOrFail($request->input('id'));
|
||||
|
||||
if(config('pixelfed.media_fast_process')) {
|
||||
return [
|
||||
'finished' => true
|
||||
];
|
||||
}
|
||||
|
||||
$finished = false;
|
||||
|
||||
switch ($media->mime) {
|
||||
case 'image/jpeg':
|
||||
case 'image/png':
|
||||
case 'video/mp4':
|
||||
$finished = config('pixelfed.cloud_storage') ? (bool) $media->cdn_url : (bool) $media->processed_at;
|
||||
break;
|
||||
|
||||
default:
|
||||
# code...
|
||||
break;
|
||||
}
|
||||
|
||||
return [
|
||||
'finished' => $finished
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue