forked from GNUsocial/gnu-social
[PLUGIN][ActivityPub][Inbox] Separate handler by method
This commit is contained in:
parent
51cccd0155
commit
6f3e760c63
@ -122,7 +122,7 @@ class ActivityPub extends Plugin
|
|||||||
$r->connect(
|
$r->connect(
|
||||||
'activitypub_inbox',
|
'activitypub_inbox',
|
||||||
'/inbox.json',
|
'/inbox.json',
|
||||||
[Inbox::class, 'handle'],
|
Inbox::class,
|
||||||
options: ['format' => self::$accept_headers[0]],
|
options: ['format' => self::$accept_headers[0]],
|
||||||
);
|
);
|
||||||
$r->connect(
|
$r->connect(
|
||||||
|
@ -36,6 +36,7 @@ use App\Core\Controller;
|
|||||||
use App\Core\DB\DB;
|
use App\Core\DB\DB;
|
||||||
use App\Core\Event;
|
use App\Core\Event;
|
||||||
use App\Util\Common;
|
use App\Util\Common;
|
||||||
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
use function App\Core\I18n\_m;
|
use function App\Core\I18n\_m;
|
||||||
use App\Core\Log;
|
use App\Core\Log;
|
||||||
use App\Core\Router\Router;
|
use App\Core\Router\Router;
|
||||||
@ -60,10 +61,15 @@ use Plugin\ActivityPub\Util\TypeResponse;
|
|||||||
*/
|
*/
|
||||||
class Inbox extends Controller
|
class Inbox extends Controller
|
||||||
{
|
{
|
||||||
|
public function onGet(Request $request, ?int $gsactor_id = null): TypeResponse
|
||||||
|
{
|
||||||
|
return new TypeResponse(json_encode(['error' => 'No AP C2S inbox yet.']), 400);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an Inbox Handler to receive something from someone.
|
* Create an Inbox Handler to receive something from someone.
|
||||||
*/
|
*/
|
||||||
public function handle(?int $gsactor_id = null): TypeResponse
|
public function onPost(Request $request, ?int $gsactor_id = null): TypeResponse
|
||||||
{
|
{
|
||||||
$error = function (string $m, ?Exception $e = null): TypeResponse {
|
$error = function (string $m, ?Exception $e = null): TypeResponse {
|
||||||
Log::error('ActivityPub Error Answer: ' . ($json = json_encode(['error' => $m, 'exception' => var_export($e, true)])));
|
Log::error('ActivityPub Error Answer: ' . ($json = json_encode(['error' => $m, 'exception' => var_export($e, true)])));
|
||||||
|
Loading…
Reference in New Issue
Block a user