Fix last merge issues
This commit is contained in:
parent
ecb812d5e6
commit
295d4a254d
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -90,6 +90,32 @@ class ActivityPubPlugin extends Plugin
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Overwrites variables in URL-mapping
|
||||
*/
|
||||
class ActivityPubURLMapperOverwrite extends URLMapper
|
||||
{
|
||||
static function overwrite_variable ($m, $path, $args, $paramPatterns, $newaction) {
|
||||
$mimes = [
|
||||
'application/activity+json',
|
||||
'application/ld+json',
|
||||
'application/ld+json; profile="https://www.w3.org/ns/activitystreams"'
|
||||
];
|
||||
|
||||
if (in_array ($_SERVER["HTTP_ACCEPT"], $mimes) == false) {
|
||||
return true;
|
||||
}
|
||||
|
||||
$m->connect ($path, array('action' => $newaction), $paramPatterns);
|
||||
$regex = self::makeRegex($path, $paramPatterns);
|
||||
foreach ($m->variables as $n => $v) {
|
||||
if ($v[1] == $regex) {
|
||||
$m->variables[$n][0]['action'] = $newaction;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Plugin return handler
|
||||
*/
|
||||
|
@ -26,14 +26,13 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
|
@ -26,14 +26,13 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
|
@ -1,13 +1,8 @@
|
||||
<?php
|
||||
require_once dirname (__DIR__) . DIRECTORY_SEPARATOR . "utils" . DIRECTORY_SEPARATOR . "discovery.php";
|
||||
use Activitypub_Discovery;
|
||||
|
||||
/**
|
||||
* GNU social - a federating social network
|
||||
*
|
||||
* Todo: Description
|
||||
*
|
||||
* PHP version 5
|
||||
* 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
|
||||
@ -26,80 +21,93 @@ use Activitypub_Discovery;
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @copyright 2015 Free Software Foundaction, Inc.
|
||||
* @copyright 2018 Free Software Foundation http://fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link https://gnu.io/social
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
class apActorInboxAction extends ManagedAction
|
||||
{
|
||||
protected $needLogin = false;
|
||||
protected $canPost = true;
|
||||
protected $needLogin = false;
|
||||
protected $canPost = true;
|
||||
|
||||
protected function handle ()
|
||||
{
|
||||
$nickname = $this->trimmed ('nickname');
|
||||
try {
|
||||
$user = User::getByNickname ($nickname);
|
||||
$profile = $user->getProfile ();
|
||||
$url = $profile->profileurl;
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid username.");
|
||||
}
|
||||
/**
|
||||
* Handle the Actor Inbox request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function handle ()
|
||||
{
|
||||
$nickname = $this->trimmed ('nickname');
|
||||
try {
|
||||
$user = User::getByNickname ($nickname);
|
||||
$profile = $user->getProfile ();
|
||||
$url = $profile->profileurl;
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid username.");
|
||||
}
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
ActivityPubReturn::error ("C2S not implemented just yet.");
|
||||
}
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
ActivityPubReturn::error ("C2S not implemented just yet.");
|
||||
}
|
||||
|
||||
$data = json_decode (file_get_contents ('php://input'));
|
||||
$data = json_decode (file_get_contents ('php://input'));
|
||||
|
||||
// Validate data
|
||||
if (!(isset($data->type))) {
|
||||
ActivityPubReturn::error ("Type was not specified.");
|
||||
}
|
||||
if (!isset($data->actor)) {
|
||||
ActivityPubReturn::error ("Actor was not specified.");
|
||||
}
|
||||
if (!isset($data->object)) {
|
||||
ActivityPubReturn::error ("Object was not specified.");
|
||||
}
|
||||
// Validate data
|
||||
if (!(isset($data->type))) {
|
||||
ActivityPubReturn::error ("Type was not specified.");
|
||||
}
|
||||
if (!isset($data->actor)) {
|
||||
ActivityPubReturn::error ("Actor was not specified.");
|
||||
}
|
||||
if (!isset($data->object)) {
|
||||
ActivityPubReturn::error ("Object was not specified.");
|
||||
}
|
||||
|
||||
// Get valid Actor object
|
||||
try {
|
||||
require_once dirname (__DIR__) . DIRECTORY_SEPARATOR . "utils" . DIRECTORY_SEPARATOR . "discovery.php";
|
||||
$actor_profile = new Activitypub_Discovery;
|
||||
$actor_profile = $actor_profile->lookup($data->actor);
|
||||
$actor_profile = $actor_profile[0];
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid Actor.", 404);
|
||||
}
|
||||
// Get valid Actor object
|
||||
try {
|
||||
require_once dirname (__DIR__) . DIRECTORY_SEPARATOR . "utils" . DIRECTORY_SEPARATOR . "discovery.php";
|
||||
$actor_profile = new Activitypub_Discovery;
|
||||
$actor_profile = $actor_profile->lookup ($data->actor);
|
||||
$actor_profile = $actor_profile[0];
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid Actor.", 404);
|
||||
}
|
||||
|
||||
$to_profiles = array ($user);
|
||||
$to_profiles = array ($user);
|
||||
|
||||
// Process request
|
||||
switch ($data->type) {
|
||||
case "Create":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Create.php";
|
||||
break;
|
||||
case "Delete":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Delete.php";
|
||||
break;
|
||||
case "Follow":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Follow.php";
|
||||
break;
|
||||
case "Like":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Like.php";
|
||||
break;
|
||||
case "Undo":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Undo.php";
|
||||
break;
|
||||
case "Announce":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Announce.php";
|
||||
break;
|
||||
default:
|
||||
ActivityPubReturn::error ("Invalid type value.");
|
||||
// Process request
|
||||
switch ($data->type) {
|
||||
case "Create":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Create.php";
|
||||
break;
|
||||
case "Delete":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Delete.php";
|
||||
break;
|
||||
case "Follow":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Follow.php";
|
||||
break;
|
||||
case "Like":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Like.php";
|
||||
break;
|
||||
case "Undo":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Undo.php";
|
||||
break;
|
||||
case "Announce":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Announce.php";
|
||||
break;
|
||||
default:
|
||||
ActivityPubReturn::error ("Invalid type value.");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,14 +26,13 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -1,4 +1,5 @@
|
||||
<?php
|
||||
|
||||
require_once dirname (__DIR__) . DIRECTORY_SEPARATOR . "utils" . DIRECTORY_SEPARATOR . "discovery.php";
|
||||
use Activitypub_Discovery;
|
||||
use ActivityPubReturn;
|
||||
@ -7,9 +8,7 @@ use Activitypub_notice;
|
||||
/**
|
||||
* GNU social - a federating social network
|
||||
*
|
||||
* Todo: Description
|
||||
*
|
||||
* PHP version 5
|
||||
* 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
|
||||
@ -28,95 +27,107 @@ use Activitypub_notice;
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @copyright 2015 Free Software Foundaction, Inc.
|
||||
* @copyright 2018 Free Software Foundation http://fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link https://gnu.io/social
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit (1);
|
||||
}
|
||||
|
||||
if (!defined('GNUSOCIAL')) { exit(1); }
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
class apSharedInboxAction extends ManagedAction
|
||||
{
|
||||
protected $needLogin = false;
|
||||
protected $canPost = true;
|
||||
protected $needLogin = false;
|
||||
protected $canPost = true;
|
||||
|
||||
protected function handle ()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
ActivityPubReturn::error ("Only POST requests allowed.");
|
||||
}
|
||||
|
||||
$data = json_decode (file_get_contents ('php://input'));
|
||||
|
||||
// Validate data
|
||||
if (!(isset($data->type))) {
|
||||
ActivityPubReturn::error ("Type was not specified.");
|
||||
}
|
||||
if (!isset($data->actor)) {
|
||||
ActivityPubReturn::error ("Actor was not specified.");
|
||||
}
|
||||
if (!isset($data->to)) {
|
||||
ActivityPubReturn::error ("To was not specified.");
|
||||
}
|
||||
if (!isset($data->object)) {
|
||||
ActivityPubReturn::error ("Object was not specified.");
|
||||
}
|
||||
|
||||
$discovery = new Activitypub_Discovery;
|
||||
|
||||
// Get valid Actor object
|
||||
try {
|
||||
$actor_profile = $discovery->lookup ($data->actor);
|
||||
$actor_profile = $actor_profile[0];
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid Actor.", 404);
|
||||
}
|
||||
|
||||
// Public To:
|
||||
$public_to = array ("https://www.w3.org/ns/activitystreams#Public",
|
||||
"Public",
|
||||
"as:Public");
|
||||
|
||||
$to_profiles = array ();
|
||||
// Generate To objects
|
||||
if (is_array ($data->to)) {
|
||||
// Remove duplicates from To actors set
|
||||
array_unique ($data->to);
|
||||
foreach ($data->to as $to_url) {
|
||||
try {
|
||||
$to_profiles = array_merge ($to_profiles, $discovery->lookup ($to_url));
|
||||
} catch (Exception $e) {
|
||||
// XXX: Invalid actor found, not sure how we handle those
|
||||
/**
|
||||
* Handle the Shared Inbox request
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function handle ()
|
||||
{
|
||||
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
|
||||
ActivityPubReturn::error ("Only POST requests allowed.");
|
||||
}
|
||||
}
|
||||
} else if (empty ($data->to)
|
||||
|| in_array ($data->to, $public_to)) {
|
||||
// No need to do anything else at this point, let's just break out the if
|
||||
} else {
|
||||
try {
|
||||
$to_profiles[]= $discovery->lookup ($data->to);
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid Actor.", 404);
|
||||
}
|
||||
}
|
||||
unset ($discovery);
|
||||
|
||||
// Process request
|
||||
switch ($data->type) {
|
||||
case "Create":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Create.php";
|
||||
break;
|
||||
case "Follow":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Follow.php";
|
||||
break;
|
||||
case "Like":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Like.php";
|
||||
break;
|
||||
case "Announce":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Announce.php";
|
||||
break;
|
||||
default:
|
||||
ActivityPubReturn::error ("Invalid type value.");
|
||||
}
|
||||
$data = json_decode (file_get_contents ('php://input'));
|
||||
|
||||
// Validate data
|
||||
if (!isset($data->type)) {
|
||||
ActivityPubReturn::error ("Type was not specified.");
|
||||
}
|
||||
if (!isset($data->actor)) {
|
||||
ActivityPubReturn::error ("Actor was not specified.");
|
||||
}
|
||||
if (!isset($data->to)) {
|
||||
ActivityPubReturn::error ("To was not specified.");
|
||||
}
|
||||
if (!isset($data->object)) {
|
||||
ActivityPubReturn::error ("Object was not specified.");
|
||||
}
|
||||
|
||||
$discovery = new Activitypub_Discovery;
|
||||
|
||||
// Get valid Actor object
|
||||
try {
|
||||
$actor_profile = $discovery->lookup ($data->actor);
|
||||
$actor_profile = $actor_profile[0];
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid Actor.", 404);
|
||||
}
|
||||
|
||||
// Public To:
|
||||
$public_to = array ("https://www.w3.org/ns/activitystreams#Public",
|
||||
"Public",
|
||||
"as:Public");
|
||||
|
||||
$to_profiles = array ();
|
||||
// Generate To objects
|
||||
if (is_array ($data->to)) {
|
||||
// Remove duplicates from To actors set
|
||||
array_unique ($data->to);
|
||||
foreach ($data->to as $to_url) {
|
||||
try {
|
||||
$to_profiles = array_merge ($to_profiles, $discovery->lookup ($to_url));
|
||||
} catch (Exception $e) {
|
||||
// XXX: Invalid actor found, not sure how we handle those
|
||||
}
|
||||
}
|
||||
} else if (empty ($data->to) || in_array ($data->to, $public_to)) {
|
||||
// No need to do anything else at this point, let's just break out the if
|
||||
} else {
|
||||
try {
|
||||
$to_profiles[]= $discovery->lookup ($data->to);
|
||||
} catch (Exception $e) {
|
||||
ActivityPubReturn::error ("Invalid Actor.", 404);
|
||||
}
|
||||
}
|
||||
unset ($discovery);
|
||||
|
||||
// Process request
|
||||
switch ($data->type) {
|
||||
case "Create":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Create.php";
|
||||
break;
|
||||
case "Follow":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Follow.php";
|
||||
break;
|
||||
case "Like":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Like.php";
|
||||
break;
|
||||
case "Announce":
|
||||
require_once __DIR__ . DIRECTORY_SEPARATOR . "inbox" . DIRECTORY_SEPARATOR . "Announce.php";
|
||||
break;
|
||||
default:
|
||||
ActivityPubReturn::error ("Invalid type value.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
$valid_object_types = array ("Note");
|
||||
@ -70,7 +70,7 @@ if (Notice::contentTooLong ($content)) {
|
||||
ActivityPubReturn::error ("That's too long. Maximum notice size is %d character.");
|
||||
}
|
||||
|
||||
$options = array('source' = >'web', 'uri' = >$data->id);
|
||||
$options = array ('source' => 'web', 'uri' => $data->id);
|
||||
// $options gets filled with possible scoping settings
|
||||
ToSelector::fillActivity ($this, $act, $options);
|
||||
|
||||
|
@ -26,12 +26,12 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
try {
|
||||
Activitypub_notice::getByUri ($data->object)->deleteAs ($actor_profile);
|
||||
ActivityPubReturn::answer ("Notice deleted successfully.");
|
||||
} catch(Exception $ex) {
|
||||
ActivityPubReturn::error ($ex->getMessage(), 403);
|
||||
ActivityPubReturn::error ($ex->getMessage (), 403);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
// Get valid Object profile
|
||||
@ -44,6 +44,6 @@ try {
|
||||
} else {
|
||||
ActivityPubReturn::error ("Already following.", 409);
|
||||
}
|
||||
} catch(Exception $ex) {
|
||||
} catch (Exception $ex) {
|
||||
ActivityPubReturn::error ("Invalid Object Actor URL.", 404);
|
||||
}
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
try {
|
||||
|
@ -29,7 +29,7 @@ use Activitypub_Discovery;
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
// Validate data
|
||||
|
@ -26,14 +26,13 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
|
@ -26,14 +26,13 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -45,22 +45,22 @@ class Activitypub_notice extends Managed_DataObject
|
||||
* @param \Notice $notice
|
||||
* @return pretty array to be used in a response
|
||||
*/
|
||||
public static function noticeToObject($notice) {
|
||||
public static function noticeToObject ($notice) {
|
||||
$attachments = array ();
|
||||
foreach($notice->attachments()as $attachment) {
|
||||
foreach($notice->attachments () as $attachment) {
|
||||
$attachments[] = Activitypub_attachment::attachmentToObject ($attachment);
|
||||
}
|
||||
|
||||
$tags = array ();
|
||||
foreach($notice->getTags()as $tag) {
|
||||
if ($tag != "") { // Hacky workaround to avoid stupid outputs
|
||||
$tags[] = Activitypub_tag::tagNameToObject($tag);
|
||||
$tags[] = Activitypub_tag::tagNameToObject ($tag);
|
||||
}
|
||||
}
|
||||
|
||||
$to = array ();
|
||||
foreach ($notice->getAttentionProfileIDs()as $to_id) {
|
||||
$to[] = Profile::getById($to_id)->getUri();
|
||||
foreach ($notice->getAttentionProfileIDs () as $to_id) {
|
||||
$to[] = Profile::getById ($to_id)->getUri ();
|
||||
}
|
||||
if (!is_null($to)) {
|
||||
$to = array ("https://www.w3.org/ns/activitystreams#Public");
|
||||
|
@ -26,7 +26,7 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -26,14 +26,13 @@
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
@ -54,7 +53,7 @@ class Activitypub_tag extends Managed_DataObject
|
||||
]
|
||||
],
|
||||
'name' => $tag,
|
||||
'url' => common_local_url('tag', array('tag' => $tag))
|
||||
'url' => common_local_url ('tag', array('tag' => $tag))
|
||||
];
|
||||
|
||||
return $res;
|
||||
|
@ -22,25 +22,23 @@ use Profile;
|
||||
*
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @copyright 2018 Free Software Foundation http://fsf.org
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link https://www.gnu.org/software/social/
|
||||
*/
|
||||
if (!defined ('GNUSOCIAL')) {
|
||||
exit(1);
|
||||
exit (1);
|
||||
}
|
||||
|
||||
/**
|
||||
* @category Plugin
|
||||
* @package GNUsocial
|
||||
* @author Daniel Supernault <danielsupernault@gmail.com>
|
||||
* @author Diogo Cordeiro <diogo@fc.up.pt>
|
||||
* @license http://www.fsf.org/licensing/licenses/agpl-3.0.html GNU Affero General Public License version 3.0
|
||||
* @link http://www.gnu.org/software/social/
|
||||
*/
|
||||
|
||||
class Activitypub_Discovery
|
||||
{
|
||||
private $discovered_actor_profiles = array ();
|
||||
|
Reference in New Issue
Block a user