mirror of
https://github.com/friendica/friendica
synced 2025-04-19 09:10:12 +00:00
Move ActivityPub endpoints to an AP class
This commit is contained in:
parent
6331e1e71c
commit
f62f82df75
7 changed files with 43 additions and 59 deletions
|
@ -19,10 +19,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module;
|
||||
namespace Friendica\Module\ActivityPub;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
@ -34,15 +33,12 @@ class Followers extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (empty($a->argv[1])) {
|
||||
if (empty($parameters['nickname'])) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$owner = User::getOwnerDataByNick($a->argv[1]);
|
||||
$owner = User::getOwnerDataByNick($parameters['nickname']);
|
||||
if (empty($owner)) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
|
@ -19,10 +19,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module;
|
||||
namespace Friendica\Module\ActivityPub;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\Contact;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
|
@ -34,15 +33,11 @@ class Following extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (empty($a->argv[1])) {
|
||||
if (empty($parameters['nickname'])) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
$owner = User::getOwnerDataByNick($a->argv[1]);
|
||||
$owner = User::getOwnerDataByNick($parameters['nickname']);
|
||||
if (empty($owner)) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module;
|
||||
namespace Friendica\Module\ActivityPub;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Logger;
|
||||
|
@ -36,8 +36,6 @@ class Inbox extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
$postdata = Network::postdata();
|
||||
|
||||
if (empty($postdata)) {
|
||||
|
@ -51,13 +49,12 @@ class Inbox extends BaseModule
|
|||
$filename = 'failed-activitypub';
|
||||
}
|
||||
$tempfile = tempnam(get_temppath(), $filename);
|
||||
file_put_contents($tempfile, json_encode(['argv' => $a->argv, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||
Logger::log('Incoming message stored under ' . $tempfile);
|
||||
file_put_contents($tempfile, json_encode(['parameters' => $parameters, 'header' => $_SERVER, 'body' => $postdata], JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE));
|
||||
Logger::notice('Incoming message stored', ['file' => $tempfile]);
|
||||
}
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (!empty($a->argv[1])) {
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $a->argv[1]]);
|
||||
if (!empty($parameters['nickname'])) {
|
||||
$user = DBA::selectFirst('user', ['uid'], ['nickname' => $parameters['nickname']]);
|
||||
if (!DBA::isResult($user)) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
|
@ -19,7 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module;
|
||||
namespace Friendica\Module\ActivityPub;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\Core\Logger;
|
|
@ -19,10 +19,9 @@
|
|||
*
|
||||
*/
|
||||
|
||||
namespace Friendica\Module;
|
||||
namespace Friendica\Module\ActivityPub;
|
||||
|
||||
use Friendica\BaseModule;
|
||||
use Friendica\DI;
|
||||
use Friendica\Model\User;
|
||||
use Friendica\Protocol\ActivityPub;
|
||||
use Friendica\Util\HTTPSignature;
|
||||
|
@ -34,14 +33,11 @@ class Outbox extends BaseModule
|
|||
{
|
||||
public static function rawContent(array $parameters = [])
|
||||
{
|
||||
$a = DI::app();
|
||||
|
||||
// @TODO: Replace with parameter from router
|
||||
if (empty($a->argv[1])) {
|
||||
if (empty($parameters['nickname'])) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
||||
|
||||
$owner = User::getOwnerDataByNick($a->argv[1]);
|
||||
$owner = User::getOwnerDataByNick($parameters['nickname']);
|
||||
if (empty($owner)) {
|
||||
throw new \Friendica\Network\HTTPException\NotFoundException();
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue