commit
ce4204e81a
4 changed files with 53 additions and 53 deletions
|
@ -42,7 +42,7 @@ class ActivityPub
|
||||||
const CONTENT_TYPES = ['Note', 'Article', 'Video', 'Image'];
|
const CONTENT_TYPES = ['Note', 'Article', 'Video', 'Image'];
|
||||||
const ACTIVITY_TYPES = ['Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept'];
|
const ACTIVITY_TYPES = ['Like', 'Dislike', 'Accept', 'Reject', 'TentativeAccept'];
|
||||||
/**
|
/**
|
||||||
* @brief Checks if the web request is done for the AP protocol
|
* Checks if the web request is done for the AP protocol
|
||||||
*
|
*
|
||||||
* @return is it AP?
|
* @return is it AP?
|
||||||
*/
|
*/
|
||||||
|
@ -110,9 +110,9 @@ class ActivityPub
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
* Fetches activities from the outbox of a given profile and processes it
|
||||||
*
|
*
|
||||||
* @param $url
|
* @param string $url
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
*/
|
*/
|
||||||
public static function fetchOutbox($url, $uid)
|
public static function fetchOutbox($url, $uid)
|
||||||
|
|
|
@ -17,12 +17,12 @@ use Friendica\Core\Config;
|
||||||
use Friendica\Protocol\ActivityPub;
|
use Friendica\Protocol\ActivityPub;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief ActivityPub Protocol class
|
* ActivityPub Protocol class
|
||||||
*/
|
*/
|
||||||
class Processor
|
class Processor
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Converts mentions from Pleroma into the Friendica format
|
* Converts mentions from Pleroma into the Friendica format
|
||||||
*
|
*
|
||||||
* @param string $body
|
* @param string $body
|
||||||
*
|
*
|
||||||
|
@ -37,7 +37,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Constructs a string with tags for a given tag array
|
* Constructs a string with tags for a given tag array
|
||||||
*
|
*
|
||||||
* @param array $tags
|
* @param array $tags
|
||||||
* @param boolean $sensitive
|
* @param boolean $sensitive
|
||||||
|
@ -67,7 +67,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param $attachments
|
* @param $attachments
|
||||||
* @param array $item
|
* @param array $item
|
||||||
|
@ -101,7 +101,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param $body
|
* @param $body
|
||||||
|
@ -129,7 +129,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param $body
|
* @param $body
|
||||||
|
@ -146,7 +146,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete items
|
* Delete items
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param $body
|
* @param $body
|
||||||
|
@ -160,7 +160,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param $body
|
* @param $body
|
||||||
|
@ -177,7 +177,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param array $item
|
* @param array $item
|
||||||
|
@ -234,7 +234,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param $url
|
* @param $url
|
||||||
* @param $child
|
* @param $child
|
||||||
|
@ -267,7 +267,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief perform a "follow" request
|
* perform a "follow" request
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
*/
|
*/
|
||||||
|
@ -307,7 +307,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Update the given profile
|
* Update the given profile
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
*/
|
*/
|
||||||
|
@ -322,7 +322,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Delete the given profile
|
* Delete the given profile
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
*/
|
*/
|
||||||
|
@ -348,7 +348,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Accept a follow request
|
* Accept a follow request
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
*/
|
*/
|
||||||
|
@ -381,7 +381,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reject a follow request
|
* Reject a follow request
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
*/
|
*/
|
||||||
|
@ -410,7 +410,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Undo activity like "like" or "dislike"
|
* Undo activity like "like" or "dislike"
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
*/
|
*/
|
||||||
|
@ -435,7 +435,7 @@ class Processor
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Activity to remove a follower
|
* Activity to remove a follower
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -37,7 +37,7 @@ use Friendica\Protocol\ActivityPub;
|
||||||
class Receiver
|
class Receiver
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief Checks if the web request is done for the AP protocol
|
* Checks if the web request is done for the AP protocol
|
||||||
*
|
*
|
||||||
* @return is it AP?
|
* @return is it AP?
|
||||||
*/
|
*/
|
||||||
|
@ -48,7 +48,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param $body
|
* @param $body
|
||||||
* @param $header
|
* @param $header
|
||||||
|
@ -104,7 +104,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
|
@ -174,7 +174,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param $body
|
* @param $body
|
||||||
|
@ -271,7 +271,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param $actor
|
* @param $actor
|
||||||
|
@ -357,7 +357,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Switches existing contacts to ActivityPub
|
* Switches existing contacts to ActivityPub
|
||||||
*
|
*
|
||||||
* @param integer $cid Contact ID
|
* @param integer $cid Contact ID
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
|
@ -389,7 +389,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param $receivers
|
* @param $receivers
|
||||||
* @param $actor
|
* @param $actor
|
||||||
|
@ -414,7 +414,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param $object_data
|
* @param $object_data
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
|
@ -442,7 +442,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param $object_id
|
* @param $object_id
|
||||||
* @param $object
|
* @param $object
|
||||||
|
@ -495,7 +495,7 @@ class Receiver
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief
|
*
|
||||||
*
|
*
|
||||||
* @param $object
|
* @param $object
|
||||||
*
|
*
|
||||||
|
|
|
@ -42,7 +42,7 @@ use Friendica\Core\Cache;
|
||||||
class Transmitter
|
class Transmitter
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* @brief collects the lost of followers of the given owner
|
* collects the lost of followers of the given owner
|
||||||
*
|
*
|
||||||
* @param array $owner Owner array
|
* @param array $owner Owner array
|
||||||
* @param integer $page Page number
|
* @param integer $page Page number
|
||||||
|
@ -89,7 +89,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Create list of following contacts
|
* Create list of following contacts
|
||||||
*
|
*
|
||||||
* @param array $owner Owner array
|
* @param array $owner Owner array
|
||||||
* @param integer $page Page numbe
|
* @param integer $page Page numbe
|
||||||
|
@ -136,7 +136,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Public posts for the given owner
|
* Public posts for the given owner
|
||||||
*
|
*
|
||||||
* @param array $owner Owner array
|
* @param array $owner Owner array
|
||||||
* @param integer $page Page numbe
|
* @param integer $page Page numbe
|
||||||
|
@ -238,7 +238,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns an array with permissions of a given item array
|
* Returns an array with permissions of a given item array
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
*
|
*
|
||||||
|
@ -291,7 +291,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates an array of permissions from an item thread
|
* Creates an array of permissions from an item thread
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
*
|
*
|
||||||
|
@ -379,7 +379,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fetches a list of inboxes of followers of a given user
|
* Fetches a list of inboxes of followers of a given user
|
||||||
*
|
*
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
*
|
*
|
||||||
|
@ -406,7 +406,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fetches an array of inboxes for the given item and user
|
* Fetches an array of inboxes for the given item and user
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
|
@ -450,7 +450,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns the activity type of a given item
|
* Returns the activity type of a given item
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
*
|
*
|
||||||
|
@ -482,7 +482,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates the activity or fetches it from the cache
|
* Creates the activity or fetches it from the cache
|
||||||
*
|
*
|
||||||
* @param integer $item_id
|
* @param integer $item_id
|
||||||
*
|
*
|
||||||
|
@ -503,7 +503,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates an activity array for a given item id
|
* Creates an activity array for a given item id
|
||||||
*
|
*
|
||||||
* @param integer $item_id
|
* @param integer $item_id
|
||||||
* @param boolean $object_mode Is the activity item is used inside another object?
|
* @param boolean $object_mode Is the activity item is used inside another object?
|
||||||
|
@ -569,7 +569,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates an object array for a given item id
|
* Creates an object array for a given item id
|
||||||
*
|
*
|
||||||
* @param integer $item_id
|
* @param integer $item_id
|
||||||
*
|
*
|
||||||
|
@ -590,7 +590,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns a tag array for a given item array
|
* Returns a tag array for a given item array
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
*
|
*
|
||||||
|
@ -619,7 +619,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Adds attachment data to the JSON document
|
* Adds attachment data to the JSON document
|
||||||
*
|
*
|
||||||
* @param array $item Data of the item that is to be posted
|
* @param array $item Data of the item that is to be posted
|
||||||
* @param text $type Object type
|
* @param text $type Object type
|
||||||
|
@ -674,7 +674,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Remove image elements and replaces them with links to the image
|
* Remove image elements and replaces them with links to the image
|
||||||
*
|
*
|
||||||
* @param string $body
|
* @param string $body
|
||||||
*
|
*
|
||||||
|
@ -692,7 +692,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Fetches the "context" value for a givem item array from the "conversation" table
|
* Fetches the "context" value for a givem item array from the "conversation" table
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
*
|
*
|
||||||
|
@ -712,7 +712,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Returns if the post contains sensitive content ("nsfw")
|
* Returns if the post contains sensitive content ("nsfw")
|
||||||
*
|
*
|
||||||
* @param integer $item_id
|
* @param integer $item_id
|
||||||
*
|
*
|
||||||
|
@ -725,7 +725,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Creates a note/article object array
|
* Creates a note/article object array
|
||||||
*
|
*
|
||||||
* @param array $item
|
* @param array $item
|
||||||
*
|
*
|
||||||
|
@ -797,7 +797,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Transmits a profile deletion to a given inbox
|
* Transmits a profile deletion to a given inbox
|
||||||
*
|
*
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
* @param string $inbox Target inbox
|
* @param string $inbox Target inbox
|
||||||
|
@ -823,7 +823,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Transmits a profile change to a given inbox
|
* Transmits a profile change to a given inbox
|
||||||
*
|
*
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
* @param string $inbox Target inbox
|
* @param string $inbox Target inbox
|
||||||
|
@ -849,7 +849,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Transmits a given activity to a target
|
* Transmits a given activity to a target
|
||||||
*
|
*
|
||||||
* @param array $activity
|
* @param array $activity
|
||||||
* @param string $target Target profile
|
* @param string $target Target profile
|
||||||
|
@ -875,7 +875,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Transmit a message that the contact request had been accepted
|
* Transmit a message that the contact request had been accepted
|
||||||
*
|
*
|
||||||
* @param string $target Target profile
|
* @param string $target Target profile
|
||||||
* @param $id
|
* @param $id
|
||||||
|
@ -902,7 +902,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Reject a contact request or terminates the contact relation
|
* Reject a contact request or terminates the contact relation
|
||||||
*
|
*
|
||||||
* @param string $target Target profile
|
* @param string $target Target profile
|
||||||
* @param $id
|
* @param $id
|
||||||
|
@ -929,7 +929,7 @@ class Transmitter
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @brief Transmits a message that we don't want to follow this contact anymore
|
* Transmits a message that we don't want to follow this contact anymore
|
||||||
*
|
*
|
||||||
* @param string $target Target profile
|
* @param string $target Target profile
|
||||||
* @param integer $uid User ID
|
* @param integer $uid User ID
|
||||||
|
|
Loading…
Reference in a new issue