mirror of
https://github.com/friendica/friendica
synced 2025-04-23 18:30:11 +00:00
Merge branch 'develop' into mastodon-instance-v2-implementation
This commit is contained in:
commit
41b5ec0262
150 changed files with 1165 additions and 1527 deletions
|
@ -95,7 +95,7 @@ class Account extends BaseDataTransferObject
|
|||
$this->id = (string)$account['pid'];
|
||||
$this->username = $account['nick'];
|
||||
$this->acct =
|
||||
strpos($account['url'], $baseUrl->get() . '/') === 0 ?
|
||||
strpos($account['url'], $baseUrl . '/') === 0 ?
|
||||
$account['nick'] :
|
||||
$account['addr'];
|
||||
$this->display_name = $account['name'];
|
||||
|
|
|
@ -84,14 +84,14 @@ class Instance extends BaseDataTransferObject
|
|||
{
|
||||
$register_policy = intval($config->get('config', 'register_policy'));
|
||||
|
||||
$this->uri = $baseUrl->get();
|
||||
$this->uri = $baseUrl;
|
||||
$this->title = $config->get('config', 'sitename');
|
||||
$this->short_description = $this->description = $config->get('config', 'info');
|
||||
$this->email = implode(',', User::getAdminEmailList());
|
||||
$this->version = '2.8.0 (compatible; Friendica ' . App::VERSION . ')';
|
||||
$this->urls = null; // Not supported
|
||||
$this->stats = new Stats($config, $database);
|
||||
$this->thumbnail = $baseUrl->get() . 'images/friendica-banner.jpg';
|
||||
$this->thumbnail = $baseUrl . 'images/friendica-banner.jpg';
|
||||
$this->languages = [$config->get('system', 'language')];
|
||||
$this->max_toot_chars = (int)$config->get('config', 'api_import_size', $config->get('config', 'max_import_size'));
|
||||
$this->registrations = ($register_policy != Register::CLOSED);
|
||||
|
|
|
@ -56,7 +56,7 @@ class Mention extends BaseDataTransferObject
|
|||
|
||||
if (!empty($contact)) {
|
||||
$this->acct =
|
||||
strpos($contact['url'], $baseUrl->get() . '/') === 0 ?
|
||||
strpos($contact['url'], $baseUrl . '/') === 0 ?
|
||||
$contact['nick'] :
|
||||
$contact['addr'];
|
||||
|
||||
|
|
|
@ -25,6 +25,7 @@ use Friendica\BaseDataTransferObject;
|
|||
use Friendica\Content\Text\BBCode;
|
||||
use Friendica\Model\Item;
|
||||
use Friendica\Object\Api\Mastodon\Status\Counts;
|
||||
use Friendica\Object\Api\Mastodon\Status\FriendicaExtension;
|
||||
use Friendica\Object\Api\Mastodon\Status\UserAttributes;
|
||||
use Friendica\Util\DateTimeFormat;
|
||||
|
||||
|
@ -95,6 +96,8 @@ class Status extends BaseDataTransferObject
|
|||
protected $card = null;
|
||||
/** @var Poll|null */
|
||||
protected $poll = null;
|
||||
/** @var FriendicaExtension */
|
||||
protected $friendica;
|
||||
|
||||
/**
|
||||
* Creates a status record from an item record.
|
||||
|
@ -148,6 +151,7 @@ class Status extends BaseDataTransferObject
|
|||
$this->emojis = [];
|
||||
$this->card = $card->toArray() ?: null;
|
||||
$this->poll = $poll;
|
||||
$this->friendica = new FriendicaExtension($item['title']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
48
src/Object/Api/Mastodon/Status/FriendicaExtension.php
Normal file
48
src/Object/Api/Mastodon/Status/FriendicaExtension.php
Normal file
|
@ -0,0 +1,48 @@
|
|||
<?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\Status;
|
||||
|
||||
use Friendica\BaseDataTransferObject;
|
||||
|
||||
/**
|
||||
* Class FriendicaExtension
|
||||
*
|
||||
* Additional fields on Mastodon Statuses for storing Friendica specific data
|
||||
*
|
||||
* @see https://docs.joinmastodon.org/entities/status
|
||||
*/
|
||||
class FriendicaExtension extends BaseDataTransferObject
|
||||
{
|
||||
/** @var string */
|
||||
protected $title;
|
||||
|
||||
/**
|
||||
* Creates a status count object
|
||||
*
|
||||
* @param string $title
|
||||
* @throws \Friendica\Network\HTTPException\InternalServerErrorException
|
||||
*/
|
||||
public function __construct(string $title)
|
||||
{
|
||||
$this->title = $title;
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue