mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-11-22 06:21:27 +00:00
Update config() to config_cache()
This commit is contained in:
parent
a9f009305c
commit
c0e693cc73
7 changed files with 13 additions and 13 deletions
|
@ -1033,7 +1033,7 @@ class ApiV1Controller extends Controller
|
|||
'file.*' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
|
@ -1074,7 +1074,7 @@ class ApiV1Controller extends Controller
|
|||
|
||||
$photo = $request->file('file');
|
||||
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
if(in_array($photo->getMimeType(), $mimes) == false) {
|
||||
abort(403, 'Invalid or unsupported mime type.');
|
||||
}
|
||||
|
|
|
@ -71,7 +71,7 @@ class ComposeController extends Controller
|
|||
'file.*' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
|
@ -107,7 +107,7 @@ class ComposeController extends Controller
|
|||
|
||||
$photo = $request->file('file');
|
||||
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
|
||||
abort_if(in_array($photo->getMimeType(), $mimes) == false, 400, 'Invalid media format');
|
||||
|
||||
|
@ -164,7 +164,7 @@ class ComposeController extends Controller
|
|||
'file' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
|
|
|
@ -500,7 +500,7 @@ class DirectMessageController extends Controller
|
|||
'file' => function() {
|
||||
return [
|
||||
'required',
|
||||
'mimes:' . config('pixelfed.media_types'),
|
||||
'mimes:' . config_cache('pixelfed.media_types'),
|
||||
'max:' . config_cache('pixelfed.max_photo_size'),
|
||||
];
|
||||
},
|
||||
|
@ -533,7 +533,7 @@ class DirectMessageController extends Controller
|
|||
}
|
||||
$photo = $request->file('file');
|
||||
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
if(in_array($photo->getMimeType(), $mimes) == false) {
|
||||
abort(403, 'Invalid or unsupported mime type.');
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ class StoryController extends Controller
|
|||
|
||||
protected function storePhoto($photo, $user)
|
||||
{
|
||||
$mimes = explode(',', config('pixelfed.media_types'));
|
||||
$mimes = explode(',', config_cache('pixelfed.media_types'));
|
||||
if(in_array($photo->getMimeType(), [
|
||||
'image/jpeg',
|
||||
'image/png',
|
||||
|
|
|
@ -63,7 +63,7 @@ class Helpers {
|
|||
|
||||
$activity = $data['object'];
|
||||
|
||||
$mimeTypes = explode(',', config('pixelfed.media_types'));
|
||||
$mimeTypes = explode(',', config_cache('pixelfed.media_types'));
|
||||
$mediaTypes = in_array('video/mp4', $mimeTypes) ? ['Document', 'Image', 'Video'] : ['Document', 'Image'];
|
||||
|
||||
if(!isset($activity['attachment']) || empty($activity['attachment'])) {
|
||||
|
@ -418,7 +418,7 @@ class Helpers {
|
|||
$attachments = isset($data['object']) ? $data['object']['attachment'] : $data['attachment'];
|
||||
$user = $status->profile;
|
||||
$storagePath = MediaPathService::get($user, 2);
|
||||
$allowed = explode(',', config('pixelfed.media_types'));
|
||||
$allowed = explode(',', config_cache('pixelfed.media_types'));
|
||||
|
||||
foreach($attachments as $media) {
|
||||
$type = $media['mediaType'];
|
||||
|
|
|
@ -251,7 +251,7 @@ class Inbox
|
|||
if(count($activity['attachment'])) {
|
||||
$photos = 0;
|
||||
$videos = 0;
|
||||
$allowed = explode(',', config('pixelfed.media_types'));
|
||||
$allowed = explode(',', config_cache('pixelfed.media_types'));
|
||||
$activity['attachment'] = array_slice($activity['attachment'], 0, config_cache('pixelfed.max_album_length'));
|
||||
foreach($activity['attachment'] as $a) {
|
||||
$type = $a['mediaType'];
|
||||
|
|
|
@ -22,7 +22,7 @@ class Config {
|
|||
'optimize_image' => config('pixelfed.optimize_image'),
|
||||
'optimize_video' => config('pixelfed.optimize_video'),
|
||||
|
||||
'media_types' => config('pixelfed.media_types'),
|
||||
'media_types' => config_cache('pixelfed.media_types'),
|
||||
'enforce_account_limit' => config('pixelfed.enforce_account_limit')
|
||||
],
|
||||
|
||||
|
@ -57,7 +57,7 @@ class Config {
|
|||
'mobile_apis' => config('pixelfed.oauth_enabled'),
|
||||
'circles' => false,
|
||||
'stories' => config('instance.stories.enabled'),
|
||||
'video' => Str::contains(config('pixelfed.media_types'), 'video/mp4'),
|
||||
'video' => Str::contains(config_cache('pixelfed.media_types'), 'video/mp4'),
|
||||
'import' => [
|
||||
'instagram' => config('pixelfed.import.instagram.enabled'),
|
||||
'mastodon' => false,
|
||||
|
|
Loading…
Reference in a new issue