Add Feature inbox

This commit is contained in:
Diogo Cordeiro
2018-07-10 00:26:02 +00:00
parent 08ec02561a
commit 15fab762b5
14 changed files with 611 additions and 69 deletions

View File

@@ -3,7 +3,7 @@
* GNU social - a federating social network
*
* ActivityPubPlugin implementation for GNU Social
*
*
* LICENCE: 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
@@ -26,7 +26,7 @@
* @link https://www.gnu.org/software/social/
*/
if (!defined ('GNUSOCIAL')) {
exit(1);
exit(1);
}
/**
@@ -39,37 +39,37 @@ if (!defined ('GNUSOCIAL')) {
*/
class Activitypub_attachment extends Managed_DataObject
{
/**
* Generates a pretty array from an Attachment object
*
* @param \Attachment $attachment
* @return pretty array to be used in a response
*/
public static function attachmentToObject ($attachment) {
$res = [
'@context' => [
"https://www.w3.org/ns/activitystreams",
[
"@language" => "en"
]
],
'id' => $attachment->getID (),
'mimetype' => $attachment->mimetype,
'url' => $attachment->getUrl (),
'size' => intval($attachment->size), // $attachment->getSize ()
'title' => $attachment->getTitle (),
'meta' => null
];
/**
* Generates a pretty array from an Attachment object
*
* @param \Attachment $attachment
* @return pretty array to be used in a response
*/
public static function attachmentToObject ($attachment) {
$res = [
'@context' => [
"https://www.w3.org/ns/activitystreams",
[
"@language" => "en"
]
],
'id' => $attachment->getID (),
'mimetype' => $attachment->mimetype,
'url' => $attachment->getUrl (),
'size' => intval($attachment->size), // $attachment->getSize ()
'title' => $attachment->getTitle (),
'meta' => null
];
// Image
if (substr ($res["mimetype"], 0, 5) == "image")
{
$res["meta"]= [
// Image
if (substr ($res["mimetype"], 0, 5) == "image")
{
$res["meta"]= [
'width' => $attachment->width,
'height' => $attachment->height
];
}
];
}
return $res;
}
return $res;
}
}