mirror of
https://github.com/friendica/friendica
synced 2025-04-27 07:50:10 +00:00
First implementation of ActivityPub C2S
This commit is contained in:
parent
df021b07e3
commit
101b3c9703
7 changed files with 295 additions and 55 deletions
|
@ -21,11 +21,12 @@
|
|||
|
||||
namespace Friendica\Module\ActivityPub;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Logger;
|
||||
use Friendica\Core\System;
|
||||
use Friendica\Database\DBA;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Module\BaseApi;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
use Friendica\Util\Network;
|
||||
|
@ -33,9 +34,35 @@ use Friendica\Util\Network;
|
|||
/**
|
||||
* ActivityPub Inbox
|
||||
*/
|
||||
class Inbox extends BaseModule
|
||||
class Inbox extends BaseApi
|
||||
{
|
||||
protected function rawContent(array $request = [])
|
||||
{
|
||||
self::checkAllowedScope(self::SCOPE_READ);
|
||||
$uid = self::getCurrentUserID();
|
||||
$page = $request['page'] ?? null;
|
||||
|
||||
if (empty($page) && empty($request['max_id'])) {
|
||||
$page = 1;
|
||||
}
|
||||
|
||||
if (!empty($this->parameters['nickname'])) {
|
||||
$owner = User::getOwnerDataByNick($this->parameters['nickname']);
|
||||
if (empty($owner)) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
if ($owner['uid'] != $uid) {
|
||||
throw new \Friendica\Network\HTTPException\ForbiddenException();
|
||||
}
|
||||
$outbox = ActivityPub\Transmitter::getInbox($uid, $page, $request['max_id'] ?? null);
|
||||
} else {
|
||||
$outbox = ActivityPub\Transmitter::getPublicInbox($uid, $page, $request['max_id'] ?? null);
|
||||
}
|
||||
|
||||
System::jsonExit($outbox, 'application/activity+json');
|
||||
}
|
||||
|
||||
protected function post(array $request = [])
|
||||
{
|
||||
$postdata = Network::postdata();
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue