Better http answers
This commit is contained in:
parent
1afa6523bc
commit
8c07baf54b
|
@ -9,6 +9,7 @@ use Friendica\Database\DBA;
|
||||||
use Friendica\Model\Contact;
|
use Friendica\Model\Contact;
|
||||||
use Friendica\Util\HTTPSignature;
|
use Friendica\Util\HTTPSignature;
|
||||||
use Friendica\Util\Network;
|
use Friendica\Util\Network;
|
||||||
|
use Friendica\Core\System;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* ActivityPub Inbox
|
* ActivityPub Inbox
|
||||||
|
@ -18,30 +19,16 @@ class Inbox extends BaseModule
|
||||||
public static function init()
|
public static function init()
|
||||||
{
|
{
|
||||||
$a = self::getApp();
|
$a = self::getApp();
|
||||||
logger('Blubb: init 1');
|
|
||||||
|
|
||||||
$postdata = file_get_contents('php://input');
|
$postdata = file_get_contents('php://input');
|
||||||
|
|
||||||
$obj = json_decode($postdata);
|
if (empty($postdata)) {
|
||||||
|
System::httpExit(400);
|
||||||
if (empty($obj)) {
|
|
||||||
exit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$tempfile = tempnam(get_temppath(), 'activitypub');
|
$tempfile = tempnam(get_temppath(), 'activitypub');
|
||||||
file_put_contents($tempfile, json_encode(['header' => $_SERVER, 'body' => $obj]));
|
file_put_contents($tempfile, json_encode(['header' => $_SERVER, 'body' => $postdata]));
|
||||||
|
|
||||||
logger('Blubb: init ' . $tempfile);
|
System::httpExit(200);
|
||||||
exit();
|
|
||||||
// goaway($dest);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static function post()
|
|
||||||
{
|
|
||||||
$a = self::getApp();
|
|
||||||
|
|
||||||
logger('Blubb: post');
|
|
||||||
exit();
|
|
||||||
// goaway($dest);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,6 +25,9 @@ use Friendica\Content\Text\BBCode;
|
||||||
*
|
*
|
||||||
* https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/
|
* https://blog.joinmastodon.org/2018/06/how-to-implement-a-basic-activitypub-server/
|
||||||
* https://blog.joinmastodon.org/2018/07/how-to-make-friends-and-verify-requests/
|
* https://blog.joinmastodon.org/2018/07/how-to-make-friends-and-verify-requests/
|
||||||
|
*
|
||||||
|
* Digest: https://tools.ietf.org/html/rfc5843
|
||||||
|
* https://tools.ietf.org/html/draft-cavage-http-signatures-10#ref-15
|
||||||
*/
|
*/
|
||||||
class ActivityPub
|
class ActivityPub
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue
Block a user