]> git.mxchange.org Git - friendica.git/commitdiff
Update Mastodon API version string to include Mastodon version compatibility
authorHypolite Petovan <hypolite@mrpetovan.com>
Sun, 20 Feb 2022 21:19:22 +0000 (16:19 -0500)
committerHypolite Petovan <hypolite@mrpetovan.com>
Mon, 21 Feb 2022 01:22:39 +0000 (20:22 -0500)
src/Module/Api/Mastodon/Instance.php
src/Object/Api/Mastodon/Instance.php

index 6d3db9018472ff927bd3d18e1169adcfdaf96e53..e5e0a957969990f3a5c3802c935b4011db727494 100644 (file)
 
 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));
        }
 }
index 4337c3d1f35702d3b0aaa573a45953481277ff08..0ae96c972fef72865cde1ba488dd2836c110eee4 100644 (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');