1
0
Fork 0

Fix Mastodon InstanceV2 structure needs image max size under mediaAttachment

This commit is contained in:
Hank Grabowski 2023-03-17 15:56:42 -04:00
parent 6e94220642
commit c609affeca
3 changed files with 8 additions and 9 deletions

View file

@ -112,10 +112,11 @@ class InstanceV2 extends BaseApi
$this->config->get('config', 'max_import_size') $this->config->get('config', 'max_import_size')
)); ));
$image_size_limit = $this->config->get('system', 'maximagesize');
return new InstanceEntity\Configuration( return new InstanceEntity\Configuration(
$statuses_config, $statuses_config,
new InstanceEntity\MediaAttachmentsConfig(Images::supportedTypes()), new InstanceEntity\MediaAttachmentsConfig(Images::supportedTypes(), $image_size_limit),
$this->config->get('system', 'maximagesize')
); );
} }

View file

@ -34,21 +34,16 @@ class Configuration extends BaseDataTransferObject
protected $statuses; protected $statuses;
/** @var MediaAttachmentsConfig */ /** @var MediaAttachmentsConfig */
protected $media_attachments; protected $media_attachments;
/** @var int */
protected $image_size_limit;
/** /**
* @param StatusesConfig $statuses * @param StatusesConfig $statuses
* @param MediaAttachmentsConfig $media_attachments * @param MediaAttachmentsConfig $media_attachments
* @param int $image_size_limit
*/ */
public function __construct( public function __construct(
StatusesConfig $statuses, StatusesConfig $statuses,
MediaAttachmentsConfig $media_attachments, MediaAttachmentsConfig $media_attachments
int $image_size_limit
) { ) {
$this->statuses = $statuses; $this->statuses = $statuses;
$this->media_attachments = $media_attachments; $this->media_attachments = $media_attachments;
$this->image_size_limit = $image_size_limit;
} }
} }

View file

@ -32,12 +32,15 @@ class MediaAttachmentsConfig extends BaseDataTransferObject
{ {
/** @var string[] */ /** @var string[] */
protected $supported_mime_types; protected $supported_mime_types;
/** @var int */
protected $image_size_limit;
/** /**
* @param array $supported_mime_types * @param array $supported_mime_types
*/ */
public function __construct(array $supported_mime_types) public function __construct(array $supported_mime_types, int $image_size_limit)
{ {
$this->supported_mime_types = $supported_mime_types; $this->supported_mime_types = $supported_mime_types;
$this->image_size_limit = $image_size_limit;
} }
} }