1
1
Fork 0

Update Mastodon API version string to include Mastodon version compatibility

This commit is contained in:
Hypolite Petovan 2022-02-20 16:19:22 -05:00
parent e0ea51818e
commit d7b573c6d7
2 changed files with 26 additions and 3 deletions

View file

@ -21,21 +21,44 @@
namespace Friendica\Module\Api\Mastodon;
use Friendica\App;
use Friendica\Core\Config\Capability\IManageConfigValues;
use Friendica\Core\L10n;
use Friendica\Core\System;
use Friendica\DI;
use Friendica\Database\Database;
use Friendica\Module\Api\ApiResponse;
use Friendica\Module\BaseApi;
use Friendica\Object\Api\Mastodon\Instance as InstanceEntity;
use Friendica\Util\Profiler;
use Psr\Log\LoggerInterface;
/**
* @see https://docs.joinmastodon.org/api/rest/instances/
*/
class Instance extends BaseApi
{
/** @var Database */
private $database;
/** @var IManageConfigValues */
private $config;
public function __construct(App $app, L10n $l10n, App\BaseURL $baseUrl, App\Arguments $args, LoggerInterface $logger, Profiler $profiler, ApiResponse $response, Database $database, IManageConfigValues $config, array $server, array $parameters = [])
{
parent::__construct($app, $l10n, $baseUrl, $args, $logger, $profiler, $response, $server, $parameters);
$this->database = $database;
$this->config = $config;
}
/**
* @param array $request
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
* @throws \Friendica\Network\HTTPException\NotFoundException
* @throws \ImagickException
*/
protected function rawContent(array $request = [])
{
System::jsonExit(new InstanceEntity(DI::config(), $this->baseUrl, DI::dba()));
System::jsonExit(new InstanceEntity($this->config, $this->baseUrl, $this->database));
}
}

View file

@ -87,7 +87,7 @@ class Instance extends BaseDataTransferObject
$this->title = $config->get('config', 'sitename');
$this->short_description = $this->description = $config->get('config', 'info');
$this->email = $config->get('config', 'admin_email');
$this->version = FRIENDICA_VERSION;
$this->version = '2.8.0 (compatible; Friendica ' . FRIENDICA_VERSION . ')';
$this->urls = null; // Not supported
$this->stats = new Stats($config, $database);
$this->thumbnail = $baseUrl->get() . ($config->get('system', 'shortcut_icon') ?? 'images/friendica-32.png');