Add configuration
This commit is contained in:
parent
49c1ad2cc0
commit
aa3dc7c40c
2 changed files with 25 additions and 3 deletions
|
@ -3316,10 +3316,16 @@ class Diaspora
|
||||||
|
|
||||||
$type = 'reshare';
|
$type = 'reshare';
|
||||||
} else {
|
} else {
|
||||||
$item['body'] = Post\Media::removeFromEndOfBody($item['body']);
|
$native_photos = DI::config()->get('diaspora', 'native_photos');
|
||||||
|
if ($native_photos) {
|
||||||
|
$item['body'] = Post\Media::removeFromEndOfBody($item['body']);
|
||||||
|
$attach_media = [Post\Media::AUDIO, Post\Media::VIDEO];
|
||||||
|
} else {
|
||||||
|
$attach_media = [Post\Media::AUDIO, Post\Media::IMAGE, Post\Media::VIDEO];
|
||||||
|
}
|
||||||
|
|
||||||
$title = $item['title'];
|
$title = $item['title'];
|
||||||
$body = Post\Media::addAttachmentsToBody($item['uri-id'], DI::contentItem()->addSharedPost($item), [Post\Media::AUDIO, Post\Media::VIDEO]);
|
$body = Post\Media::addAttachmentsToBody($item['uri-id'], DI::contentItem()->addSharedPost($item), $attach_media);
|
||||||
|
|
||||||
// Fetch the title from an attached link - if there is one
|
// Fetch the title from an attached link - if there is one
|
||||||
if (empty($item['title']) && DI::pConfig()->get($owner['uid'], 'system', 'attach_link_title')) {
|
if (empty($item['title']) && DI::pConfig()->get($owner['uid'], 'system', 'attach_link_title')) {
|
||||||
|
@ -3367,7 +3373,9 @@ class Diaspora
|
||||||
'location' => $location
|
'location' => $location
|
||||||
];
|
];
|
||||||
|
|
||||||
$message = self::addPhotos($item, $message);
|
if ($native_photos) {
|
||||||
|
$message = self::addPhotos($item, $message);
|
||||||
|
}
|
||||||
|
|
||||||
// Diaspora rejects messages when they contain a location without "lat" or "lng"
|
// Diaspora rejects messages when they contain a location without "lat" or "lng"
|
||||||
if (!isset($location['lat']) || !isset($location['lng'])) {
|
if (!isset($location['lat']) || !isset($location['lng'])) {
|
||||||
|
@ -3403,6 +3411,13 @@ class Diaspora
|
||||||
return $msg;
|
return $msg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Add photo elements to the message array
|
||||||
|
*
|
||||||
|
* @param array $item
|
||||||
|
* @param array $message
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
private static function addPhotos(array $item, array $message): array
|
private static function addPhotos(array $item, array $message): array
|
||||||
{
|
{
|
||||||
$medias = Post\Media::getByURIId($item['uri-id'], [Post\Media::IMAGE]);
|
$medias = Post\Media::getByURIId($item['uri-id'], [Post\Media::IMAGE]);
|
||||||
|
|
|
@ -711,6 +711,13 @@ return [
|
||||||
// Must be writable by the ejabberd process. if set then it will prevent the running of multiple processes.
|
// Must be writable by the ejabberd process. if set then it will prevent the running of multiple processes.
|
||||||
'lockpath' => '',
|
'lockpath' => '',
|
||||||
],
|
],
|
||||||
|
'diaspora' => [
|
||||||
|
// native_photos (Boolean)
|
||||||
|
// If enabled, photos to Diaspora will be transmitted via the "photo" element instead of embedding them to the body.
|
||||||
|
// This is some visual improvement over the embedding but comes with the cost of losing accessibility.
|
||||||
|
// Is is disabled by default until Diaspora eventually will work on issue https://github.com/diaspora/diaspora/issues/8297
|
||||||
|
'native_photos' => false,
|
||||||
|
],
|
||||||
'debug' => [
|
'debug' => [
|
||||||
// ap_inbox_log (Boolean)
|
// ap_inbox_log (Boolean)
|
||||||
// Logs every call to /inbox as a JSON file in Friendica's temporary directory
|
// Logs every call to /inbox as a JSON file in Friendica's temporary directory
|
||||||
|
|
Loading…
Reference in a new issue