mirror of
https://git.sekbaer.de/Friendica/friendica.git
synced 2025-06-09 16:44:26 +02:00
Issue 12530: Align the instance endpoint to the latest changes
This commit is contained in:
parent
02afde3eec
commit
199ac64202
9 changed files with 152 additions and 8 deletions
|
@ -31,6 +31,7 @@ use Friendica\DI;
|
|||
use Friendica\Model\User;
|
||||
use Friendica\Module\Register;
|
||||
use Friendica\Network\HTTPException;
|
||||
use Friendica\Object\Api\Mastodon\InstanceV2\Configuration;
|
||||
|
||||
/**
|
||||
* Class Instance
|
||||
|
@ -68,6 +69,8 @@ class Instance extends BaseDataTransferObject
|
|||
/** @var bool */
|
||||
protected $invites_enabled;
|
||||
/** @var Account|null */
|
||||
/** @var Configuration */
|
||||
protected $configuration;
|
||||
protected $contact_account = null;
|
||||
/** @var array */
|
||||
protected $rules = [];
|
||||
|
@ -81,7 +84,7 @@ class Instance extends BaseDataTransferObject
|
|||
* @throws HTTPException\NotFoundException
|
||||
* @throws \ImagickException
|
||||
*/
|
||||
public function __construct(IManageConfigValues $config, BaseURL $baseUrl, Database $database, array $rules = [])
|
||||
public function __construct(IManageConfigValues $config, BaseURL $baseUrl, Database $database, array $rules = [], Configuration $configuration)
|
||||
{
|
||||
$register_policy = intval($config->get('config', 'register_policy'));
|
||||
|
||||
|
@ -98,6 +101,7 @@ class Instance extends BaseDataTransferObject
|
|||
$this->registrations = ($register_policy != Register::CLOSED);
|
||||
$this->approval_required = ($register_policy == Register::APPROVE);
|
||||
$this->invites_enabled = false;
|
||||
$this->configuration = $configuration;
|
||||
$this->contact_account = [];
|
||||
$this->rules = $rules;
|
||||
|
||||
|
|
35
src/Object/Api/Mastodon/InstanceV2/Accounts.php
Normal file
35
src/Object/Api/Mastodon/InstanceV2/Accounts.php
Normal file
|
@ -0,0 +1,35 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Object\Api\Mastodon\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class Accounts
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class Accounts extends BaseDataTransferObject
|
||||
{
|
||||
/** @var int */
|
||||
protected $max_featured_tags = 0;
|
||||
}
|
|
@ -30,10 +30,14 @@ use Friendica\BaseDataTransferObject;
|
|||
*/
|
||||
class Configuration extends BaseDataTransferObject
|
||||
{
|
||||
/** @var Accounts */
|
||||
protected $accounts;
|
||||
/** @var StatusesConfig */
|
||||
protected $statuses;
|
||||
/** @var MediaAttachmentsConfig */
|
||||
protected $media_attachments;
|
||||
/** @var Polls */
|
||||
protected $polls;
|
||||
|
||||
/**
|
||||
* @param StatusesConfig $statuses
|
||||
|
@ -41,9 +45,13 @@ class Configuration extends BaseDataTransferObject
|
|||
*/
|
||||
public function __construct(
|
||||
StatusesConfig $statuses,
|
||||
MediaAttachmentsConfig $media_attachments
|
||||
MediaAttachmentsConfig $media_attachments,
|
||||
Polls $polls,
|
||||
Accounts $accounts,
|
||||
) {
|
||||
$this->accounts = $accounts;
|
||||
$this->statuses = $statuses;
|
||||
$this->media_attachments = $media_attachments;
|
||||
$this->polls = $polls;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,13 +34,22 @@ class MediaAttachmentsConfig extends BaseDataTransferObject
|
|||
protected $supported_mime_types;
|
||||
/** @var int */
|
||||
protected $image_size_limit;
|
||||
/** @var int */
|
||||
protected $image_matrix_limit;
|
||||
/** @var int */
|
||||
protected $video_size_limit = 0;
|
||||
/** @var int */
|
||||
protected $video_frame_rate_limit = 0;
|
||||
/** @var int */
|
||||
protected $video_matrix_limit = 0;
|
||||
|
||||
/**
|
||||
* @param array $supported_mime_types
|
||||
*/
|
||||
public function __construct(array $supported_mime_types, int $image_size_limit)
|
||||
public function __construct(array $supported_mime_types, int $image_size_limit, int $image_matrix_limit)
|
||||
{
|
||||
$this->supported_mime_types = $supported_mime_types;
|
||||
$this->image_size_limit = $image_size_limit;
|
||||
$this->image_matrix_limit = $image_matrix_limit;
|
||||
}
|
||||
}
|
||||
|
|
41
src/Object/Api/Mastodon/InstanceV2/Polls.php
Normal file
41
src/Object/Api/Mastodon/InstanceV2/Polls.php
Normal file
|
@ -0,0 +1,41 @@
|
|||
<?php
|
||||
/**
|
||||
* @copyright Copyright (C) 2010-2023, the Friendica project
|
||||
*
|
||||
* @license GNU AGPL version 3 or any later version
|
||||
*
|
||||
* This program is free software: you can redistribute it and/or modify
|
||||
* it under the terms of the GNU Affero General Public License as
|
||||
* published by the Free Software Foundation, either version 3 of the
|
||||
* License, or (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Affero General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Affero General Public License
|
||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Object\Api\Mastodon\InstanceV2;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class Polls
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/Instance/
|
||||
*/
|
||||
class Polls extends BaseDataTransferObject
|
||||
{
|
||||
/** @var int */
|
||||
protected $max_options = 0;
|
||||
/** @var int */
|
||||
protected $max_characters_per_option = 0;
|
||||
/** @var int */
|
||||
protected $min_expiration = 0;
|
||||
/** @var int */
|
||||
protected $max_expiration = 0;
|
||||
}
|
|
@ -34,6 +34,10 @@ class Registrations extends BaseDataTransferObject
|
|||
protected $enabled;
|
||||
/** @var bool */
|
||||
protected $approval_required;
|
||||
/** @var string|null */
|
||||
protected $message;
|
||||
/** @var string|null */
|
||||
protected $url;
|
||||
|
||||
/**
|
||||
* @param bool $enabled
|
||||
|
|
|
@ -32,12 +32,20 @@ class StatusesConfig extends BaseDataTransferObject
|
|||
{
|
||||
/** @var int */
|
||||
protected $max_characters = 0;
|
||||
/** @var int */
|
||||
protected $max_media_attachments = 0;
|
||||
/** @var int */
|
||||
protected $characters_reserved_per_url = 0;
|
||||
|
||||
/**
|
||||
* @param int $max_characters
|
||||
* @param int $max_media_attachments
|
||||
* @param int $characters_reserved_per_url
|
||||
*/
|
||||
public function __construct(int $max_characters)
|
||||
public function __construct(int $max_characters, int $max_media_attachments, int $characters_reserved_per_url)
|
||||
{
|
||||
$this->max_characters = $max_characters;
|
||||
$this->max_characters = $max_characters;
|
||||
$this->max_media_attachments = $max_media_attachments;
|
||||
$this->characters_reserved_per_url = $characters_reserved_per_url;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue